From 92cf02ee2308c60c7c2f275a68572b8bcb45d2d6 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 14 Jul 2025 17:10:07 +0200 Subject: [PATCH] nir/search: support swizzles on expressions in replacement patterns Before this wasn't a compile time error, but it also didn't do anything. Reviewed-by: Rhys Perry Part-of: --- src/compiler/nir/nir_search.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 8faed29201e..52ede88e9b2 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -500,7 +500,10 @@ construct_value(nir_builder *build, nir_alu_src val; val.src = nir_src_for_ssa(&alu->def); - memcpy(val.swizzle, identity_swizzle, sizeof val.swizzle); + if (expr->swizzle < 0) + memcpy(val.swizzle, identity_swizzle, sizeof(val.swizzle)); + else + memset(val.swizzle, expr->swizzle, sizeof(val.swizzle)); return val; }