[PATCH 0/1] MR529: vkd3d-shader/spirv: Decorate non-float32 non-built-in pixel shader inputs as Flat.
From: Conor McCarthy <cmccarthy(a)codeweavers.com> As per VUID-StandaloneSpirv-Flat-04744. Not strictly a regression, but revealed by 66cb2815f because it declares unused inputs. --- libs/vkd3d-shader/spirv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 45f46a91c..237dca056 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4287,14 +4287,18 @@ static void spirv_compiler_decorate_builtin(struct spirv_compiler *compiler, } static void spirv_compiler_emit_interpolation_decorations(struct spirv_compiler *compiler, - uint32_t id, enum vkd3d_shader_interpolation_mode mode) + enum vkd3d_shader_component_type component_type, uint32_t id, enum vkd3d_shader_interpolation_mode mode) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; switch (mode) { case VKD3DSIM_NONE: - break; + /* VUID-StandaloneSpirv-Flat-04744: integer or double types must be + * decorated 'Flat' for fragment shaders. */ + if (compiler->shader_type != VKD3D_SHADER_TYPE_PIXEL || component_type == VKD3D_SHADER_COMPONENT_FLOAT) + break; + /* fall through */ case VKD3DSIM_CONSTANT: vkd3d_spirv_build_op_decorate(builder, id, SpvDecorationFlat, NULL, 0); break; @@ -4874,7 +4878,8 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler, if (component_idx) vkd3d_spirv_build_op_decorate1(builder, input_id, SpvDecorationComponent, component_idx); - spirv_compiler_emit_interpolation_decorations(compiler, input_id, signature_element->interpolation_mode); + spirv_compiler_emit_interpolation_decorations(compiler, component_type, input_id, + signature_element->interpolation_mode); } var_id = input_id; -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/529
Thanks for looking into this. It wouldn't be bad to have a test that checks that constant interpolation mode is always presumed for integral PS inputs, though. I don't seem that the HLSL compiler allows it, but we could still receive a TPF PS shader with a non-constant-interpolation integral input, and I wonder whether a native driver would try to interpolate it anyway. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/529#note_56303
This merge request was approved by Giovanni Mascellani. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/529
This merge request was approved by Henri Verbeet. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/529
participants (4)
-
Conor McCarthy -
Conor McCarthy (@cmccarthy) -
Giovanni Mascellani (@giomasce) -
Henri Verbeet (@hverbeet)