2261 Commits

Author SHA1 Message Date
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
Giovanni Mascellani
e418bbcfac tests: Mark a test about resource aliasing as todo on MoltenVK.
As far as I know there is no way to implement this properly on
Vulkan, and all the other Vulkan implementations essentially work
by luck. In Vulkan the initial layout of a resource must always be
UNDEFINED or PREINITIALIZED and it must be transitioned away from
before any meaningful use of that image is done. Therefore it's
possible to alias two images and let the second one inherit the
content in the first one only if both already exist (and are in
the same layout) before the first writing is done. If, as in this
example, the second image is created after the first one has
already been written to, the obligatory transition away from
UNDEFINED or PREINITIALIZED will potentially wipe out the content.

Therefore I am marking this as todo, not as a bug. I might also be
that there is a bug in MoltenVK, and ultimately that's the reason
why we're reading invalid data, but technically the Vulkan
commands we generate are incorrect anyway.
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
44072062ff tests: Transition texture state to inherit aliased data.
When textures[1] is read for the second time it is aliased to
textures[0]. But textures[0] was left in COPY_DEST state (since
its creation), and textures[1] is currently recreated in COPY_SOURCE
state, which AFAIU is invalid. So recreate textures[1] in COPY_DEST
state and then transition it before reading it.
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
c3f01d7db9 tests: Mark two other tessellation tests as buggy on MoltenVK.
I haven't investigated the actual problem here, but the generated
Vulkan commands look correct (and work with basically all other
Vulkan implementations) and MoltenVK is known to have incomplete
tessellation support, so it's likely that the problem is there.
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
8cf61c859d tests: Mark a few other timestamp query tests as buggy on MoltenVK.
Similarly to 5d4edba925, it seems
that sometimes MoltenVK returns 0 to timestamp queries. It
doesn't happen deterministically and it might depend on the
hardware (I have seen differences between the M2 I used some
time ago and the M3 Max I have now).
2025-03-17 15:14:23 +01:00
Henri Verbeet
808931b108 vkd3d-shader/glsl: Implement VKD3DSIH_XOR. 2025-03-17 15:07:51 +01:00
Giovanni Mascellani
fc4316f664 tests/shader_runner: Avoid creating devices for backends that won't execute.
My main motivation to this is avoiding generating a lot of useless
log lines from other executors when I'm interested in just one of
them, but I can imagine this also somewhat improving efficiency.
2025-03-17 14:01:22 +01:00
Giovanni Mascellani
0b273ea88c tests: Store the compiler string in the shader runner capabilities.
Just like the executor.
2025-03-17 13:50:19 +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
Giovanni Mascellani
d34f5fbae2 tests/shader_runner: Allow selecting the compiler. 2025-03-10 15:12:45 +01:00
Giovanni Mascellani
5a898254b0 tests/shader_runner: Allow selecting the executor. 2025-03-10 15:12:33 +01:00
Petrichor Park
f05386e006 tests/shader_runner: Allow controlling which shader models to run via command line.
Adds new flags --sm-min and --sm-max. They each take a shader model
identifier, with the same syntax as in the test harness. If either is
present, then it will only run tests within the (inclusive) range.
Omitting one allows anything as the min/max.
2025-03-10 15:12:25 +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