diff options
author | Eric Anholt <[email protected]> | 2019-08-14 14:40:03 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-08-28 10:39:36 -0700 |
commit | 4662b70d23c2eed9b891e9694d956a1a2a37ab70 (patch) | |
tree | eeb33c6583a91a85089b7f2e0aa522357672f401 /src | |
parent | d17ff2f7f1864c81c1e00d04baf20f953c6d276a (diff) |
gallium: Don't emit identical endian-dependent pack/unpack code.
Reduces the size of the u_format_table.c file by 140k (out of 1.64M)
and makes me less confused about endianness in gallium.
Reviewed-by: Roland Scheidegger <[email protected]>
Acked-by: Adam Jackson <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/util/u_format_pack.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index 75bda428e93..aae6b5ab9f0 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -64,11 +64,17 @@ def print_channels(format, func): if format.nr_channels() <= 1: func(format.le_channels, format.le_swizzles) else: - print('#ifdef PIPE_ARCH_BIG_ENDIAN') - func(format.be_channels, format.be_swizzles) - print('#else') - func(format.le_channels, format.le_swizzles) - print('#endif') + if (format.le_channels == format.be_channels and + [c.shift for c in format.le_channels] == + [c.shift for c in format.be_channels] and + format.le_swizzles == format.be_swizzles): + func(format.le_channels, format.le_swizzles) + else: + print('#ifdef PIPE_ARCH_BIG_ENDIAN') + func(format.be_channels, format.be_swizzles) + print('#else') + func(format.le_channels, format.le_swizzles) + print('#endif') def generate_format_type(format): '''Generate a structure that describes the format.''' |