mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/ir: Validate ABS instructions.
This commit is contained in:
committed by
Henri Verbeet
parent
5911e410a8
commit
65e896fd60
Notes:
Henri Verbeet
2025-06-19 20:51:26 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1108
@@ -9284,6 +9284,31 @@ static void vsir_validate_hull_shader_phase(struct validation_context *ctx,
|
|||||||
ctx->dcl_temps_found = false;
|
ctx->dcl_temps_found = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_float_elementwise_operation(struct validation_context *ctx,
|
||||||
|
const struct vkd3d_shader_instruction *instruction)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (instruction->dst_count < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (instruction->dst[0].reg.data_type != VKD3D_DATA_FLOAT)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||||
|
"Invalid data type %#x for elementwise operation \"%s\" (%#x).",
|
||||||
|
instruction->dst[0].reg.data_type,
|
||||||
|
vsir_opcode_get_name(instruction->opcode, "<unknown>"), instruction->opcode);
|
||||||
|
|
||||||
|
for (i = 0; i < instruction->src_count; ++i)
|
||||||
|
{
|
||||||
|
if (instruction->src[i].reg.data_type != instruction->dst[0].reg.data_type)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||||
|
"Data type %#x for operand %u doesn't match the destination data type %#x "
|
||||||
|
"for elementwise operation \"%s\" (%#x).",
|
||||||
|
instruction->src[i].reg.data_type, i, instruction->dst[0].reg.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)
|
static void vsir_validate_branch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
@@ -9969,6 +9994,7 @@ struct vsir_validator_instruction_desc
|
|||||||
|
|
||||||
static const struct vsir_validator_instruction_desc vsir_validator_instructions[] =
|
static const struct vsir_validator_instruction_desc vsir_validator_instructions[] =
|
||||||
{
|
{
|
||||||
|
[VKD3DSIH_ABS] = {1, 1, vsir_validate_float_elementwise_operation},
|
||||||
[VKD3DSIH_BRANCH] = {0, ~0u, vsir_validate_branch},
|
[VKD3DSIH_BRANCH] = {0, ~0u, vsir_validate_branch},
|
||||||
[VKD3DSIH_HS_CONTROL_POINT_PHASE] = {0, 0, vsir_validate_hull_shader_phase},
|
[VKD3DSIH_HS_CONTROL_POINT_PHASE] = {0, 0, vsir_validate_hull_shader_phase},
|
||||||
[VKD3DSIH_HS_DECLS] = {0, 0, vsir_validate_hull_shader_phase},
|
[VKD3DSIH_HS_DECLS] = {0, 0, vsir_validate_hull_shader_phase},
|
||||||
|
Reference in New Issue
Block a user