From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d-shader/spirv.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index cf4fbf6d7a3a..f2a1b1141e23 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2770,8 +2770,21 @@ static void vkd3d_dxbc_compiler_decorate_builtin(struct vkd3d_dxbc_compiler *com { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
- if (compiler->shader_type == VKD3D_SHADER_TYPE_PIXEL && builtin == SpvBuiltInPosition) - builtin = SpvBuiltInFragCoord; + switch (builtin) + { + case SpvBuiltInPosition: + if (compiler->shader_type == VKD3D_SHADER_TYPE_PIXEL) + builtin = SpvBuiltInFragCoord; + break; + case SpvBuiltInFragDepth: + vkd3d_spirv_enable_depth_replacing(builder); + break; + case SpvBuiltInLayer: + vkd3d_spirv_enable_capability(builder, SpvCapabilityGeometry); + break; + default: + break; + }
vkd3d_spirv_build_op_decorate1(builder, target_id, SpvDecorationBuiltIn, builtin); } @@ -3228,9 +3241,6 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp compiler->output_setup_function_id = vkd3d_spirv_alloc_id(builder); }
- if (builtin && builtin->spirv_builtin == SpvBuiltInFragDepth) - vkd3d_spirv_enable_depth_replacing(builder); - return id; }