From fd3d661bf0337fd7534005395323c9c44b127d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 7 Feb 2019 09:59:19 +0100 Subject: [PATCH] vkd3d-shader: Unset r# registers state while leaving current shader phase. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d-shader/spirv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 3a80925a..8f9fff7f 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3980,6 +3980,7 @@ static void vkd3d_dxbc_compiler_emit_dcl_temps(struct vkd3d_dxbc_compiler *compi function_location = vkd3d_dxbc_compiler_get_current_function_location(compiler); vkd3d_spirv_begin_function_stream_insertion(builder, function_location); + assert(!compiler->temp_count); compiler->temp_count = instruction->declaration.count; for (i = 0; i < compiler->temp_count; ++i) { @@ -4810,15 +4811,24 @@ static void vkd3d_dxbc_compiler_emit_dcl_thread_group(struct vkd3d_dxbc_compiler SpvExecutionModeLocalSize, local_size, ARRAY_SIZE(local_size)); } +static void vkd3d_dxbc_compiler_leave_shader_phase(struct vkd3d_dxbc_compiler *compiler) +{ + struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; + + vkd3d_spirv_build_op_function_end(builder); + + compiler->temp_id = 0; + compiler->temp_count = 0; +} + static void vkd3d_dxbc_compiler_enter_shader_phase(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; struct vkd3d_shader_phase *phase; unsigned int idx; if ((idx = compiler->shader_phase_count)) - vkd3d_spirv_build_op_function_end(builder); + vkd3d_dxbc_compiler_leave_shader_phase(compiler); if (!vkd3d_array_reserve((void **)&compiler->shader_phases, &compiler->shader_phases_size, compiler->shader_phase_count + 1, sizeof(*compiler->shader_phases)))