Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PixelShaderGen: fix OOB indirect texcoord indices #8296

Closed
wants to merge 1 commit into from

Conversation

Tilka
Copy link
Member

@Tilka Tilka commented Aug 5, 2019

Previously we set the indirect texture coordinate to zero, now we set the indirect texture coordinate index to zero. This fixes the ripple effect of the Mario painting in Luigi's Mansion (issue 11462).

Needs some hardware tests.

Previously we set the indirect texture coordinate to zero, now we set
the indirect texture coordinate *index* to zero. This fixes the ripple
effect of the Mario painting in Luigi's Mansion.
@Tilka Tilka changed the title [WIP] PixelShaderGen: fix OOB indirect texcoord indices PixelShaderGen: fix OOB indirect texcoord indices Jan 25, 2020
}
// TODO: are out-of-range values set to zero or clamped?
// TODO: same thing probably with direct texcoord indices?
if (texcoord >= uid_data->genMode_numtexgens)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What shall happen if uid_data->genMode_numtexgens == 0 ?

@JMC47
Copy link
Contributor

JMC47 commented Sep 9, 2020

Is there a hero willing to write hardware tests so Mario can comfortably sit in his painting with the privacy blur on? Or are you really gonna let Luigi stare at him like this.

@JMC47
Copy link
Contributor

JMC47 commented Sep 11, 2020

@dolphin-emu-bot rebuild

@Adamillo
Copy link

JMC is right! We need a hero that can test this. Luigi has been staring at Mario for way too long!

@Pokechu22
Copy link
Contributor

Hardware tested (permalink to this version of the test). This fix is semi-correct, but I got some additional glitchy behavior on console (one of two triangles seems to use the previous scale and had garbage data that changed on each frame when there was no previous texture). That extra glitchy behavior doesn't seem to apply to Luigi's Mansion.

Here is a comparison of what I got on hardware and with my reimplementation of this change (which I did in the software renderer).

Note that the painting likely does this by accident; I analyzed it a bit and determined that they have a 64 by 64 noise texture as texture 1 that they meant to use, but they set the number of tex gens to 1 so they use tex coords for the 128 by 128 mario texture. If tex gens is set to 2, a more coarse distortion happens (even without the fix here), which is what Nintendo probably intended to do.

When I tested 0 tex gens, I got a completely black image on console, as the direct texture didn't render. Dolphin renders a solid color (that wasn't black and changed for different textures) in that case. That case probably should just get an assertion, as I don't think any game will intentionally render a texture without texture coordinates.

I still need to hardware test whether it clamps or sets it to 0, and what happens with direct coordinates.

@Tilka
Copy link
Member Author

Tilka commented Apr 26, 2021

Superseeded by #9651.

@Tilka Tilka closed this Apr 26, 2021
@Tilka Tilka deleted the oob_texcoord branch April 26, 2021 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants