Commit Graph

4038 Commits

Author SHA1 Message Date
52d5cb749f vkd3d: Release the op mutex on allocation failure. 2023-07-04 22:39:31 +02:00
01800942a9 vkd3d-shader/hlsl: Declare vars individually when parsing struct declarations.
A struct declaration with variables is now absorbed into the 'declaration'
rule, like any other variable declaration.

A struct declaration without variables is now reduced to the
'struct_declaration_without_vars' rule.

They both are reduced to a 'declaration_statement' in the end.
2023-07-04 22:39:24 +02:00
62c891b796 vkd3d-shader/hlsl: Declare vars individually when parsing regular declarations.
In a declaration with multiple variables, the variables must be created
before the initializer of the next variable is parsed. This is required
for initializers such as:

    float a = 1, b = a, c = b + 1;

A requisite for this is that the type information is parsed in the same
rule as the first variable (as a variable_def_typed) so it is
immediately available to declare the first variable. Then, the next
untyped variable declaration is parsed, and the type from the first
variable can be used to declare the second, before the third is parsed,
and so on.
2023-07-04 22:39:21 +02:00
a34cf2e64e vkd3d-shader/hlsl: Split declare_vars().
Basically, declare_vars() is separated in three functions:

1. check_invalid_in_out_modifiers(), which is to be called once per
   declaration and emits an error when in or out modifiers are used for
   these non-parameter variables.

2. declare_var(), which now handles one variable at the time and doesn't
   free any memory.

3. initialize_vars(), which takes care of preparing the initialization
   instructions of several variables and frees their struct
   parse_variable_def, using exclusively free_parse_variable_def().

This allows to declare variables individually before the initializer of
the next variable in the same declaration is parsed, which is used in
the following patches.

Also, simplifies memory management.
2023-07-04 22:39:18 +02:00
396edae281 tests: Test multiple variable initializers. 2023-07-04 22:39:18 +02:00
d8e6a1066d tests: Test semantics in uniform variables. 2023-07-04 22:39:18 +02:00
e4d94d955c vkd3d-shader/hlsl: Support fine derivates. 2023-07-04 22:39:12 +02:00
ff31284f8d vkd3d-shader/hlsl: Support coarse derivates. 2023-07-04 22:39:10 +02:00
dc84afe73a tests: Quantize regular and coarse derivate test results.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2023-07-04 22:39:07 +02:00
f0584cad62 tests: Make ddx() and ddy() test behave correctly for shader models < 4. 2023-07-04 22:39:07 +02:00
62e9b86697 tests: Test coarse and fine derivates.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2023-07-04 22:39:04 +02:00
d5a0b3afc4 include: Avoid including unnecessary Windows headers.
We only require a few types and declarations.
2023-06-28 21:41:14 +02:00
08cece3a92 vkd3d: Print the thread id in trace messages. 2023-06-28 21:40:40 +02:00
de25e88901 vkd3d-shader/dxil: Read and validate global abbreviated operands. 2023-06-28 21:40:37 +02:00
e9a8bfb2c4 vkd3d-shader/dxil: Read and validate local abbreviated operands. 2023-06-28 21:40:36 +02:00
8c7704bb78 vkd3d-compiler: Introduce a dxbc-dxil source type. 2023-06-28 21:40:36 +02:00
d3e6a3a78f include: Introduce a function to detect the DXBC source type. 2023-06-28 21:40:36 +02:00
6775f7ba66 vkd3d-shader/dxil: Read and validate DXIL bitcode unabbreviated blocks. 2023-06-28 21:40:34 +02:00
0d2f2e1860 tests: Move HLSL tests to a subdirectory. 2023-06-28 21:40:32 +02:00
69f32796b0 vkd3d-shader: Unify static string arrays initialization pattern. 2023-06-28 21:40:21 +02:00
9ccba35dde vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers. 2023-06-28 21:40:18 +02:00
8fa1750206 vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer. 2023-06-28 21:40:16 +02:00
7d521db3db vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement". 2023-06-28 21:40:15 +02:00
588784e4dc vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule. 2023-06-28 21:40:14 +02:00
b4bf5af475 vkd3d-shader/hlsl: Factor out add_binary_expr_merge(). 2023-06-28 21:40:12 +02:00