vkd3d-shader/hlsl: Add passes variables to the techniques.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Merge request reports
Activity
I think initialize_vars() is not suitable for general use case of just storing initializer. Current it does produce blocks to initialize what could be actually initialized. For the purposes of effects metadata, what we need is per-variable initializer field, that could later be turned to such instruction blocks if necessary. Cases when it's not necessary are state objects, strings, and annotations.
Why would I produce blocks for e.g. assigning state object fields? It means that first you get instruction lists that you later have to iterate over again to figure out what to do with them. For example, for a matrix it's enough to simplify each element individually and then write them all together. Using blocks has an advantage of easily evaluating constant expressions, but then to write actual result for any type that's not a scalar, you'll have to sort of interpret such blocks. Then for strings, it will produce a string constant load, without string constants supported anywhere else.
Oh, I see, you mean that it produces a single block.
It's not unworkable or even necessarily complex with a single block (consider e.g. emitting a load per component, adding a hlsl_src, then running copy-prop), but it may indeed be easier to work from the parse_variable_def list. But at the same time that probably means we're going to duplicate a lot of code. I'd have to see the code in question.
In any case it doesn't really affect this merge request enough to block it, so I'll set it aside for now.
added 8 commits
- 03266455 - tests/hlsl: Add some tests for annotations.
- 5df29ea7 - vkd3d-shader/hlsl: Add initial support for parsing annotations.
- d3fe2641 - vkd3d-shader/hlsl: Add passes variables to the techniques.
- 5e000c3c - vkd3d-shader/hlsl: Allow annotations on passes.
- ffe6e3d6 - vkd3d-shader/hlsl: Allow annotations on techniques.
- 76405309 - vkd3d-shader/fx: Check technique type in global scope as well.
- ddc1669a - vkd3d-shader/fx: Add initial support for writing fx_2_0 binaries.
- bcc44645 - vkd3d-shader/fx: Add initial support for writing passes for fx_2_0.
Toggle commit listThese annotation tests are good to start with, but we could use more. Here are some that occur to me:
-
Can you use braced initializers? They work the same way as the rest of HLSL, right? [E.g. braces aren't validated; unwritten components are initialized to zero; variable boundaries need not match.] Cf. initializer-nested.shader_test and initializer-flatten.shader_test; of course we don't need to copy every test but one or two should be enough to answer this question in the affirmative.
-
Can you leave variables uninitialized? If so, can you put a state block in there?
-
Can you declare a type within the annotation, via a typedef or struct declaration?
-
If not, can you still declare a struct and a variable at the same time? (I.e. "struct apple { ...} a;")
-
Can you give variables values that require constant folding?
-
Can you give variables values that require copy-prop? (E.g. assigning to a previously declared static const variable).
-
Can you give variables modifiers? Both type qualifiers like "row_major", and storage modifiers like "static", are interesting to test here.
-
Can you use the comma to separate multiple variable declarations? Cf. also initializer-multi.shader_test.
-
Can you declare implicitly sized arrays?
I also doubt it's worth duplicating the annotation tests for every effect model if they seem to behave identically. On the other hand, we might want to put them into a dedicated test file.
-
added 32 commits
-
bcc44645...cd77b2a9 - 24 commits from branch
wine:master
- ddd7506d - tests/hlsl: Add some tests for annotations.
- 24677b03 - vkd3d-shader/hlsl: Add initial support for parsing annotations.
- b3fd23b4 - vkd3d-shader/hlsl: Add passes variables to the techniques.
- e3605cdf - vkd3d-shader/hlsl: Allow annotations on passes.
- 2cd3cf3a - vkd3d-shader/hlsl: Allow annotations on techniques.
- a6fcfe52 - vkd3d-shader/fx: Check technique type in global scope as well.
- 90119851 - vkd3d-shader/fx: Add initial support for writing fx_2_0 binaries.
- 24d0abf5 - vkd3d-shader/fx: Add initial support for writing passes for fx_2_0.
Toggle commit list-
bcc44645...cd77b2a9 - 24 commits from branch
added 38 commits
-
24d0abf5...14da4df9 - 30 commits from branch
wine:master
- 9b69363d - tests/hlsl: Add some tests for annotations.
- f397830d - vkd3d-shader/hlsl: Add initial support for parsing annotations.
- 2d768fdd - vkd3d-shader/hlsl: Add passes variables to the techniques.
- 42a4ee70 - vkd3d-shader/hlsl: Allow annotations on passes.
- a91a0470 - vkd3d-shader/hlsl: Allow annotations on techniques.
- 7e72c949 - vkd3d-shader/fx: Check technique type in global scope as well.
- 126d372b - vkd3d-shader/fx: Add initial support for writing fx_2_0 binaries.
- 837b5b29 - vkd3d-shader/fx: Add initial support for writing passes for fx_2_0.
Toggle commit list-
24d0abf5...14da4df9 - 30 commits from branch
added 38 commits
-
837b5b29...232b2ad3 - 30 commits from branch
wine:master
- 341963bb - tests/hlsl: Add some tests for annotations.
- fe888174 - vkd3d-shader/hlsl: Add initial support for parsing annotations.
- e72f8f9a - vkd3d-shader/hlsl: Add passes variables to the techniques.
- 76a689d4 - vkd3d-shader/hlsl: Allow annotations on passes.
- 2c1905b7 - vkd3d-shader/hlsl: Allow annotations on techniques.
- 56100d36 - vkd3d-shader/fx: Check technique type in global scope as well.
- b478f0a3 - vkd3d-shader/fx: Add initial support for writing fx_2_0 binaries.
- 0117e4fb - vkd3d-shader/fx: Add initial support for writing passes for fx_2_0.
Toggle commit list-
837b5b29...232b2ad3 - 30 commits from branch