vkd3d-shader/ir: Validate the register data type.

This commit is contained in:
Giovanni Mascellani 2023-10-24 19:41:09 -05:00 committed by Alexandre Julliard
parent 72d0f765f2
commit f3a20be35a
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
2 changed files with 7 additions and 0 deletions

View File

@ -1502,6 +1502,10 @@ static void vsir_validate_register(struct validation_context *ctx,
if (reg->precision >= VKD3D_SHADER_REGISTER_PRECISION_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION, "Invalid register precision %#x.",
reg->precision);
if (reg->data_type >= VKD3D_DATA_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE, "Invalid register data type %#x.",
reg->data_type);
}
static void vsir_validate_dst_param(struct validation_context *ctx,

View File

@ -201,6 +201,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_VSIR_INVALID_SHIFT = 9005,
VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE = 9006,
VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION = 9007,
VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE = 9008,
};
enum vkd3d_shader_opcode
@ -580,6 +581,8 @@ enum vkd3d_data_type
VKD3D_DATA_UINT8,
VKD3D_DATA_UINT64,
VKD3D_DATA_BOOL,
VKD3D_DATA_COUNT,
};
static inline bool data_type_is_integer(enum vkd3d_data_type data_type)