diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 087d4e66e..2c36a1fd0 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -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, ""), 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, ""), dst_data_type, vsir_opcode_get_name(instruction->opcode, ""), 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, ""), 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, ""), src_data_type, + vsir_data_type_get_name(dst_data_type, ""), dst_data_type, + vsir_opcode_get_name(instruction->opcode, ""), 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, ""), src_data_type, + vsir_opcode_get_name(instruction->opcode, ""), instruction->opcode); } static void vsir_validate_branch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)