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@tu-dortmund.de>
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Philip Rebohle 2019-02-23 15:25:51 +01:00 committed by Alexandre Julliard
parent d1e0ac115c
commit c560fdfa26

View File

@ -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;
}