mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Record entering a block in the LABEL validation handler.
This commit is contained in:
parent
1d21588de7
commit
e1c3266793
Notes:
Henri Verbeet
2024-09-16 14:22:01 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1074
@ -6280,6 +6280,11 @@ static void vsir_validate_label(struct validation_context *ctx, const struct vkd
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE,
|
||||
"Invalid register of type %#x in a LABEL instruction, expected LABEL.",
|
||||
instruction->src[0].reg.type);
|
||||
|
||||
if (ctx->inside_block)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW,
|
||||
"Invalid LABEL instruction inside a block.");
|
||||
ctx->inside_block = true;
|
||||
}
|
||||
|
||||
static void vsir_validate_loop(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
|
||||
@ -6559,19 +6564,16 @@ static void vsir_validate_instruction(struct validation_context *ctx)
|
||||
"Instruction %#x appear before any phase instruction in a hull shader.",
|
||||
instruction->opcode);
|
||||
|
||||
if (ctx->program->cf_type == VSIR_CF_BLOCKS && !vsir_instruction_is_dcl(instruction)
|
||||
&& instruction->opcode != VKD3DSIH_NOP)
|
||||
if (ctx->program->cf_type == VSIR_CF_BLOCKS && !ctx->inside_block)
|
||||
{
|
||||
switch (instruction->opcode)
|
||||
{
|
||||
case VKD3DSIH_NOP:
|
||||
case VKD3DSIH_LABEL:
|
||||
if (ctx->inside_block)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW, "Invalid LABEL instruction inside a block.");
|
||||
ctx->inside_block = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!ctx->inside_block)
|
||||
if (!vsir_instruction_is_dcl(instruction))
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW,
|
||||
"Invalid instruction %#x outside any block.",
|
||||
instruction->opcode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user