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>
This commit is contained in:
Pavel Ondračka 2022-11-15 22:35:32 +01:00 committed by Marge Bot
parent 6738a7b5b4
commit 8cfc44aace

View file

@ -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.