vkd3d-shader/glsl: Implement VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL.

This commit is contained in:
Henri Verbeet 2024-10-18 22:52:13 +02:00
parent 9d82915629
commit 6a119b6946
Notes: Henri Verbeet 2024-10-24 21:02:25 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1211
3 changed files with 21 additions and 9 deletions

View File

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

View File

@ -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)

View File

@ -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)