Module: vkd3d Branch: master Commit: bb680e73de4ac22700ec89b1f466eea8da0a2120 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/bb680e73de4ac22700ec89b1f466ee...
Author: Jan Sikorski jsikorski@codeweavers.com Date: Thu May 25 10:12:35 2023 +0200
vkd3d-shader/spirv: Ensure that the OpLabel emitted vkd3d_spirv_builder_begin_main_function() gets terminated.
---
libs/vkd3d-shader/spirv.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 29423028..cc0b63e8 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2244,6 +2244,7 @@ struct spirv_compiler struct vkd3d_push_constant_buffer_binding *push_constants; const struct vkd3d_shader_spirv_target_info *spirv_target_info;
+ bool main_block_open; bool after_declarations_section; struct shader_signature input_signature; struct shader_signature output_signature; @@ -5211,6 +5212,7 @@ static void spirv_compiler_emit_initial_declarations(struct spirv_compiler *comp if (compiler->shader_type != VKD3D_SHADER_TYPE_HULL) { vkd3d_spirv_builder_begin_main_function(builder); + compiler->main_block_open = true; } }
@@ -7509,6 +7511,8 @@ static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *c
if (cf_info) cf_info->inside_block = false; + else + compiler->main_block_open = false; break;
case VKD3DSIH_RETP: @@ -9469,6 +9473,9 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, if (result < 0) return result;
+ if (compiler->main_block_open) + vkd3d_spirv_build_op_return(builder); + if (!is_in_default_phase(compiler)) spirv_compiler_leave_shader_phase(compiler); else