r300: properly account for per-channel negates when reswizzling

Vertex shaders can have a per-channel negate so we need to properly
update the negate mask when rewriting swizzles.

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/19618>
This commit is contained in:
Pavel Ondračka 2022-10-31 10:08:38 +01:00 committed by Marge Bot
parent 0146f5029a
commit e571fb9d2e

View file

@ -220,6 +220,20 @@ static void normal_rewrite_writemask_cb(
{
unsigned int * conversion_swizzle = (unsigned int *)userdata;
src->Swizzle = rc_adjust_channels(src->Swizzle, *conversion_swizzle);
/* Per-channel negates are possible in vertex shaders,
* so we need to rewrite it properly as well. */
unsigned int new_negate = 0;
for (unsigned int i = 0; i < 4; i++) {
unsigned int new_chan = get_swz(*conversion_swizzle, i);
if (new_chan == RC_SWIZZLE_UNUSED)
continue;
if ((1 << i) & src->Negate)
new_negate |= 1 << new_chan;
}
src->Negate = new_negate;
}
/**