mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Introduce a helper for validating UAV registers.
This commit is contained in:
parent
c60eecbac8
commit
7021a57193
Notes:
Henri Verbeet
2024-10-14 15:46:02 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1176
@ -6330,6 +6330,38 @@ static void vsir_validate_resource_register(struct validation_context *ctx,
|
||||
"Non-NULL relative address for the descriptor index of a RESOURCE register.");
|
||||
}
|
||||
|
||||
static void vsir_validate_uav_register(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
if (reg->precision != VKD3D_SHADER_REGISTER_PRECISION_DEFAULT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION,
|
||||
"Invalid precision %#x for a UAV register.",
|
||||
reg->precision);
|
||||
|
||||
if (reg->data_type != VKD3D_DATA_UNUSED)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||
"Invalid data type %#x for a UAV register.",
|
||||
reg->data_type);
|
||||
|
||||
/* NONE is allowed in counter operations. */
|
||||
if (reg->dimension == VSIR_DIMENSION_SCALAR)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION,
|
||||
"Invalid dimension %#x for a UAV register.",
|
||||
reg->dimension);
|
||||
|
||||
if (reg->idx_count != 2)
|
||||
{
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
"Invalid index count %u for a UAV register.",
|
||||
reg->idx_count);
|
||||
return;
|
||||
}
|
||||
|
||||
if (reg->idx[0].rel_addr)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
|
||||
"Non-NULL relative address for the descriptor index of a UAV register.");
|
||||
}
|
||||
|
||||
static void vsir_validate_ssa_register(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
@ -6458,6 +6490,10 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
vsir_validate_resource_register(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_UAV:
|
||||
vsir_validate_uav_register(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_DEPTHOUTGE:
|
||||
vsir_validate_register_without_indices(ctx, reg);
|
||||
break;
|
||||
@ -6470,36 +6506,6 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
vsir_validate_ssa_register(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_UAV:
|
||||
if (reg->precision != VKD3D_SHADER_REGISTER_PRECISION_DEFAULT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION,
|
||||
"Invalid precision %#x for a UAV register.",
|
||||
reg->precision);
|
||||
|
||||
if (reg->data_type != VKD3D_DATA_UNUSED)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||
"Invalid data type %#x for a UAV register.",
|
||||
reg->data_type);
|
||||
|
||||
/* NONE is allowed in counter operations. */
|
||||
if (reg->dimension == VSIR_DIMENSION_SCALAR)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION,
|
||||
"Invalid dimension %#x for a UAV register.",
|
||||
reg->dimension);
|
||||
|
||||
if (reg->idx_count != 2)
|
||||
{
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
"Invalid index count %u for a UAV register.",
|
||||
reg->idx_count);
|
||||
break;
|
||||
}
|
||||
|
||||
if (reg->idx[0].rel_addr)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
|
||||
"Non-NULL relative address for the descriptor index of a UAV register.");
|
||||
break;
|
||||
|
||||
case VKD3DSPR_RASTOUT:
|
||||
if (reg->idx_count != 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user