From 831a7978370acddcc24649eecc40f763ebd17177 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 9 Oct 2024 17:12:17 +0200 Subject: [PATCH] vkd3d-shader/ir: Validate minimum precision in shader signatures. --- libs/vkd3d-shader/ir.c | 5 +++++ libs/vkd3d-shader/vkd3d_shader_private.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 2ca683b9..a4a8f23b 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -6590,6 +6590,11 @@ static void vsir_validate_signature_element(struct validation_context *ctx, idx, signature_type, element->component_type); break; } + + if (element->min_precision >= VKD3D_SHADER_MINIMUM_PRECISION_COUNT) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE, + "element %u of %s signature: Invalid minimum precision %#x.", + idx, signature_type, element->min_precision); } static void vsir_validate_signature(struct validation_context *ctx, diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index bf55fa4b..b7397dfe 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -60,6 +60,7 @@ #define VKD3D_DVEC2_SIZE 2 #define VKD3D_SHADER_COMPONENT_TYPE_COUNT (VKD3D_SHADER_COMPONENT_UINT64 + 1) +#define VKD3D_SHADER_MINIMUM_PRECISION_COUNT (VKD3D_SHADER_MINIMUM_PRECISION_UINT_16 + 1) enum vkd3d_shader_error {