From 79ad8c93541d64a23c55af4040072d2c6b7b4e65 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Sun, 8 Dec 2024 19:53:11 -0600 Subject: [PATCH] vkd3d-shader/hlsl: Handle error instructions in hlsl_new_swizzle(). We already check for error instructions when parsing swizzles, but if allocation fails at codegen time we would like to avoid asserting when subsequently constructing a swizzle. --- libs/vkd3d-shader/hlsl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 36e0a20c..4f794926 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1865,6 +1865,9 @@ struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned struct hlsl_ir_swizzle *swizzle; struct hlsl_type *type; + if (val->data_type->class == HLSL_CLASS_ERROR) + return val; + VKD3D_ASSERT(val->data_type->class <= HLSL_CLASS_VECTOR); if (!(swizzle = hlsl_alloc(ctx, sizeof(*swizzle))))