Commit Graph

780 Commits

Author SHA1 Message Date
Elizabeth Figura
33cd10581e vkd3d-shader/glsl: Invert gl_FragCoord w. 2025-04-02 19:32:39 +02:00
Shaun Ren
3e44bd4e5b tests/hlsl: Add a test for copy-propagation of uniform texture object writes. 2025-04-02 18:51:10 +02:00
Francisco Casas
3ead8d532b vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.
Note that we still have to preempt the propagation to SM1 pixel shader
uniforms. Otherwise this will turn the many constant derefs that appear
from the <index-val> copy generated in lower_index_loads() into a single
non-constant deref, causing it to allocate all the registers instead of
up until the last one used.
2025-04-02 18:27:16 +02:00
Francisco Casas
2327f87e37 tests/hlsl: Test SM1 vertex shader uniform allocation on indirect addressing.
Here, a vertex shader version of the previous test by Shaun is
introduced. Note that in this case the uniform allocates all 4 registers
instead of 3 because it is indirectly addressed.
2025-04-02 18:06:48 +02:00
Francisco Casas
b6ce1479fe tests/hlsl: Test vertex shader uniform indirect addressing.
Note that, for indexes with a decimal part, the behavior is different
depending on whether it is a temp load or a direct uniform load (which
can only happen on vertex shaders). The former rounds to the
closest-to-zero, while the latter rounds to the nearest even.
2025-04-02 18:06:18 +02:00
Shaun Ren
8af3173955 vkd3d-shader/hlsl: Support input primitive arrays in geometry shaders. 2025-03-18 15:40:11 +01:00
Francisco Casas
ea99d2c2cd vkd3d-shader/hlsl: Lower integer modulus for d3dbc target profiles. 2025-03-18 15:27:04 +01:00
Francisco Casas
828afe188c vkd3d-shader/hlsl: Don't lower integer MOD and DIV on const passes for d3dbc target profiles.
These bitwise operations are not available in these profiles.
2025-03-18 15:27:03 +01:00
Francisco Casas
e3923876c0 tests/hlsl: Test integer division with big integers.
Similarly to the modulus operator, d3dbc results with constant folding
are different from results when constant folding cannot be applied, and
different from tpf results.
2025-03-18 15:25:41 +01:00
Francisco Casas
080672478d tests/hlsl: Test integer modulus with big integers.
Note that in d3dbc target profiles it gives different results when this
operation is constant folded compared to when it is not.

This suggests that whatever pass lowers the modulus operation to d3dbc
operations doesn't do it before constant folding.

Also note that when constant folded, d3dbc results differ from tpf
results for negative operands, because of the loss of precision that
happens when NEG is constant folded.

So the same integer modulus expression can have 3 different results
depending on the context.
2025-03-18 15:21:43 +01:00
Francisco Casas
a3f80061b1 tests/hlsl: Test for loss of precision on integer negation in d3dbc target profiles. 2025-03-18 14:25:26 +01:00
Henri Verbeet
808931b108 vkd3d-shader/glsl: Implement VKD3DSIH_XOR. 2025-03-17 15:07:51 +01:00
Francisco Casas
09b9f8ff9f vkd3d-shader/hlsl: Fix invalidation of the wrong components in copy-propagation.
Fixes: 1bba18aa75.
2025-03-12 22:14:25 +01:00
Francisco Casas
bff9068a7f tests: Add a hard test for copy-propagation invalidation.
This test is currently miscompiling on SM4 because
copy_propagation_invalidate_variable_from_deref_recurse() is not always
invalidating the right components.
2025-03-12 22:14:15 +01:00
Elizabeth Figura
a87b1efbd2 vkd3d-shader/hlsl: Don't invalidate OOB constant derefs. 2025-03-12 22:09:57 +01:00
Henri Verbeet
b9ebf87114 vkd3d-shader/hlsl: Do not collect expressions across different operations in hlsl_normalize_binary_exprs(). 2025-03-12 21:34:17 +01:00
Henri Verbeet
b4296e1a2d tests/hlsl: Add another constant folding test. 2025-03-12 21:34:02 +01:00
Shaun Ren
dd1072a99b tests/hlsl: Add geometry shader syntax tests. 2025-03-12 21:21:35 +01:00
Francisco Casas
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
Shaun Ren
1b03676a36 tests/hlsl: Add dynamic addressing copy-propagation tests. 2025-03-12 18:22:01 +01:00
Elizabeth Figura
18ca7affad vkd3d-shader/hlsl: Make min16uint into a first-class type.
And properly implement translation into some binary enumerations.
2025-03-06 17:15:15 +01:00
Anna (navi) Figueiredo Gomes
50254c284b vkd3d-shader: Parse angle bracket initializer in state blocks.
While fxc allows full expressions inside the angle brackets, we don't parse that
yet as it'd be quite a mess to properly do so with yacc, and I'm not aware of any
game doing so in their shaders.
2025-03-03 18:00:23 +01:00
Anna (navi) Figueiredo Gomes
9809bda0e5 tests/hlsl: Add angle bracket state block syntax test. 2025-03-03 18:00:23 +01:00
Francisco Casas
7cb1970952 vkd3d-shader/hlsl: Don't cast all expressions to float.
Instead, allow half, bool, int, and uint, expressions that map to the
same float op to reach sm1_generate_vsir_instr_expr().
2025-03-03 17:26:15 +01:00
Anna (navi) Figueiredo Gomes
0ce2b1359f tests/hlsl: Add lower sm1 saturate test. 2025-03-03 17:25:20 +01:00