diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index a2a090e1..f63d87ae 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -2197,6 +2197,20 @@ static void shader_glsl_generate_output_declarations(struct vkd3d_glsl_generator } } +static void shader_glsl_handle_global_flags(struct vkd3d_string_buffer *buffer, + struct vkd3d_glsl_generator *gen, enum vsir_global_flags flags) +{ + if (flags & VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL) + { + vkd3d_string_buffer_printf(buffer, "layout(early_fragment_tests) in;\n"); + flags &= ~VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL; + } + + if (flags) + vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL, + "Internal compiler error: Unhandled global flags %#"PRIx64".", (uint64_t)flags); +} + static void shader_glsl_generate_declarations(struct vkd3d_glsl_generator *gen) { const struct vsir_program *program = gen->program; @@ -2210,9 +2224,7 @@ static void shader_glsl_generate_declarations(struct vkd3d_glsl_generator *gen) group_size->x, group_size->y, group_size->z); } - if (program->global_flags) - vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL, - "Internal compiler error: Unhandled global flags %#"PRIx64".", (uint64_t)program->global_flags); + shader_glsl_handle_global_flags(buffer, gen, program->global_flags); shader_glsl_generate_descriptor_declarations(gen); shader_glsl_generate_input_declarations(gen); diff --git a/tests/hlsl/depth-bounds.shader_test b/tests/hlsl/depth-bounds.shader_test index 9ab1c332..fcaac126 100644 --- a/tests/hlsl/depth-bounds.shader_test +++ b/tests/hlsl/depth-bounds.shader_test @@ -36,30 +36,30 @@ depth greater equal clear rtv 0 0.0 0.0 0.0 0.0 clear dsv 0.0 -todo(glsl) draw quad +draw quad probe (0, 0) rgba(0, 0, 0, 0) probe uav 1 (0) r(0.0) clear rtv 0 0.0 0.0 0.0 0.0 clear dsv 0.3 -todo(glsl) draw quad +draw quad probe (0, 0) rgba(1, 1, 1, 1) probe uav 1 (0) r(1.0) clear rtv 0 0.0 0.0 0.0 0.0 clear dsv 0.5 -todo(glsl) draw quad +draw quad probe (0, 0) rgba(1, 1, 1, 1) probe uav 1 (0) r(1.0) clear rtv 0 0.0 0.0 0.0 0.0 clear dsv 0.6 -todo(glsl) draw quad +draw quad probe (0, 0) rgba(1, 1, 1, 1) probe uav 1 (0) r(1.0) clear rtv 0 0.0 0.0 0.0 0.0 clear dsv 1.0 -todo(glsl) draw quad +draw quad probe (0, 0) rgba(0, 0, 0, 0) probe uav 1 (0) r(0.0) diff --git a/tests/hlsl/early-depth-stencil.shader_test b/tests/hlsl/early-depth-stencil.shader_test index 810bd4a7..40806416 100644 --- a/tests/hlsl/early-depth-stencil.shader_test +++ b/tests/hlsl/early-depth-stencil.shader_test @@ -26,6 +26,6 @@ depth greater equal clear rtv 0 0.0 0.0 0.0 0.0 clear dsv 0.5 -todo(glsl) draw quad +draw quad probe (0, 0) rgba(0, 0, 0, 0) probe uav 1 (0) r(0.0)