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 RESOURCE registers.
This commit is contained in:
parent
edbf7349bd
commit
c60eecbac8
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
@ -6303,6 +6303,33 @@ static void vsir_validate_sampler_register(struct validation_context *ctx,
|
||||
"Non-NULL relative address for the descriptor index of a SAMPLER register.");
|
||||
}
|
||||
|
||||
static void vsir_validate_resource_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 RESOURCE 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 RESOURCE register.", reg->data_type);
|
||||
|
||||
if (reg->dimension != VSIR_DIMENSION_VEC4)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION,
|
||||
"Invalid dimension %#x for a RESOURCE register.", reg->dimension);
|
||||
|
||||
if (reg->idx_count != 2)
|
||||
{
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
"Invalid index count %u for a RESOURCE 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 RESOURCE register.");
|
||||
}
|
||||
|
||||
static void vsir_validate_ssa_register(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
@ -6427,6 +6454,10 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
vsir_validate_sampler_register(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_RESOURCE:
|
||||
vsir_validate_resource_register(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_DEPTHOUTGE:
|
||||
vsir_validate_register_without_indices(ctx, reg);
|
||||
break;
|
||||
@ -6439,35 +6470,6 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
vsir_validate_ssa_register(ctx, reg);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_RESOURCE:
|
||||
if (reg->precision != VKD3D_SHADER_REGISTER_PRECISION_DEFAULT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION,
|
||||
"Invalid precision %#x for a RESOURCE 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 RESOURCE register.",
|
||||
reg->data_type);
|
||||
|
||||
if (reg->dimension != VSIR_DIMENSION_VEC4)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION,
|
||||
"Invalid dimension %#x for a RESOURCE register.",
|
||||
reg->dimension);
|
||||
|
||||
if (reg->idx_count != 2)
|
||||
{
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
"Invalid index count %u for a RESOURCE 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 RESOURCE register.");
|
||||
break;
|
||||
|
||||
case VKD3DSPR_UAV:
|
||||
if (reg->precision != VKD3D_SHADER_REGISTER_PRECISION_DEFAULT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION,
|
||||
|
Loading…
Reference in New Issue
Block a user