From aba45d0386829f21a2e9e4df5fba9c43a7886c99 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 3 Oct 2024 16:14:36 +0200 Subject: [PATCH] vkd3d-shader/glsl: Implement VKD3DSIH_CONTINUE. --- libs/vkd3d-shader/glsl.c | 9 +++++++++ tests/hlsl/for.shader_test | 2 +- tests/hlsl/switch.shader_test | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index 00357db6..91ee355e 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -702,6 +702,12 @@ static void shader_glsl_break(struct vkd3d_glsl_generator *gen) vkd3d_string_buffer_printf(gen->buffer, "break;\n"); } +static void shader_glsl_continue(struct vkd3d_glsl_generator *gen) +{ + shader_glsl_print_indent(gen->buffer, gen->indent); + vkd3d_string_buffer_printf(gen->buffer, "continue;\n"); +} + static void shader_glsl_switch(struct vkd3d_glsl_generator *gen, const struct vkd3d_shader_instruction *ins) { struct glsl_src src; @@ -1186,6 +1192,9 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen, case VKD3DSIH_CASE: shader_glsl_case(gen, ins); break; + case VKD3DSIH_CONTINUE: + shader_glsl_continue(gen); + break; case VKD3DSIH_DCL_INDEXABLE_TEMP: shader_glsl_dcl_indexable_temp(gen, ins); break; diff --git a/tests/hlsl/for.shader_test b/tests/hlsl/for.shader_test index 94c911a4..14712f62 100644 --- a/tests/hlsl/for.shader_test +++ b/tests/hlsl/for.shader_test @@ -54,7 +54,7 @@ float4 main(float tex : texcoord) : sv_target [test] uniform 0 uint4 10 0 0 0 -todo(glsl) draw quad +draw quad probe ( 0, 0, 159, 480) rgba (10.0, 35.0, 0.0, 0.0) probe (161, 0, 479, 480) rgba (10.0, 38.0, 0.0, 0.0) probe (481, 0, 640, 480) rgba ( 5.0, 10.0, 0.0, 0.0) diff --git a/tests/hlsl/switch.shader_test b/tests/hlsl/switch.shader_test index 2a7ff7f0..dfdcdb99 100644 --- a/tests/hlsl/switch.shader_test +++ b/tests/hlsl/switch.shader_test @@ -574,11 +574,11 @@ float4 main() : sv_target [test] if(sm<4) uniform 0 float4 1 0 3 1 if(sm>=4) uniform 0 uint4 1 0 3 1 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (10.0, 11.0, 12.0, 13.0) if(sm<4) uniform 0 float4 0 0 3 1 if(sm>=4) uniform 0 uint4 0 0 3 1 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (7.0, 8.0, 9.0, 10.0) % return from a switch nested in a loop