vkd3d-shader/ir: Validate the register precision.

This commit is contained in:
Giovanni Mascellani 2023-10-24 19:37:40 -05:00 committed by Alexandre Julliard
parent f3c1a15a6f
commit 72d0f765f2
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

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

View File

@ -200,6 +200,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS = 9004, VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS = 9004,
VKD3D_SHADER_ERROR_VSIR_INVALID_SHIFT = 9005, VKD3D_SHADER_ERROR_VSIR_INVALID_SHIFT = 9005,
VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE = 9006, VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE = 9006,
VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION = 9007,
}; };
enum vkd3d_shader_opcode enum vkd3d_shader_opcode
@ -556,6 +557,8 @@ enum vkd3d_shader_register_precision
VKD3D_SHADER_REGISTER_PRECISION_MIN_INT_16, VKD3D_SHADER_REGISTER_PRECISION_MIN_INT_16,
VKD3D_SHADER_REGISTER_PRECISION_MIN_UINT_16, VKD3D_SHADER_REGISTER_PRECISION_MIN_UINT_16,
VKD3D_SHADER_REGISTER_PRECISION_COUNT,
VKD3D_SHADER_REGISTER_PRECISION_INVALID = ~0u, VKD3D_SHADER_REGISTER_PRECISION_INVALID = ~0u,
}; };