vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_shift_operation().

This commit is contained in:
Henri Verbeet
2025-08-29 21:26:51 +02:00
parent e7f3547c24
commit b326097473
Notes: Henri Verbeet 2025-09-10 12:04:15 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1720

View File

@@ -11178,7 +11178,7 @@ static void vsir_validate_cast_operation(struct validation_context *ctx,
static void vsir_validate_shift_operation(struct validation_context *ctx,
const struct vkd3d_shader_instruction *instruction)
{
enum vsir_data_type data_type;
enum vsir_data_type dst_data_type, src_data_type;
static const bool types[] =
{
@@ -11187,24 +11187,27 @@ static void vsir_validate_shift_operation(struct validation_context *ctx,
[VSIR_DATA_U64] = true,
};
data_type = instruction->dst[0].reg.data_type;
if ((size_t)data_type >= ARRAY_SIZE(types) || !types[data_type])
dst_data_type = instruction->dst[0].reg.data_type;
if ((size_t)dst_data_type >= ARRAY_SIZE(types) || !types[dst_data_type])
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
"Invalid destination data type %#x for shift operation \"%s\" (%#x).",
data_type, vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode);
if (instruction->src[0].reg.data_type != data_type)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
"Data type %#x for source operand 0 doesn't match destination data type %#x "
"for shift operation \"%s\" (%#x).",
instruction->src[0].reg.data_type, data_type,
"Invalid destination data type \"%s\" (%#x) for shift operation \"%s\" (%#x).",
vsir_data_type_get_name(dst_data_type, "<unknown>"), dst_data_type,
vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode);
data_type = instruction->src[1].reg.data_type;
if ((size_t)data_type >= ARRAY_SIZE(types) || !types[data_type])
if ((src_data_type = instruction->src[0].reg.data_type) != dst_data_type)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
"Invalid source operand 1 data type %#x for shift operation \"%s\" (%#x).",
data_type, vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode);
"Data type \"%s\" (%#x) for source operand 0 doesn't match destination data type \"%s\" (%#x) "
"for shift operation \"%s\" (%#x).",
vsir_data_type_get_name(src_data_type, "<unknown>"), src_data_type,
vsir_data_type_get_name(dst_data_type, "<unknown>"), dst_data_type,
vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode);
src_data_type = instruction->src[1].reg.data_type;
if ((size_t)src_data_type >= ARRAY_SIZE(types) || !types[src_data_type])
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
"Invalid source operand 1 data type \"%s\" (%#x) for shift operation \"%s\" (%#x).",
vsir_data_type_get_name(src_data_type, "<unknown>"), src_data_type,
vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode);
}
static void vsir_validate_branch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)