summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format_parse.py
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2020-02-05 10:38:57 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-02-11 09:27:04 -0800
commit8f630dc7c5483a75fe8fd890be03586dfa79779b (patch)
tree4401bc277e8d7217be88c26bed674759609bed01 /src/gallium/auxiliary/util/u_format_parse.py
parent007013c754ac1b0b98e5950b0bc6aaa3d330c3ff (diff)
Revert "gallium: Fix big-endian addressing of non-bitmask array formats."
This reverts the functional part of commit d17ff2f7f1864c81c1e00d04baf20f953c6d276a, leaving the unit test for mesa/pipe agreement on what's an array. The issue is that the util_channel_desc.shift values on array formats are not used for bit addressing in memory, they're bit addressing within a word treating a pixel of the format as a native type, as seen by llvmpipe's use of the values to do shifts (see lp_build_unpack_arith_rgba_aos() for example). This means the values are nonsensical for 3-byte RGB, but then llvmpipe doesn't expose those formats so it works out. I still want to clean up our big-endian format handling at some point, but let's fix the s390x regression first, sort out our format unit tests in CI, then be able to refactor with confidence. Fixes: d17ff2f7f186 ("gallium: Fix big-endian addressing of non-bitmask array formats.") Closes: #2472 Acked-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3721> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3721> (cherry picked from commit 1886dbfe7362baa221009371434f158b97183164)
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_parse.py')
-rw-r--r--src/gallium/auxiliary/util/u_format_parse.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 541ae69d4dc..b9627055cda 100644
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -379,27 +379,16 @@ def parse(filename):
channel.shift = le_shift
le_shift += channel.size
+ be_shift = 0
+ for channel in be_channels[3::-1]:
+ channel.shift = be_shift
+ be_shift += channel.size
+
+ assert le_shift == be_shift
for i in range(4):
assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE)
format = Format(name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
-
- if format.is_array() and not format.is_bitmask():
- # Formats accessed as arrays by the pack functions (R32G32_FLOAT or
- # R8G8B8_UNORM, for example) should not be channel-ordering-reversed
- # for BE.
- # Note that __eq__ on channels ignores .shift!
- assert(format.be_channels == format.le_channels)
- assert(format.be_swizzles == format.le_swizzles)
- format.be_channels = format.le_channels
- else:
- be_shift = 0
- for channel in format.be_channels[3::-1]:
- channel.shift = be_shift
- be_shift += channel.size
-
- assert le_shift == be_shift
-
formats.append(format)
return formats