Repository navigation
Conversation
kd-11
left a comment
There was a problem hiding this comment.
This fix stumbles across a real bug but doesn't fix it correctly. The one-liner in texture_cache.h is correct only for 3D textures.
- From a graphics programming POV, unnormalized cubemap textures don't really make sense. This needs to be probed if RSX throws or silently fails when trying to do this.
- The code section is supposed to force register decodes exactly one time. So the proper fix would have moved the is_unnormalized block below the attribute initialization block and changed initialization to use multiplication instead of assignment.
- The texcoord snapping hack is tricky. Note that only NVIDIA cards are affected by the texcoord rounding drift, and we don't even know for sure which generations are affected and which aren't. Tbh I think the hackfix was not the right solution, but that work needs a whole issue and a suite of hardware test scenarios (see #19778 for an example of what that looks like).
The explanation given at the site doesn't make much sense to me - the texcoord transformation is internal, not visible to the original shader itself.
Textures on RSX have very limited dimensions, so as a start, perform a sweep of all possible values to identify these so-called thin-bands explicitly. There's only 4096 numbers to check which a python script can do trivially. The bias becomes very very tiny (min value = 0.00000244140625, encoded as 0.000002441406195...) and sampling is doing with point sampling. If there are edge cases found, the answer is obviously to simply adjust the subpixel bias until the platform passes.
FLR can be used to sample unnormalized ofc, but FRC cannot (it would always sample 0). Remember that this whole subpixel bias thing only exists for unnormalized (integer coords) textures and nearest sampling.
|
thanks. Hopefully even this currently broken feature will be fixed soon. Consider that the changes in this PR fixed also the ripples on water also in Resistance 2. So probably it impacts also other Insomniac games |
44720b5 to
7b971fc
Compare
Apply the unnormalized coordinate scale after the texture attributes are decoded, so the depth of 3D textures is known (it was 0, giving an infinite depth scale). The width scale uses the decoded width captured before the pitch fixup, which applies its own correction to the scale. Cubemaps are left unscaled, since their coordinates are a direction.
7b971fc to
bc8f1a4
Compare
|
@kd-11 updated following your review:
|
Analysis and fix made by Opus 5.5. Tested by me.
Fixes the missing waves on water in Killzone 3 and Resistance 2 (#18250), a regression from #10637.
Tested in Killzone 3 and Resistance 2: waves are back.
fixes #18250
In
upload_texture()the unnormalized coordinate scale was computed before the texture attributes were decoded, so for 3D texturesattributes.depthwas still 0 andscale.depthbecame infinite (every lookup sampled the same slice).Changes (following the review):
is_unnormalizedblock is moved after the dimension decode and validation, so all dimensions are valid; the registers are decoded only once;scale.widthbypacked_pitch / pitch; dividing by the fixed-up width would count that correction twice;(1/W, 1/H, 1)scale would rotate it. Hardware behavior for unnormalized cubemaps is not verified.The texcoord snapping workaround for the grid pattern visible on the waves (see screenshot above) has been removed from this PR. The grid is a separate issue (it was hidden while the depth scale was broken) and will be tracked on its own with hardware tests.