mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Store the block count in struct vsir_program.
This commit is contained in:
parent
98c6e85b33
commit
f3c7d2d05c
Notes:
Alexandre Julliard
2024-01-23 23:05:46 +01:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/594
@ -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)
|
||||
{
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user