mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/ir: Validate flags in SAMPLE_INFO operations.
This commit is contained in:
committed by
Henri Verbeet
parent
a4f5225229
commit
3a0a96b851
Notes:
Henri Verbeet
2025-07-28 16:39:19 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1653
@@ -11518,6 +11518,35 @@ static void vsir_validate_ret(struct validation_context *ctx, const struct vkd3d
|
|||||||
ctx->inside_block = false;
|
ctx->inside_block = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_throw_invalid_dst_type_error_with_flags(struct validation_context *ctx,
|
||||||
|
const struct vkd3d_shader_instruction *instruction)
|
||||||
|
{
|
||||||
|
enum vsir_data_type dst_data_type = instruction->dst[0].reg.data_type;
|
||||||
|
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||||
|
"Invalid destination data type %#x for operation \"%s\" (%#x) with flags %#x.", dst_data_type,
|
||||||
|
vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode, instruction->flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_sample_info(struct validation_context *ctx,
|
||||||
|
const struct vkd3d_shader_instruction *instruction)
|
||||||
|
{
|
||||||
|
enum vsir_data_type dst_data_type = instruction->dst[0].reg.data_type;
|
||||||
|
|
||||||
|
switch (dst_data_type)
|
||||||
|
{
|
||||||
|
case VSIR_DATA_F32:
|
||||||
|
case VSIR_DATA_U32:
|
||||||
|
if (!!(instruction->flags & VKD3DSI_SAMPLE_INFO_UINT) != (dst_data_type == VSIR_DATA_U32))
|
||||||
|
vsir_validate_throw_invalid_dst_type_error_with_flags(ctx, instruction);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
vsir_validate_throw_invalid_dst_type_error_with_flags(ctx, instruction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void vsir_validate_switch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
|
static void vsir_validate_switch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
|
||||||
{
|
{
|
||||||
vsir_validate_cf_type(ctx, instruction, VSIR_CF_STRUCTURED);
|
vsir_validate_cf_type(ctx, instruction, VSIR_CF_STRUCTURED);
|
||||||
@@ -11688,6 +11717,7 @@ static const struct vsir_validator_instruction_desc vsir_validator_instructions[
|
|||||||
[VSIR_OP_RET] = {0, 0, vsir_validate_ret},
|
[VSIR_OP_RET] = {0, 0, vsir_validate_ret},
|
||||||
[VSIR_OP_ROUND_NE] = {1, 1, vsir_validate_float_elementwise_operation},
|
[VSIR_OP_ROUND_NE] = {1, 1, vsir_validate_float_elementwise_operation},
|
||||||
[VSIR_OP_ROUND_NI] = {1, 1, vsir_validate_float_elementwise_operation},
|
[VSIR_OP_ROUND_NI] = {1, 1, vsir_validate_float_elementwise_operation},
|
||||||
|
[VSIR_OP_SAMPLE_INFO] = {1, 1, vsir_validate_sample_info},
|
||||||
[VSIR_OP_SWITCH] = {0, 1, vsir_validate_switch},
|
[VSIR_OP_SWITCH] = {0, 1, vsir_validate_switch},
|
||||||
[VSIR_OP_SWITCH_MONOLITHIC] = {0, ~0u, vsir_validate_switch_monolithic},
|
[VSIR_OP_SWITCH_MONOLITHIC] = {0, ~0u, vsir_validate_switch_monolithic},
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user