From 99aebb1b31472e45e4eb0d885f2c23908fee36ba Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 26 Sep 2024 21:32:30 +0200 Subject: [PATCH] vkd3d-shader/ir: Validate index count for RASTOUT registers. --- libs/vkd3d-shader/ir.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index a9c9243a..a1ed3dc8 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -6244,6 +6244,24 @@ static void vsir_validate_register(struct validation_context *ctx, reg->idx_count); 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; + default: break; }