util: Make all 3 fetch_rgba functions occupy the same function slot.

A single format either had the float, the sint, or the uint version.
Making the dst be void * lets us store them in the same slot and not have
logic in the callers to call the right one.

-6kb on gallium drivers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6305>
This commit is contained in:
Eric Anholt
2020-08-13 09:15:16 -07:00
committed by Marge Bot
parent 80babbbf7e
commit 35b22b5da0
22 changed files with 103 additions and 108 deletions
+6 -5
View File
@@ -683,14 +683,15 @@ def generate_format_pack(format, src_channel, src_native_type, src_suffix):
print()
def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix):
def generate_format_fetch(format, dst_channel, dst_native_type):
'''Generate the function to unpack pixels from a particular format'''
name = format.short_name()
print('static inline void')
print('util_format_%s_fetch_%s(%s *dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name, dst_suffix, dst_native_type))
print('util_format_%s_fetch_rgba(void *in_dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name))
print('{')
print(' %s *dst = in_dst;' % dst_native_type)
if is_format_supported(format):
generate_unpack_kernel(format, dst_channel, dst_native_type)
@@ -729,7 +730,7 @@ def generate(formats):
generate_format_unpack(format, channel, native_type, suffix)
generate_format_pack(format, channel, native_type, suffix)
generate_format_fetch(format, channel, native_type, suffix)
generate_format_fetch(format, channel, native_type)
channel = Channel(SIGNED, False, True, 32)
native_type = 'int'
@@ -742,7 +743,7 @@ def generate(formats):
generate_format_unpack(format, channel, native_type, suffix)
generate_format_pack(format, channel, native_type, suffix)
generate_format_fetch(format, channel, native_type, suffix)
generate_format_fetch(format, channel, native_type)
native_type = 'unsigned'
suffix = 'unsigned'
@@ -755,7 +756,7 @@ def generate(formats):
generate_format_unpack(format, channel, native_type, suffix)
generate_format_pack(format, channel, native_type, suffix)
generate_format_fetch(format, channel, native_type, suffix)
generate_format_fetch(format, channel, native_type)
channel = Channel(UNSIGNED, True, False, 8)
native_type = 'uint8_t'