vkd3d-shader/hlsl: Interstage signature optimization, part 1.
Interstage signature optimization is required to fix CW Bug 24073, Eastward.
Native compiler optimizes pixel shader output and vertex shader input signatures in order to use less registers.
This first part contains just the tests. Tests in 1/3 are not really testing the signatures and are just for documenting purposes. Testing them directly would require adding reflection to the shader runner.
Two complex tests to hlsl_d3d12.c are added in 2/3 and 3/3, the one in 3/3 includes arrays within the signature.
The following patches are in my eastward2 branch.
Merge request reports
Activity
added 1 commit
- b7bf02dc - tests: Test interstage signature with an array.
I like to have those around for documentation purposes, IMO it is just a nice place to write the native compiler rules (otherwise were?) and small examples to verify them. Granted it would make more sense if we had reflection capabilities in the shader runner.
If eventually we introduce a regression that breaks the signature allocation order, the hlsl_d3d12.c tests should be complex enough to tell when something is wrong, but these simpler examples can be tested manually to find what is wrong.
I considered the tests in .shader_tests to be more readable and easy to copy than the ones in hlsl_d3d12.c, but I don't think it is worth arguing more about. I moved all the tests to hlsl_d3d12.c.
At some point before this MR got upstreamed, Evan sent !1151 (merged) that adds
interface-packing.shader_test
which documents, albeit less verbosely, the same rules. So I will drop the explanation in 1/3.Eh, right, they're easier to type the HLSL code, that is true.
I have considered doing a slight hack to write HLSL source along the lines of
#define HLSL_SOURCE(x) #x static const char ps_source[] = HLSL_SOURCE( float4 main() : sv_target { return 0; } )
It strips the newlines but I think works otherwise.
In general I think this kind of thing is better suited for a reflection test, all else aside. They're more direct, so you don't need the extra infrastructure to see the effect, and you can see exactly which registers are assigned, instead of just checking that they match.
added 174 commits
-
f4c2f802...cd249a47 - 171 commits from branch
wine:master
- 570156fc - tests: Add tests to document interstage signature optimization.
- e71256df - tests: Test interstage signature optimizations.
- 53da3627 - tests: Test interstage signature with an array.
Toggle commit list-
f4c2f802...cd249a47 - 171 commits from branch
Are you aware of !1151 (merged) having been merged? I didn't read the tests in detail, but it seems that you're checking kind of the same thing. If anything, your tests might go in the same
.shader_test
file, and duplicate tests might be removed.
added 21 commits
-
53da3627...9dd42d15 - 19 commits from branch
wine:master
- 7d2a4bce - tests: Test interstage signature optimizations.
- 3ebd63e6 - tests: Test interstage signature with arrays.
-
53da3627...9dd42d15 - 19 commits from branch
added 1 commit
- 7fff07d1 - tests: Test interstage signature with arrays.
added 17 commits
-
7fff07d1...bc351f4b - 15 commits from branch
wine:master
- d3c46421 - tests: Test interstage signature optimizations.
- 0ab5e1cb - tests: Test interstage signature with arrays.
-
7fff07d1...bc351f4b - 15 commits from branch