mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Store the SSA register count in struct vsir_program.
This commit is contained in:
parent
7b85cd6a31
commit
94ca46916a
Notes:
Alexandre Julliard
2024-01-22 22:53:09 +01:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/585
@ -7170,7 +7170,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
|
|||||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm6->p.shader_desc.ssa_count = sm6->ssa_next_id;
|
sm6->p.program.ssa_count = sm6->ssa_next_id;
|
||||||
|
|
||||||
if (!(fn = sm6_parser_get_function(sm6, sm6->entry_point)))
|
if (!(fn = sm6_parser_get_function(sm6, sm6->entry_point)))
|
||||||
{
|
{
|
||||||
|
@ -2465,10 +2465,11 @@ static void vsir_validate_register(struct validation_context *ctx,
|
|||||||
if (reg->idx[0].rel_addr)
|
if (reg->idx[0].rel_addr)
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "Non-NULL relative address for a SSA register.");
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "Non-NULL relative address for a SSA register.");
|
||||||
|
|
||||||
if (reg->idx[0].offset >= ctx->parser->shader_desc.ssa_count)
|
if (reg->idx[0].offset >= ctx->program->ssa_count)
|
||||||
{
|
{
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "SSA register index %u exceeds the maximum count %u.",
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
|
||||||
reg->idx[0].offset, ctx->parser->shader_desc.ssa_count);
|
"SSA register index %u exceeds the maximum count %u.",
|
||||||
|
reg->idx[0].offset, ctx->program->ssa_count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2600,7 +2601,7 @@ static void vsir_validate_dst_param(struct validation_context *ctx,
|
|||||||
dst->shift);
|
dst->shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst->reg.type == VKD3DSPR_SSA && dst->reg.idx[0].offset < ctx->parser->shader_desc.ssa_count)
|
if (dst->reg.type == VKD3DSPR_SSA && dst->reg.idx[0].offset < ctx->program->ssa_count)
|
||||||
{
|
{
|
||||||
struct validation_context_ssa_data *data = &ctx->ssas[dst->reg.idx[0].offset];
|
struct validation_context_ssa_data *data = &ctx->ssas[dst->reg.idx[0].offset];
|
||||||
|
|
||||||
@ -2635,7 +2636,7 @@ static void vsir_validate_src_param(struct validation_context *ctx,
|
|||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS, "Source has invalid modifiers %#x.",
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS, "Source has invalid modifiers %#x.",
|
||||||
src->modifiers);
|
src->modifiers);
|
||||||
|
|
||||||
if (src->reg.type == VKD3DSPR_SSA && src->reg.idx[0].offset < ctx->parser->shader_desc.ssa_count)
|
if (src->reg.type == VKD3DSPR_SSA && src->reg.idx[0].offset < ctx->program->ssa_count)
|
||||||
{
|
{
|
||||||
struct validation_context_ssa_data *data = &ctx->ssas[src->reg.idx[0].offset];
|
struct validation_context_ssa_data *data = &ctx->ssas[src->reg.idx[0].offset];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -3007,7 +3008,7 @@ enum vkd3d_result vsir_validate(struct vkd3d_shader_parser *parser)
|
|||||||
if (!(ctx.temps = vkd3d_calloc(parser->shader_desc.temp_count, sizeof(*ctx.temps))))
|
if (!(ctx.temps = vkd3d_calloc(parser->shader_desc.temp_count, sizeof(*ctx.temps))))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(ctx.ssas = vkd3d_calloc(parser->shader_desc.ssa_count, sizeof(*ctx.ssas))))
|
if (!(ctx.ssas = vkd3d_calloc(ctx.program->ssa_count, sizeof(*ctx.ssas))))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
for (ctx.instruction_idx = 0; ctx.instruction_idx < parser->program.instructions.count; ++ctx.instruction_idx)
|
for (ctx.instruction_idx = 0; ctx.instruction_idx < parser->program.instructions.count; ++ctx.instruction_idx)
|
||||||
@ -3018,7 +3019,7 @@ enum vkd3d_result vsir_validate(struct vkd3d_shader_parser *parser)
|
|||||||
if (ctx.depth != 0)
|
if (ctx.depth != 0)
|
||||||
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW, "%zu nested blocks were not closed.", ctx.depth);
|
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW, "%zu nested blocks were not closed.", ctx.depth);
|
||||||
|
|
||||||
for (i = 0; i < parser->shader_desc.ssa_count; ++i)
|
for (i = 0; i < ctx.program->ssa_count; ++i)
|
||||||
{
|
{
|
||||||
struct validation_context_ssa_data *data = &ctx.ssas[i];
|
struct validation_context_ssa_data *data = &ctx.ssas[i];
|
||||||
|
|
||||||
|
@ -9689,8 +9689,8 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
|||||||
|
|
||||||
if (parser->shader_desc.temp_count)
|
if (parser->shader_desc.temp_count)
|
||||||
spirv_compiler_emit_temps(compiler, parser->shader_desc.temp_count);
|
spirv_compiler_emit_temps(compiler, parser->shader_desc.temp_count);
|
||||||
if (parser->shader_desc.ssa_count)
|
if (program->ssa_count)
|
||||||
spirv_compiler_allocate_ssa_register_ids(compiler, parser->shader_desc.ssa_count);
|
spirv_compiler_allocate_ssa_register_ids(compiler, program->ssa_count);
|
||||||
|
|
||||||
spirv_compiler_emit_descriptor_declarations(compiler);
|
spirv_compiler_emit_descriptor_declarations(compiler);
|
||||||
|
|
||||||
|
@ -1023,7 +1023,6 @@ struct vkd3d_shader_desc
|
|||||||
unsigned int input_control_point_count, output_control_point_count;
|
unsigned int input_control_point_count, output_control_point_count;
|
||||||
|
|
||||||
uint32_t temp_count;
|
uint32_t temp_count;
|
||||||
unsigned int ssa_count;
|
|
||||||
unsigned int block_count;
|
unsigned int block_count;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -1273,6 +1272,7 @@ struct vsir_program
|
|||||||
struct vkd3d_shader_version shader_version;
|
struct vkd3d_shader_version shader_version;
|
||||||
struct vkd3d_shader_instruction_array instructions;
|
struct vkd3d_shader_instruction_array instructions;
|
||||||
|
|
||||||
|
unsigned int ssa_count;
|
||||||
bool use_vocp;
|
bool use_vocp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user