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 registers without indices.
This commit is contained in:
parent
ce638b9cca
commit
52761e689b
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
@ -6180,6 +6180,15 @@ static void VKD3D_PRINTF_FUNC(3, 4) validator_error(struct validation_context *c
|
|||||||
ctx->status = VKD3D_ERROR_INVALID_SHADER;
|
ctx->status = VKD3D_ERROR_INVALID_SHADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vsir_validate_register_without_indices(struct validation_context *ctx,
|
||||||
|
const struct vkd3d_shader_register *reg)
|
||||||
|
{
|
||||||
|
if (reg->idx_count != 0)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||||
|
"Invalid index count %u for a register of type %#x.",
|
||||||
|
reg->idx_count, reg->type);
|
||||||
|
}
|
||||||
|
|
||||||
static void vsir_validate_temp_register(struct validation_context *ctx,
|
static void vsir_validate_temp_register(struct validation_context *ctx,
|
||||||
const struct vkd3d_shader_register *reg)
|
const struct vkd3d_shader_register *reg)
|
||||||
{
|
{
|
||||||
@ -6366,30 +6375,36 @@ static void vsir_validate_register(struct validation_context *ctx,
|
|||||||
vsir_validate_temp_register(ctx, reg);
|
vsir_validate_temp_register(ctx, reg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VKD3DSPR_DEPTHOUT:
|
||||||
|
vsir_validate_register_without_indices(ctx, reg);
|
||||||
|
break;
|
||||||
|
|
||||||
case VKD3DSPR_LABEL:
|
case VKD3DSPR_LABEL:
|
||||||
vsir_validate_label_register(ctx, reg);
|
vsir_validate_label_register(ctx, reg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3DSPR_SSA:
|
|
||||||
vsir_validate_ssa_register(ctx, reg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VKD3DSPR_NULL:
|
|
||||||
if (reg->idx_count != 0)
|
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a NULL register.",
|
|
||||||
reg->idx_count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VKD3DSPR_IMMCONST:
|
case VKD3DSPR_IMMCONST:
|
||||||
if (reg->idx_count != 0)
|
vsir_validate_register_without_indices(ctx, reg);
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a IMMCONST register.",
|
|
||||||
reg->idx_count);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3DSPR_IMMCONST64:
|
case VKD3DSPR_IMMCONST64:
|
||||||
if (reg->idx_count != 0)
|
vsir_validate_register_without_indices(ctx, reg);
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a IMMCONST64 register.",
|
break;
|
||||||
reg->idx_count);
|
|
||||||
|
case VKD3DSPR_NULL:
|
||||||
|
vsir_validate_register_without_indices(ctx, reg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VKD3DSPR_DEPTHOUTGE:
|
||||||
|
vsir_validate_register_without_indices(ctx, reg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VKD3DSPR_DEPTHOUTLE:
|
||||||
|
vsir_validate_register_without_indices(ctx, reg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VKD3DSPR_SSA:
|
||||||
|
vsir_validate_ssa_register(ctx, reg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3DSPR_SAMPLER:
|
case VKD3DSPR_SAMPLER:
|
||||||
@ -6480,27 +6495,6 @@ static void vsir_validate_register(struct validation_context *ctx,
|
|||||||
"Non-NULL relative address for the descriptor index of a UAV register.");
|
"Non-NULL relative address for the descriptor index of a UAV register.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VKD3DSPR_DEPTHOUT:
|
|
||||||
if (reg->idx_count != 0)
|
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
|
||||||
"Invalid index count %u for a DEPTHOUT register.",
|
|
||||||
reg->idx_count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VKD3DSPR_DEPTHOUTGE:
|
|
||||||
if (reg->idx_count != 0)
|
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
|
||||||
"Invalid index count %u for a DEPTHOUTGE register.",
|
|
||||||
reg->idx_count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VKD3DSPR_DEPTHOUTLE:
|
|
||||||
if (reg->idx_count != 0)
|
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
|
||||||
"Invalid index count %u for a DEPTHOUTLE register.",
|
|
||||||
reg->idx_count);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VKD3DSPR_RASTOUT:
|
case VKD3DSPR_RASTOUT:
|
||||||
if (reg->idx_count != 1)
|
if (reg->idx_count != 1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user