Skip to content

vkd3d-shader/hlsl: Support SM1 relative addressing of uniforms.

SM1 allows relative addressing of uniforms, but only on vertex shaders.

Patch 1/8 adds a vertex shader test that performs relative addressing of uniforms, but so far we are not doing relative addressing of uniforms, just loading all components of the uniform and then selecting the right one at execution time, which is what happens when relative addressing is attempted e.g. with temps. So the test initially passes.

Patches 2/8, 3/8, 4/8, 5/8, 6/8 set up in place many things that otherwise break when we do relative addressing on a uniform variable, which hasn't happened so far because lower_index_loads() is creating a temp for every index load, and the temp is being addressed, 7/8 stops doing that. Among these group of patches 3/8 is the one that creates vsir instructions with relative addressing of uniforms for SM4 and 6/8 does the same for SM1.

After 7/8 is in place, the introduced test starts to fail for glsl and sm<4, but this is not a problem of the compiler but rather that the backends don't properly convert relative addressing. 8/8 introduces the solution (lowering MOVA instructions and turning a0 into a temp) for the sm<4 backend.

Merge request reports

Loading