Module: vkd3d Branch: master Commit: f3c7d2d05c963b6a4103f0c4ea085aaad182ea89 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/f3c7d2d05c963b6a4103f0c4ea085a...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Thu Jan 18 20:34:52 2024 +0100
vkd3d-shader/ir: Store the block count in struct vsir_program.
---
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 6b38f028..2a0ff61c 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -5527,7 +5527,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 719a153f..537cbe6f 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -2213,6 +2213,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;
@@ -2222,10 +2223,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 { @@ -2511,9 +2512,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 4441db16..668f0c4e 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -9790,7 +9790,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 332b39af..5bf40359 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;