Commit Graph

7197 Commits

Author SHA1 Message Date
b4296e1a2d tests/hlsl: Add another constant folding test. 2025-03-12 21:34:02 +01:00
dd1072a99b tests/hlsl: Add geometry shader syntax tests. 2025-03-12 21:21:35 +01:00
ae5261b98b vkd3d-shader/hlsl: Forbid output parameters in geometry shaders.
Outputs in geometry shaders must be written to streams.
2025-03-12 21:15:15 +01:00
4137ea5ab7 vkd3d-shader/hlsl: Validate stream output parameters in geometry shaders. 2025-03-12 21:13:59 +01:00
b650e7a503 vkd3d-shader/hlsl: Validate stream output object declarations.
Valid stream output objects must be single-element containing a
PointStream/LineStream/TriangleStream object.

Moreover, stream output objects cannot be declared globally.
2025-03-12 21:12:56 +01:00
870c68dd27 vkd3d-shader/hlsl: Validate and record input primitive types in geometry shaders. 2025-03-12 21:11:46 +01:00
57bb28e841 vkd3d-shader/hlsl: Parse primitive type modifiers in geometry shaders. 2025-03-12 20:42:59 +01:00
e880b11626 vkd3d-shader/hlsl: Parse the maxvertexcount attribute. 2025-03-12 20:42:15 +01:00
7be7e589a9 vkd3d-shader/hlsl: Lower TRUNC expressions for SM1.
Basically, separate lower_casts_to_int() into the lowering of the CAST
and the lowering of the TRUNC, so that TRUNCs that are not part of a
cast are lowered as well.
2025-03-12 18:26:23 +01:00
1b03676a36 tests/hlsl: Add dynamic addressing copy-propagation tests. 2025-03-12 18:22:01 +01:00
7ab7b2ab8b vkd3d-shader/hlsl: Implement copy-propagation of derefs with a non-constant index.
We implement a transformation that propagates loads with a single
non-constant index in its deref path. Consider a load of the form
var[[a0][a1]...[i]...[an]], where ak are integral constants, and i is
an arbitrary non-constant node. If, for all j, the following holds:

  var[[a0][a1]...[j]...[an]] = x[[c0*j + d0][c1*j + d1]...[cm*j + dm]],

where ck, dk are constants, then we can replace the load with
x[[c0*i + d0]...[cm*i + dm]]. This pass is implemented by
copy_propagation_replace_with_deref().
2025-03-12 18:16:59 +01:00
f484527cfb vkd3d-shader/hlsl: Rename init_deref() to hlsl_init_deref(). 2025-03-12 17:22:44 +01:00
2bc7fa568f vkd3d-shader/hlsl: Introduce component_index_from_deref_path_node(). 2025-03-12 17:19:56 +01:00
2368ff6637 vkd3d-shader/hlsl: Introduce simplify_exprs().
Also invoke simplify_exprs() after replace_deref_path_with_offset().
2025-03-12 17:18:52 +01:00
c6f18c9394 vkd3d-shader/hlsl: Support indirect addressing of uniforms in sm4_generate_vsir_reg_from_deref(). 2025-03-12 17:14:52 +01:00
f6c35144e4 vkd3d-shader/hlsl: Support patch arrays in hlsl_reg_from_deref(). 2025-03-12 17:10:32 +01:00
261b5120f6 vkd3d-shader/hlsl: Allow non-constant indices in register_deref_usage(). 2025-03-12 17:10:32 +01:00
1c2434f4d3 vkd3d-shader/hlsl: Allow uint1-typed deref path nodes.
When derefs with non-constant indices are copy-propagated, it is
possible to end up with uint1-typed path nodes.

Also, introduce hlsl_is_vec1().
2025-03-12 17:09:35 +01:00
766492d1cc vkd3d-shader/glsl: Implement support for indirect constant buffer addressing. 2025-03-12 17:06:47 +01:00
16b0afc192 vkd3d-shader/tpf: Write non-zero static offsets in relative addressing mode in sm4_write_register_index(). 2025-03-12 17:04:52 +01:00
81dc67b1ef demos: Add copyright headers to the HLSL shaders. 2025-03-10 15:18:07 +01:00
8f28956108 vkd3d-shader/hlsl: Fix writing the sincos extra constants.
Fixes: 4ed16108f0
2025-03-10 15:17:19 +01:00
d075c3c274 vkd3d-shader/hlsl: Fix temp allocation for ps 1.x.
Iterate over the extern vars, not the parameters. The synthesized inputs and
output don't go in the function parameters.

Fixes: 8b57a612d7
2025-03-10 15:17:19 +01:00
553e37314a vkd3d-shader/fx: Print string object entries for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-10 15:14:32 +01:00
3749171656 vkd3d-shader/fx: Output object initialiser IDs for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-10 15:14:24 +01:00