From 8f6616993bd78c6676af2b467d8795dfaa5d8281 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Mon, 12 May 2025 14:16:53 -0500 Subject: [PATCH] vkd3d-shader/spirv: Do not declare inputs with an empty used_mask. This is motivated by SampleId, whose presence or absence determines whether a fragment shader runs at sample frequency or not. In HLSL, if SV_SampleIndex is declared but not used, this results in a signature entry, but no dcl instruction (and a zero used mask in the signature entry). Whether the shader will actually run at sample frequency is inconsistent. NVidia does, AMD does not, and WARP does for d3d12 but not for d3d11. Previously vkd3d-shader relied on the dcl instruction, thereby aligning with AMD. This was changed by 66cb2815f0662713c3255113255cfd7cf5e406fb. This commit restores the previous behaviour. --- libs/vkd3d-shader/spirv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 931c435ea..f1f6e8510 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -5804,6 +5804,9 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler, if (compiler->shader_type == VKD3D_SHADER_TYPE_DOMAIN && reg_type != VKD3DSPR_PATCHCONST) sysval = VKD3D_SHADER_SV_NONE; + if (!signature_element->used_mask) + return; + builtin = get_spirv_builtin_for_sysval(compiler, sysval); array_sizes[0] = signature_element->register_count;