r600: fix textures with swizzles limited to zero and one

This issue seems to be specific to textureGather() which could
fail when processing some surfaces. These surfaces are configured
with non-standard one and zero swizzles. The gpu doesn't support
this very specific setup with all the possible hardware formats.
This change selects a compatible configuration when this is
possible.

This change was tested on palm, barts and cayman. This change
fixes the 216 remaining arb_texture_gather tests:
spec/arb_texture_gather/texturegather/.*-zero-.*: fail pass
spec/arb_texture_gather/texturegather/.*-one-.*: fail pass
spec/arb_texture_gather/texturegatheroffset/.*-zero-.*: fail pass
spec/arb_texture_gather/texturegatheroffset/.*-one-.*: fail pass

Cc: mesa-stable
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34293>
This commit is contained in:
Patrick Lerda 2025-03-28 13:20:18 +01:00 committed by Marge Bot
parent e3c3fa8b9a
commit f0c0997277

View file

@ -3112,6 +3112,26 @@ out_word4:
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB && !is_srgb_valid)
return ~0;
if (unlikely(swizzle_view &&
swizzle_view[0] >= PIPE_SWIZZLE_0 &&
swizzle_view[1] >= PIPE_SWIZZLE_0 &&
swizzle_view[2] >= PIPE_SWIZZLE_0 &&
swizzle_view[3] >= PIPE_SWIZZLE_0)) {
switch (result) {
case FMT_32_32_32_32_FLOAT:
case FMT_32_32_FLOAT:
result = FMT_32_FLOAT;
break;
case FMT_16_16_16_16:
case FMT_16_16:
result = FMT_32;
break;
default:
break;
}
}
if (word4_p)
*word4_p = word4;
if (yuv_format_p)