From 8cfc44aace34036caecb8043369165a04f601666 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pavel=20Ondra=C4=8Dka?= Date: Tue, 15 Nov 2022 22:35:32 +0100 Subject: [PATCH] r300: don't allow constant swizzles from presubtract sources MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It is not possible to rewrite it to a native swizzle later on R300/R400. The way the native rewrite currently works, it will create bunch of movs with the given presubtract and partial swizzles, however no constant swizzle for presubtract source exists so it is just not possible to rewrite it. This prevents an infinite loop in supertuxkart shader when we really start enforcing the presubtract swizzle limitations during native swizzle rewrite in the next commit. Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Tested-by: Filip Gawin Part-of: --- src/gallium/drivers/r300/compiler/radeon_compiler_util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c index c2a2b39..2a2542a 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c +++ b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c @@ -457,6 +457,16 @@ unsigned int rc_inst_can_use_presub( return 0; } + /* We can't allow constant swizzles from presubtract, because it is not possible + * to rewrite it to a native swizzle later. */ + if (!c->is_r500) { + for (i = 0; i < 4; i++) { + rc_swizzle swz = GET_SWZ(replace_reg->Swizzle, i); + if (swz > RC_SWIZZLE_W && swz < RC_SWIZZLE_UNUSED) + return 0; + } + } + /* We can't use more than one presubtract value in an * instruction, unless the two prsubtract operations * are the same and read from the same registers. -- 2.7.4