From e9fbbf26bbef9dd101303c955f556fdfa9f32954 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 11 Sep 2024 13:46:49 +0200 Subject: [PATCH] vkd3d-shader/ir: Introduce a helper for validating REP. --- libs/vkd3d-shader/ir.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 075d23fd..f8529c12 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -6220,6 +6220,12 @@ static void vsir_validate_loop(struct validation_context *ctx, const struct vkd3 vsir_validator_push_block(ctx, VKD3DSIH_LOOP); } +static void vsir_validate_rep(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction) +{ + vsir_validate_cf_type(ctx, instruction, VSIR_CF_STRUCTURED); + vsir_validator_push_block(ctx, VKD3DSIH_REP); +} + struct vsir_validator_instruction_desc { unsigned int dst_param_count; @@ -6236,6 +6242,7 @@ static const struct vsir_validator_instruction_desc vsir_validator_instructions[ [VKD3DSIH_IF] = {0, 1, vsir_validate_if}, [VKD3DSIH_IFC] = {0, 2, vsir_validate_ifc}, [VKD3DSIH_LOOP] = {0, ~0u, vsir_validate_loop}, + [VKD3DSIH_REP] = {0, 1, vsir_validate_rep}, }; static void vsir_validate_instruction(struct validation_context *ctx) @@ -6398,15 +6405,6 @@ static void vsir_validate_instruction(struct validation_context *ctx) switch (instruction->opcode) { - case VKD3DSIH_REP: - vsir_validate_cf_type(ctx, instruction, VSIR_CF_STRUCTURED); - vsir_validate_dst_count(ctx, instruction, 0); - vsir_validate_src_count(ctx, instruction, 1); - if (!vkd3d_array_reserve((void **)&ctx->blocks, &ctx->blocks_capacity, ctx->depth + 1, sizeof(*ctx->blocks))) - return; - ctx->blocks[ctx->depth++] = instruction->opcode; - break; - case VKD3DSIH_ENDREP: vsir_validate_cf_type(ctx, instruction, VSIR_CF_STRUCTURED); vsir_validate_dst_count(ctx, instruction, 0);