mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/ir: Validate the DCL_TEMPS instruction.
This commit is contained in:
parent
79fa5fd8bb
commit
4140b87499
Notes:
Alexandre Julliard
2023-11-02 22:49:42 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/432
@ -1560,6 +1560,24 @@ static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
src->modifiers);
|
||||
}
|
||||
|
||||
static void vsir_validate_dst_count(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_instruction *instruction, unsigned int count)
|
||||
{
|
||||
if (instruction->dst_count != count)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DEST_COUNT,
|
||||
"Invalid destination count %u for an instruction of type %#x, expected %u.",
|
||||
instruction->dst_count, instruction->handler_idx, count);
|
||||
}
|
||||
|
||||
static void vsir_validate_src_count(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_instruction *instruction, unsigned int count)
|
||||
{
|
||||
if (instruction->src_count != count)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT,
|
||||
"Invalid source count %u for an instruction of type %#x, expected %u.",
|
||||
instruction->src_count, instruction->handler_idx, count);
|
||||
}
|
||||
|
||||
static void vsir_validate_instruction(struct validation_context *ctx)
|
||||
{
|
||||
const struct vkd3d_shader_instruction *instruction = &ctx->parser->instructions.elements[ctx->instruction_idx];
|
||||
@ -1578,6 +1596,17 @@ static void vsir_validate_instruction(struct validation_context *ctx)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER, "Invalid instruction handler %#x.",
|
||||
instruction->handler_idx);
|
||||
}
|
||||
|
||||
switch (instruction->handler_idx)
|
||||
{
|
||||
case VKD3DSIH_DCL_TEMPS:
|
||||
vsir_validate_dst_count(ctx, instruction, 0);
|
||||
vsir_validate_src_count(ctx, instruction, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void vsir_validate(struct vkd3d_shader_parser *parser)
|
||||
|
@ -204,6 +204,8 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE = 9008,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION = 9009,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT = 9010,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_DEST_COUNT = 9011,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT = 9012,
|
||||
};
|
||||
|
||||
enum vkd3d_shader_opcode
|
||||
|
Loading…
x
Reference in New Issue
Block a user