Commit Graph

7965 Commits

Author SHA1 Message Date
Giovanni Mascellani
752b13b111 tests/hlsl: Test sampling with minimum precision floating-point numbers. 2025-06-02 20:17:48 +02:00
Elizabeth Figura
847c008b49 vkd3d-shader/ir: Split TEX into two separate vsir opcodes.
The two have the same d3dbc opcode, but have different names and different semantics.
2025-06-02 20:13:52 +02:00
Elizabeth Figura
b25362e036 vkd3d-shader/ir: Split TEXCOORD into two separate vsir opcodes.
The two have the same d3dbc opcode, but have different names and different semantics.
2025-06-02 20:12:27 +02:00
Henri Verbeet
618d8e6a4a vkd3d-shader/msl: Make the generated main function static.
We only need to export the entry point.
2025-06-02 20:11:08 +02:00
Henri Verbeet
7929ba9747 vkd3d-shader: Move vkd3d_siv_from_sysval_indexed() to hlsl_codegen.c. 2025-06-02 20:10:46 +02:00
Henri Verbeet
9983d9c4de tests/hlsl: Slightly adjust the bias values in the sample-bias tests.
The expected λ value for the tests in question is about 0.59, which
after linear mipmap interpolation should result in a sampled value of
about 0.41. The quantisation step was added to allow results as high as
0.43, as seen on some implementations.

AMD Radeon Pro Vega 20 on macOS 15.5 returns a sampled value of about
0.39, with both Vulkan/MoltenVK and MSL/Metal. This is not an issue with
the bias calculation; the same behaviour could be reproduced with
SampleLevel(), as used in the sample-level tests, if those tests used
more exciting values for the "level" parameter. It also doesn't appear
to be a general Metal issue; Intel UHD Graphics 630 does return the
expected values on the same setup. Instead, this appears to be a mipmap
interpolation issue on this particular GPU/driver. Mapping the sampled
values for "level" from 0.0 to 1.0, it seems the interpolation factor
used is "saturate(frac(λ) * 1.25 - 0.125)", instead of the normal
"frac(λ)".

Fascinating as that may be, the test here mainly cares about whether the
bias value was applied correctly, and in that regard a sampled value of
0.39 isn't any worse than the 0.43 we already accept. This commit
adjusts the bias value so that the expected sampled value is 0.45, which
makes the accepted error the same on both the positive and negative
side.
2025-06-02 20:08:04 +02:00
Shaun Ren
d5dcf31123 vkd3d-shader/hlsl: Store stream index in struct hlsl_semantic.
In addition, support stream indices in tpf_write_signature().
2025-06-02 19:59:22 +02:00
Shaun Ren
d368d18527 vkd3d-shader/hlsl: Generate vsir instructions for indexed output streams in geometry shaders. 2025-06-02 19:53:25 +02:00
Shaun Ren
7da7ccaf45 vkd3d-shader/hlsl: Emit dcl_stream instructions for SM5 geometry shaders. 2025-06-02 19:53:25 +02:00
Giovanni Mascellani
a743d9ae60 vkd3d-shader/dxil: Remove bitcast helpers.
They are useless, since the source is already a union with the
needed types.
2025-06-02 19:52:25 +02:00
Giovanni Mascellani
0a1e7b5f64 vkd3d-shader/dxil: Generate CONSTANT values in sm6_parser_constants_init() for null scalars. 2025-06-02 19:52:25 +02:00
Giovanni Mascellani
79ec2fe9f2 vkd3d-shader/dxil: Generate specialized values in sm6_parser_constants_init() for casts.
Depending on the casted operand, the generated values can be
ICB, IDXTEMP or GROUPSHAREDMEM.

The cast decoding code is entirely moved to the second pass, so
that we avoid abusing registers to temporarily store other data.
2025-06-02 19:51:22 +02:00
Giovanni Mascellani
93fb51c899 vkd3d-shader/dxil: Generate CONSTANT values in sm6_parser_constants_init() for floating-point values. 2025-06-02 19:46:23 +02:00
Giovanni Mascellani
d36e37555a vkd3d-shader/dxil: Generate CONSTANT values in sm6_parser_constants_init() for integer values. 2025-06-02 19:46:23 +02:00
Giovanni Mascellani
c050c8be75 vkd3d-shader/dxil: Do not touch the parser current value in instruction_dst_param_init_temp_vector().
The stored value is never read, the caller will overwrite it with
the SSA register generated by the whole DXIL instruction.

Since the helper is always used for UINT instructions, change and
rename it accordingly, so we don't have the problem of finding out
which data type to use.
2025-06-02 19:45:54 +02:00
Nikolay Sivov
87ec2d9897 vkd3d-shader/fx: Fix writing fx_2_0 structure parameters.
Currently structure type descriptions get interleaved with variable
length string data. The solution is to write all fixed length fields
first, then append strings.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-05-27 20:24:24 +02:00
Giovanni Mascellani
bb50117747 ci: Really use DXC 1.8.2502 for macOS.
In theory commit 7b07d77396 already
did that, but in practice it ended up picking a commit from the
1.8.2405 branch, where a few of our tests fail. Since I hope to
soon enable DXC for macOS again, it's useful to fix that oversight.
2025-05-27 19:44:27 +02:00
Giovanni Mascellani
365f6d3be9 tests/hlsl: Mark some tests in uav-atomics.shader_test as working on MoltenVK. 2025-05-27 19:32:45 +02:00
Giovanni Mascellani
85dcd03642 tests/hlsl: Mark some tests in wave-ops-int.shader_test as buggy on MoltenVK.
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-05-27 19:32:35 +02:00
Giovanni Mascellani
9ab1cadaa5 tests/hlsl: Mark some tests in wave-ops-uint.shader_test as buggy on MoltenVK.
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-05-27 19:32:19 +02:00
Giovanni Mascellani
6fe0d71ae1 tests/hlsl: Mark a test in gather-offset.shader_test as buggy on MoltenVK with d3d12.
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-05-27 19:31:38 +02:00
Giovanni Mascellani
70c51984c9 tests/hlsl: Mark some tests in clip-cull-distance.shader_test as buggy on MoltenVK with d3d12.
They either use geometry shaders or cull distances, which MoltenVK
doesn't support. However d3d12 has no way to indicate they're
unsupported, so the problem doesn't surface as a failed draw,
but rather as a draw that doesn't do anything.
2025-05-27 19:30:21 +02:00
Giovanni Mascellani
7261b40df7 tests/hlsl: Mark a test in object-references.shader_test as todo on MoltenVK with DXIL.
I haven't investigated what's happening in detail. However vkd3d
emits this message, which makes me think the problem is ours:

    vkd3d:62178588:fixme:spirv_compiler_get_descriptor_binding Could not find descriptor binding for type 0, space 0, registers [0:2], shader type 0.
2025-05-27 19:29:56 +02:00
Giovanni Mascellani
e6267dd6b4 tests/hlsl: Do not test for overflowing 16-bit texture sampling.
The behavior is not uniform across drivers; in my tests AMD
performs as expected by the test, but WARP and NVIDIA return
infinity.
2025-05-27 17:45:09 +02:00
Giovanni Mascellani
bd1b737e4e tests/hlsl: Test minimum precision stride for floating point numbers too. 2025-05-27 17:45:07 +02:00