pan/midg: Fix 64-bit swizzle printer

Swizzling happens in 2 steps on Midgard:

1. Vector expansion/shuffling
2. Swizzling at the instruction-size granularity, but defined using
   the source size. Those size are different if the source is expanded.

So, when we print 64 bit swizzles on an expanded source, we first need
to apply an offset if the high part of the 32bit vector was selected,
and then divide the result by 2 to account for vector expansion.

To sum-up, swizzling on midgard is complicated, and I'm not sure I got
it right, but it seems to print what I expect on the few compute
shaders using 64bit arithmetic I debugged.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14885>
This commit is contained in:
Boris Brezillon 2021-09-09 10:31:18 +02:00 committed by Alyssa Rosenzweig
parent 39e4b7279d
commit b58c262144

View file

@ -415,7 +415,10 @@ print_vec_selectors_64(FILE *fp, unsigned swizzle,
unsigned a = (swizzle >> (i * 2)) & 3;
if (INPUT_EXPANDS(expand_mode)) {
fprintf(fp, "%c", components[a]);
if (expand_mode == midgard_src_expand_high)
a += 2;
fprintf(fp, "%c", components[a / 2]);
continue;
}