Module: vkd3d
Branch: master
Commit: c560fdfa269c41fd5c9c20ef2afa8a5d6c4595ef
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=c560fdfa269c41fd5c9c20e…
Author: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Date: Sat Feb 23 15:25:51 2019 +0100
vkd3d-shader: Decorate integer fragment shader builtins as flat.
>From the Vulkan spec, 8.13 "Interpolation Decorations":
Fragment shader inputs that are signed or unsigned integers,
integer vectors, or any double-precision floating-point type
must be decorated with Flat.
This also matches glslang behaviour.
Specifically, this fixes tone-mapping in Unreal Engine 4 on RADV
and AMDGPU-PRO, where gl_Layer is used as a fragment shader input.
Signed-off-by: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
libs/vkd3d-shader/spirv.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 82598df..5ed4df2 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -3489,6 +3489,10 @@ static uint32_t vkd3d_dxbc_compiler_emit_builtin_variable(struct vkd3d_dxbc_comp
vkd3d_spirv_add_iface_variable(builder, id);
vkd3d_dxbc_compiler_decorate_builtin(compiler, id, builtin->spirv_builtin);
+ if (compiler->shader_type == VKD3D_SHADER_TYPE_PIXEL && storage_class == SpvStorageClassInput
+ && builtin->component_type != VKD3D_TYPE_FLOAT && builtin->component_type != VKD3D_TYPE_BOOL)
+ vkd3d_spirv_build_op_decorate(builder, id, SpvDecorationFlat, NULL, 0);
+
return id;
}