Mesa (master): util: Expose rgba unpack/fetch functions as external functions as well.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 20 05:19:53 UTC 2020


Module: Mesa
Branch: master
Commit: edf0aeb3cd264a431cd9d6bf7a758fe37bfbef04
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=edf0aeb3cd264a431cd9d6bf7a758fe37bfbef04

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Aug 13 13:10:04 2020 -0700

util: Expose rgba unpack/fetch functions as external functions as well.

Like we just did for pack functions for freedreno, it will be useful to be
able to pick out a specific rgba unpack function instead of going through
the table.

Reviewed-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6307>

---

 src/util/format/u_format_pack.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/util/format/u_format_pack.py b/src/util/format/u_format_pack.py
index 7792f44ffde..d6554bbf973 100644
--- a/src/util/format/u_format_pack.py
+++ b/src/util/format/u_format_pack.py
@@ -628,8 +628,11 @@ def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
     else:
         dst_proto_type = 'void'
 
-    print('static inline void')
-    print('util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_proto_type))
+    proto = 'util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_proto_type)
+    print('void %s;' % proto, file=sys.stdout2)
+
+    print('void')
+    print(proto)
     print('{')
 
     if is_format_supported(format):
@@ -688,8 +691,13 @@ def generate_format_fetch(format, dst_channel, dst_native_type):
 
     name = format.short_name()
 
-    print('static inline void')
-    print('util_format_%s_fetch_rgba(void *in_dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name))
+    proto = 'util_format_%s_fetch_rgba(void *in_dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name)
+
+    print('void %s;' % proto, file=sys.stdout2)
+
+    print('void')
+    print(proto)
+
     print('{')
     print('   %s *dst = in_dst;' % dst_native_type)
 



More information about the mesa-commit mailing list