Commit Graph

974 Commits

Author SHA1 Message Date
Henri Verbeet
f732fb7889 Release 1.17. 2025-08-21 12:52:13 +02:00
Henri Verbeet
8334386d99 vkd3d-shader/spirv: Avoid emitting duplicate built-in inputs in spirv_compiler_emit_input().
This works around an issue introduced by commit
66cb2815f0. SV_PRIMITIVE_ID inputs in
geometry shaders use VKD3DSPR_PRIMID registers, and we create the
corresponding SPIR-V inputs using spirv_compiler_emit_io_register().
Unfortunately we also have an input signature element for the same
input, and simply creating another PrimitiveId input would run into
VUID-StandaloneSpirv-OpEntryPoint-09658.

Before the commit mentioned above, we'd use DCL_INPUT instructions to
emit input declarations, and these would help to distinguish whether
VKD3DSPR_INPUT or VKD3DSPR_PRIMID registers were used for primitive ID
inputs. Note that we can't simply ignore input signature element with
SIGNATURE_TARGET_LOCATION_UNUSED; the DXIL parser emits SV_SAMPLE_INDEX
inputs with that target location, but does require them to use a
VKD3DSPR_INPUT register.
2025-08-13 15:54:12 +02:00
Giovanni Mascellani
52b9ef0426 vkd3d-shader/spirv: Support precise flags on SAMPLE_INFO instructions. 2025-07-29 12:31:36 +02:00
Giovanni Mascellani
53754f0583 vkd3d-shader/spirv: Support precise flags on RESINFO instructions. 2025-07-29 12:31:23 +02:00
Henri Verbeet
9b0087a111 vkd3d-shader/spirv: Emit OpLine instructions. 2025-07-28 16:11:29 +02:00
Henri Verbeet
f02405350e vkd3d-shader/ir: Consistently use VSIR_DATA_U32 for resinfo_uint destination operands.
Much like we do for sample_info_uint.
2025-07-23 17:23:40 +02:00
Henri Verbeet
b88be5b92b vkd3d-shader/ir: Consistently use VSIR_DATA_U32 for sample_info_uint destination operands.
The HLSL compiler already did this; the TPF and DXIL parsers did not.
Previously spirv_compiler_emit_sample_info() was unable to correctly
handle VSIR_DATA_U32 destinations; the new version is arguably simpler
as well.
2025-07-23 17:23:40 +02:00
Henri Verbeet
b8c73e4a2c vkd3d-shader/spirv: Use spirv_compiler_error() to report unhandled resinfo flags. 2025-07-23 17:23:40 +02:00
Henri Verbeet
ed2a06af35 vkd3d-shader/spirv: Use spirv_compiler_error() to report unhandled sample_info flags. 2025-07-23 17:23:40 +02:00
Henri Verbeet
795211141f vkd3d-shader/ir: Rename VKD3D_DATA_BOOL to VSIR_DATA_BOOL. 2025-07-23 17:19:28 +02:00
Giovanni Mascellani
bb51b976df vkd3d-shader/ir: Use size_t in the parameter allocator.
The idea is to, by default, use size_t for any quantity that is
a memory size or an array index.
2025-07-23 17:16:38 +02:00
Giovanni Mascellani
7d9a86790e vkd3d-shader/spirv: Use iterators in spirv_compiler_generate_spirv(). 2025-07-22 16:56:07 +02:00
Henri Verbeet
1487764e23 vkd3d-shader/ir: Rename VKD3D_DATA_UINT64 to VSIR_DATA_U64. 2025-07-22 14:57:26 +02:00
Henri Verbeet
742cce9a08 vkd3d-shader/ir: Rename VKD3D_DATA_UINT to VSIR_DATA_U32. 2025-07-22 14:57:26 +02:00
Henri Verbeet
163b87444f vkd3d-shader/ir: Rename VKD3D_DATA_UINT16 to VSIR_DATA_U16. 2025-07-22 14:57:26 +02:00
Henri Verbeet
a04e4e4010 vkd3d-shader/ir: Rename VKD3D_DATA_INT to VSIR_DATA_I32. 2025-07-22 14:57:26 +02:00
Elizabeth Figura
f0906e9c5c vkd3d-shader/spirv: Use left-shifted writemasks for private variables for inputs.
One of the effects of I/O normalization, when it was introduced, was to shift
the writemask of all semantics to become 0-based—e.g., to convert .yz to .xy.
It did this by modifying the shader code, but did *not* modify the signature
masks.

The SPIR-V compiler, at the time, used both the write mask on the dcl_input
instruction and the signature masks. It also, due to the requirements of the
SPIR-V format, performed the same normalization, left-shifting each mask to
become zero-based. Despite this normalization now being performed earlier in
the aforementioned VSIR pass, the handling in the SPIR-V backend was never
removed.

When 66cb2815f0 was written, I either incorrectly
assumed that the signature mask was equal to the dcl_input write mask (at least,
in any well-formed shader), or (less likely) I noticed that the discrepancy
might exist but believed that the left-shifting normalization performed by the
spirv compiler covered all cases.

In either case it turns out there is one case where the difference was not
handled by the spirv compiler either. That is the case of a varying which has
a fixup function and therefore needs a private variable, which is currently true
for the SV_VertexID, SV_InstanceID, and SV_IsFrontFace varyings.

Thus, if one of those varyings has a signature mask other than .x, we currently
copy the SPIR-V builtin value to the relevant component of the private variable,
but subsequent code will load from the .x variable due to the normalization done
by shader_src_param_io_normalise().

This fixes a regression introduced by 66cb2815f0.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57433
2025-07-22 14:51:09 +02:00
Henri Verbeet
db149cd8cf vkd3d-shader/ir: Rename VKD3D_DATA_DOUBLE to VSIR_DATA_F64. 2025-07-21 12:10:43 +02:00
Henri Verbeet
c5c1c03430 vkd3d-shader/ir: Rename VKD3D_DATA_FLOAT to VSIR_DATA_F32. 2025-07-21 12:10:43 +02:00
Henri Verbeet
d1dcbc26e5 vkd3d-shader/ir: Rename VKD3D_DATA_HALF to VSIR_DATA_F16. 2025-07-21 12:10:43 +02:00
Henri Verbeet
0126beb3b2 vkd3d-shader/ir: Rename enum vkd3d_data_type to vsir_data_type. 2025-07-21 12:10:43 +02:00
Elizabeth Figura
0c3250122c vkd3d-shader/spirv: Do not use OpCopyMemory for partial writemasks in spirv_compiler_emit_mov().
This fixes instructions like "mov r0.xy, r1.xyzw".
2025-06-26 17:44:34 +02:00
Giovanni Mascellani
596f02210d vkd3d-shader/ir: Lower UDIV to UDIV_SIMPLE and UREM. 2025-06-25 16:44:00 +02:00
Giovanni Mascellani
82ef9bf2e5 vkd3d-shader/ir: Introduce VSIR_OP_UREM.
It is meant to compute the unsigned integer remainder.
2025-06-25 16:43:34 +02:00
Giovanni Mascellani
78e0f8412d vkd3d-shader/ir: Introduce VSIR_OP_UDIV_SIMPLE.
It is meant to compute the unsigned integer division, without
computing the modulo at the same time.
2025-06-25 16:40:43 +02:00