summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorPavel Ondračka <pavel.ondracka@gmail.com>2022-11-15 22:35:32 +0100
committerMarge Bot <emma+marge@anholt.net>2022-11-16 19:51:47 +0000
commit8cfc44aace34036caecb8043369165a04f601666 (patch)
tree6c6dd8bbac73e58b7606d18fb8b210610d99a17b /src/gallium/drivers/r300
parent6738a7b5b4ae7a8f14fda0d39f760db4e29db186 (diff)
r300: don't allow constant swizzles from presubtract sources
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 <pavel.ondracka@gmail.com> Reviewed-by: Filip Gawin <filip@gawin.net> Tested-by: Filip Gawin <filip@gawin.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19764>
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/compiler/radeon_compiler_util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c
index c2a2b396293..2a2542a47b2 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.