vkd3d-shader/ir: Introduce a helper for validating RASTOUT registers.

This commit is contained in:
Giovanni Mascellani 2024-10-13 22:53:06 +02:00 committed by Henri Verbeet
parent 7021a57193
commit 15d8591a26
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

View File

@ -6240,6 +6240,26 @@ static void vsir_validate_temp_register(struct validation_context *ctx,
} }
} }
static void vsir_validate_rastout_register(struct validation_context *ctx,
const struct vkd3d_shader_register *reg)
{
if (reg->idx_count != 1)
{
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
"Invalid index count %u for a RASTOUT 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 a RASTOUT register.");
if (reg->idx[0].offset >= 3)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
"Invalid offset for a RASTOUT register.");
}
static void vsir_validate_label_register(struct validation_context *ctx, static void vsir_validate_label_register(struct validation_context *ctx,
const struct vkd3d_shader_register *reg) const struct vkd3d_shader_register *reg)
{ {
@ -6462,6 +6482,10 @@ 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_RASTOUT:
vsir_validate_rastout_register(ctx, reg);
break;
case VKD3DSPR_DEPTHOUT: case VKD3DSPR_DEPTHOUT:
vsir_validate_register_without_indices(ctx, reg); vsir_validate_register_without_indices(ctx, reg);
break; break;
@ -6506,24 +6530,6 @@ static void vsir_validate_register(struct validation_context *ctx,
vsir_validate_ssa_register(ctx, reg); vsir_validate_ssa_register(ctx, reg);
break; break;
case VKD3DSPR_RASTOUT:
if (reg->idx_count != 1)
{
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
"Invalid index count %u for a RASTOUT 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 a RASTOUT register.");
if (reg->idx[0].offset >= 3)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
"Invalid offset for a RASTOUT register.");
break;
case VKD3DSPR_MISCTYPE: case VKD3DSPR_MISCTYPE:
if (reg->idx_count != 1) if (reg->idx_count != 1)
{ {