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.
This commit is contained in:
Henri Verbeet
2025-08-10 19:58:02 +02:00
parent 880cb1083f
commit 8334386d99
Notes: Henri Verbeet 2025-08-13 16:27:34 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1677
2 changed files with 73 additions and 41 deletions

View File

@@ -1023,6 +1023,20 @@ static inline bool vsir_register_is_descriptor(const struct vkd3d_shader_registe
}
}
static inline enum vkd3d_shader_register_type vsir_register_type_from_sysval_input(
enum vkd3d_shader_sysval_semantic sysval)
{
switch (sysval)
{
case VKD3D_SHADER_SV_PRIMITIVE_ID:
return VKD3DSPR_PRIMID;
case VKD3D_SHADER_SV_COVERAGE:
return VKD3DSPR_COVERAGE;
default:
return VKD3DSPR_INPUT;
}
}
struct vkd3d_shader_dst_param
{
struct vkd3d_shader_register reg;