GS: Accurate UV rounding for axis-aligned prims.#14078
GS: Accurate UV rounding for axis-aligned prims.#14078TJnotJT wants to merge 3 commits intoPCSX2:masterfrom
Conversation
c50fcdd to
10c7f5b
Compare
|
Fixes lines showing up on some menus for armored core 2: #2394 Also helps in-game hud artifacting |
eeef513 to
0337e4c
Compare
|
Fixes Mercenaries |
|
Dark Cloud 2 ( i have PAL version, Dark Chronicle) UI glitches are fixed in software mode here is a gsdump i checked to be sure and with AccurateUVRounding set to 0 (disabled) it doesn't have this issue |
The pr is only for native res, for now. But also I cannot reproduce this on linux...except for OpenGL: |
|
@bigol83 @AmandaRoseChaqueta Are there any shader compilation/linking errors in the log when it breaks? I'm not able to reproduce for some reason. |
Let me check... bad shader: |
|
i also have lots of bad shaders in my log, put them all here in a zip file |
|
Thanks both. My drivers might be a bit more lenient with GLSL. Hopefully the last push resolves it. |
|
Shadow Hearts - Covenant |
|
Tested your latest PR in dot hack (Mirror SW renderer UV rounding setup in HW renderer SW draw), for native it remains fixed, but for upscaling it's not. The behaviour this time is consistent no matter what multiplier I choose. With all scaling modes on screen sprites are shifted to the side by the same amount. It happened before, but now I checked with other elements on the screen like a map, it's very noticable there. If you look closely, the whole image is shifted a bit to the left side (better use a picture viewer, so you can scroll between two images). Software mode behaves the same as native hw. Scaled lookes more correct if you look at map elements, especially the portal symbol. It has a black bar to the left which shouldn't be there, because now it's shifted. Subtitles and character menu have distinct black background under them, now when it's shifted it's more visible. Screens and dumps, first is native, second is 2x.
Before that I checked older builds from gs-accurate-uv branch as you pushed them and they each worked differently (some where just broken), so I never reported anything. Edit. |
|
@Shifroval Thanks again for the info. Just to clarify, this PR only affects native resolution and doesn’t change upscaling. I’m using the dump you provided to test some upscaling fixes on a separate branch, which I’ll PR separately if/when it’s ready. |
I understand that, but I'm testing upscaling anyway, since it may come handy in the future. It produces different results now, so that may give you some better understanding what to expect later. |
a0f4efb to
2864f02
Compare
e3ec364 to
0f014f3
Compare
72cc8c3 to
982a515
Compare





















Status: Everything needs to be retested and SW has to be ported to ARM.
Description of Changes
Do UV rounding at the pixel level (pixel shader for HW and scanline renderer for SW). Currently only applies to native resolution and point-sampled draws.
This replaces my previous attempt at vertex level adjustment (#14029), as doing it per-pixel is probably more accurate.
As before, this is built on work by refraction (#6553).
Rationale behind Changes
Intended to fix issues in some games that rely on accurate UV rounding such as:
Others are mentioned in #6553, though I haven't checked all.
Further Details
Implementation
Limitations
Performance
Hardware Details
The following rounding rules for axis-aligned prims were determined using hardware tests, though it's possible they are nuances that are not fully understood.
Assume the corners of the quad are (X0, U0, Y0, V0), (X1, U1, Y1, V1). Let dX = X1 - X0 and similarly for dU, dY, dV. Sprites are specified by these two vertices. For axis-aligned triangles that form quads, assume these are the two right angle corners.
Sprites
U and V are rounded independently, so we only discuss X and U below:
Hypothesis:
Axis-aligned Triangles
Hypotheses:
Additional Details
Examples
Armored_Core_-_Nexus_Disc_2_SLPS-25339_20221021180346.gs.xz (reproducing buggy PS2 behavior, see right side of lock-on box):
PS2

Master SW

PR SW

Gallop Racer Inbreed_SLPS-25701.gs.xz (bottom-right triangles being rounded differently, zoom in on the gray circular things in the top-left UI)
PS2

Master SW

PR SW

World Heroes Anthology_SLES-55233_20250314193501.gs.xz (round down error + bilinear causing slight blurriness compared to master)
PS2

Master SW

PR SW

Suggested Testing Steps
Use any renderer, HW or SW. The setting is on by default, though it can be disabled with the INI setting:
Did you use AI to help find, test, or implement this issue or feature?
Yes, as a reference to help porting things to the scanline JIT, Metal, and probably other places.