Philip Rebohle : vkd3d-shader: Decorate integer fragment shader builtins as flat.

Alexandre Julliard julliard at winehq.org
Mon Feb 25 14:26:12 CST 2019


Module: vkd3d
Branch: master
Commit: c560fdfa269c41fd5c9c20ef2afa8a5d6c4595ef
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=c560fdfa269c41fd5c9c20ef2afa8a5d6c4595ef

Author: Philip Rebohle <philip.rebohle at 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 at tu-dortmund.de>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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;
 }
 




More information about the wine-cvs mailing list