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>
(cherry picked from commit f0c0997277)
This commit is contained in:
Patrick Lerda 2025-03-28 13:20:18 +01:00 committed by Eric Engestrom
parent c207f96862
commit ced585e3f4
2 changed files with 21 additions and 1 deletions

View file

@ -1584,7 +1584,7 @@
"description": "r600: fix textures with swizzles limited to zero and one",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -3103,6 +3103,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)