From: Henri Verbeet hverbeet@codeweavers.com
--- libs/vkd3d-shader/dxil.c | 2 +- libs/vkd3d-shader/ir.c | 16 +++++++++------- libs/vkd3d-shader/spirv.c | 2 +- libs/vkd3d-shader/vkd3d_shader_private.h | 3 +-- 4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 15cc380f5..ca3895779 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -5489,7 +5489,7 @@ static enum vkd3d_result sm6_function_emit_blocks(const struct sm6_function *fun { unsigned int i;
- sm6->p.shader_desc.block_count = function->block_count; + sm6->p.program.block_count = function->block_count;
for (i = 0; i < function->block_count; ++i) { diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index a797e4930..2a53be8d5 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2224,6 +2224,7 @@ static enum vkd3d_result cf_flattener_iterate_instruction_array(struct cf_flatte
static enum vkd3d_result flatten_control_flow_constructs(struct vkd3d_shader_parser *parser) { + struct vsir_program *program = &parser->program; struct cf_flattener flattener = {0}; enum vkd3d_result result;
@@ -2233,10 +2234,10 @@ static enum vkd3d_result flatten_control_flow_constructs(struct vkd3d_shader_par if (result >= 0) { vkd3d_free(parser->program.instructions.elements); - parser->program.instructions.elements = flattener.instructions; - parser->program.instructions.capacity = flattener.instruction_capacity; - parser->program.instructions.count = flattener.instruction_count; - parser->shader_desc.block_count = flattener.block_id; + program->instructions.elements = flattener.instructions; + program->instructions.capacity = flattener.instruction_capacity; + program->instructions.count = flattener.instruction_count; + program->block_count = flattener.block_id; } else { @@ -2524,9 +2525,10 @@ static void vsir_validate_register(struct validation_context *ctx, /* Index == 0 is invalid, but it is temporarily allowed * for intermediate stages. Once we support validation * dialects we can selectively check for that. */ - if (reg->idx[0].offset > ctx->parser->shader_desc.block_count) - validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "LABEL register index %u exceeds the maximum count %u.", - reg->idx[0].offset, ctx->parser->shader_desc.block_count); + if (reg->idx[0].offset > ctx->program->block_count) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, + "LABEL register index %u exceeds the maximum count %u.", + reg->idx[0].offset, ctx->program->block_count); break;
case VKD3DSPR_NULL: diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 7efe882f4..7da068226 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -9747,7 +9747,7 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, compiler->location.column = 0; compiler->location.line = 1;
- if (parser->shader_desc.block_count && !spirv_compiler_init_blocks(compiler, parser->shader_desc.block_count)) + if (program->block_count && !spirv_compiler_init_blocks(compiler, program->block_count)) return VKD3D_ERROR_OUT_OF_MEMORY;
instructions = program->instructions; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 332b39af7..5bf40359b 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1020,8 +1020,6 @@ struct vkd3d_shader_desc struct shader_signature output_signature; struct shader_signature patch_constant_signature;
- unsigned int block_count; - struct { uint32_t used, external; @@ -1270,6 +1268,7 @@ struct vsir_program struct vkd3d_shader_instruction_array instructions;
unsigned int input_control_point_count, output_control_point_count; + unsigned int block_count; unsigned int temp_count; unsigned int ssa_count; bool use_vocp;