jnoyola
January 15, 2019, 10:09pm
3
I remember seeing this in the past as well with surprisingly little info in the forum.
I think I ran into this exact issue, and I see a few unresolved threads about it. There’s a workaround that involves just passing in textures as regular parameters without using registers, but did anyone understand the exact fix described here based on how the effect is compiled?
EDIT: This was with loading a raw fx file through the content manager. I can try running it through 2MGFX tomorrow to see if there’s a difference.
I always wondered if it was related to this quirk, where shader variables are aggressively optimized in a way that can screw up integrated code, but I’m not sure if they’re related.
I think I see the problem!
Since I’m not using LightScreenPos.z, that means I’m not using the 3rd column of LightViewProjection.
When HLSL is converted to GLSL, matrices are each converted to 4 separate column vectors.
The compiler is recognizing that the 3rd column is not being used, and it isn’t leaving space for it when pulling column vectors from the buffer. Columns 1, 2, and 4 are read consecutively.
This vital info is being lost, however, when MonoGame is setting the buffer. Whenever you…