Zebediah Figura
6e303af519
vkd3d-shader/hlsl: Free the "iter" block pointer on success in create_loop().
...
Spotted by Giovanni Mascellani.
2023-07-05 22:32:48 +02:00
Zebediah Figura
b0ac77b44d
vkd3d-shader/hlsl: Return a hlsl_block from the "expr_statement" and "expr" rules.
2023-07-05 22:32:47 +02:00
Zebediah Figura
07ce711583
vkd3d-shader/hlsl: Return a hlsl_block from the "jump_statement" rule.
2023-07-05 22:32:46 +02:00
Zebediah Figura
e4bf5933b9
vkd3d-shader/hlsl: Return a hlsl_block from the "selection_statement" rule.
2023-07-05 22:32:45 +02:00
Zebediah Figura
79dd9544b7
vkd3d-shader/hlsl: Return a hlsl_block from the "loop_statement" rule.
2023-07-05 22:32:43 +02:00
Zebediah Figura
23ff83e8a0
vkd3d-shader/hlsl: Return a hlsl_block from the "statement" rule.
...
As well as from the "statement_list" and "compound_statement" rules, which
trivially pass through from "statement".
2023-07-05 22:32:41 +02:00
Zebediah Figura
53e9ad3e4c
vkd3d-shader/hlsl: Do not emit DEF instructions for uniform constants.
2023-07-04 22:40:20 +02:00
Zebediah Figura
e5afbda34a
vkd3d-shader/hlsl: Simplify allocate_const_registers_recurse() to stop accounting for constants larger than a vector.
...
That cannot happen with the current code.
2023-07-04 22:40:16 +02:00
Zebediah Figura
8a2b357855
vkd3d-shader/hlsl: Allocate anonymous constants after uniforms.
2023-07-04 22:40:13 +02:00
Zebediah Figura
717cd3f5bb
vkd3d-shader/hlsl: Consistently use the destination width in constant folding instructions (Valgrind).
2023-07-04 22:40:06 +02:00
Zebediah Figura
e390bc35e2
vkd3d-shader/d3dbc: Set the source count for DEF instructions to 1 (Valgrind).
...
We emit one source with multiple components.
2023-07-04 22:40:04 +02:00
Nikolay Sivov
06040d2a30
vkd3d-shader/hlsl: Disallow certain instruction types from constant expressions.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:57 +02:00
Nikolay Sivov
a65c0b0e22
vkd3d-shader/hlsl: Support evaluated expressions for sample count in multisampled textures declarations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:55 +02:00
Zebediah Figura
73d422a0e0
vkd3d-shader/d3dbc: Scan for the maximum temporary register index.
2023-07-04 22:39:48 +02:00
Zebediah Figura
e489098878
vkd3d-shader: Record a global temporary count per sm4 shader.
...
Store it in the shader_desc, and declare temps from that when compiling SPIR-V,
instead of parsing dcl_instructions.
As part of this change, we declare a single, global temps array (with Private
scope instead of Function) which is as large as the maximum of all dcl_temps
instructions. It is not clear to me whether this will improve, hurt, or have no
significant effect on the lower-level compiler. An alternative is to still
redeclare a new temps array every time (although still with a smaller size).
2023-07-04 22:39:45 +02:00
Zebediah Figura
dfb2a316e6
vkd3d-shader/dxbc: Remove redundant zero-initialization of the vkd3d_shader_desc structure.
2023-07-04 22:39:43 +02:00
Nikolay Sivov
300f3462a4
vkd3d-shader/hlsl: Add constant folding for 'rcp'.
2023-07-04 22:39:36 +02:00
Francisco Casas
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
Francisco Casas
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
Francisco Casas
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
Francisco Casas
e4d94d955c
vkd3d-shader/hlsl: Support fine derivates.
2023-07-04 22:39:12 +02:00
Francisco Casas
ff31284f8d
vkd3d-shader/hlsl: Support coarse derivates.
2023-07-04 22:39:10 +02:00
Conor McCarthy
de25e88901
vkd3d-shader/dxil: Read and validate global abbreviated operands.
2023-06-28 21:40:37 +02:00
Conor McCarthy
e9a8bfb2c4
vkd3d-shader/dxil: Read and validate local abbreviated operands.
2023-06-28 21:40:36 +02:00
Conor McCarthy
6775f7ba66
vkd3d-shader/dxil: Read and validate DXIL bitcode unabbreviated blocks.
2023-06-28 21:40:34 +02:00
Nikolay Sivov
69f32796b0
vkd3d-shader: Unify static string arrays initialization pattern.
2023-06-28 21:40:21 +02:00
Zebediah Figura
9ccba35dde
vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.
2023-06-28 21:40:18 +02:00
Zebediah Figura
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
Zebediah Figura
7d521db3db
vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
2023-06-28 21:40:15 +02:00
Zebediah Figura
588784e4dc
vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
2023-06-28 21:40:14 +02:00
Zebediah Figura
b4bf5af475
vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
2023-06-28 21:40:12 +02:00
Giovanni Mascellani
bdfec4886d
vkd3d-shader/hlsl: Fold logical expressions.
2023-06-27 22:34:33 +02:00
Giovanni Mascellani
5a05fabe62
vkd3d-shader/hlsl: Fold floating point minimum expressions.
2023-06-27 22:34:30 +02:00
Giovanni Mascellani
2a2943c2cf
vkd3d-shader/hlsl: Fold floating point maximum expressions.
2023-06-27 22:34:29 +02:00
Giovanni Mascellani
358d656262
vkd3d-shader/hlsl: Fold greater-than-or-equal comparisons.
2023-06-27 22:34:28 +02:00
Giovanni Mascellani
bf452b5907
vkd3d-shader/hlsl: Fold less-than comparisons.
2023-06-27 22:34:27 +02:00
Giovanni Mascellani
488af14144
vkd3d-shader/hlsl: Fold equality comparisons.
2023-06-27 22:34:25 +02:00
Giovanni Mascellani
6c9f6d0fcf
vkd3d-shader/hlsl: Sort constant folding helpers alphabetically.
2023-06-27 22:34:24 +02:00
Nikolay Sivov
4ed60cda13
vkd3d-shader: Remove extra newlines from compiler messages.
2023-06-27 22:34:19 +02:00
Nikolay Sivov
9ccf291971
vkd3d-shader/hlsl: Use profile version testing helpers in more places.
2023-06-27 22:34:05 +02:00
Nikolay Sivov
5c02e12187
vkd3d-shader/hlsl: Make sample count optional for SM4.1+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:34:03 +02:00
Nikolay Sivov
861078d63a
vkd3d-shader/hlsl: Handle 'texkill' discard type for sm4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:50 +02:00
Nikolay Sivov
8d84e206ab
vkd3d-shader/hlsl: Parse clip() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:48 +02:00
Nikolay Sivov
b40179da3a
vkd3d-shader/hlsl: Add a parameter for jump nodes and use it for 'discard'.
2023-06-27 22:33:47 +02:00
Zebediah Figura
7e1fcdca89
vkd3d-shader: Synthesize signatures for d3dbc shaders.
2023-06-27 22:33:41 +02:00
Zebediah Figura
20190a1388
vkd3d-shader: Introduce an API to retrieve all signatures from DXBC shaders.
2023-06-27 22:33:41 +02:00
Stefan Dösinger
5e88ab22aa
vkd3d-shader/hlsl: Make sure variants is initialized in declare_predefined_types().
...
MSVC is too stupid to see it is unused when n_variants=0.
2023-06-27 22:33:31 +02:00
Henri Verbeet
771e442af1
Release 1.8.
2023-06-22 22:00:20 +02:00
Nikolay Sivov
c8ffe8e1a8
vkd3d-shader/hlsl: Don't report a register type mismatch for unused reserved variables.
2023-06-22 22:00:19 +02:00
Zebediah Figura
d6ac823dd6
vkd3d-shader/hlsl: Don't set "allocated" for unused reserved variables.
2023-06-22 22:00:17 +02:00