Module: Mesa
Branch: main
Commit: 64b769a1027a224808ce46aa8e1d82a19186acce
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=64b769a1027a224808ce46aa8e1d82a19186acce

Author: Marek Olšák <[email protected]>
Date:   Fri Dec  1 02:25:21 2023 -0500

glthread: add a string table of function names

for printing glthread batches

Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26548>

---

 src/mapi/glapi/gen/gl_unmarshal_table.py | 13 +++++++++++--
 src/mesa/main/glthread_marshal.h         |  1 +
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_unmarshal_table.py 
b/src/mapi/glapi/gen/gl_unmarshal_table.py
index 06003a9bf6b..1cd04a6d834 100644
--- a/src/mapi/glapi/gen/gl_unmarshal_table.py
+++ b/src/mapi/glapi/gen/gl_unmarshal_table.py
@@ -65,12 +65,21 @@ class PrintCode(gl_XML.gl_print_base):
         out('const _mesa_unmarshal_func 
_mesa_unmarshal_dispatch[NUM_DISPATCH_CMD] = {')
         with indent():
             for func in api.functionIterateAll():
-                flavor = func.marshal_flavor()
-                if flavor in ('skip', 'sync'):
+                if func.marshal_flavor() in ('skip', 'sync'):
                     continue
                 out('[DISPATCH_CMD_{0}] = 
(_mesa_unmarshal_func)_mesa_unmarshal_{0},'.format(func.name))
         out('};')
 
+        # Print the string table of function names.
+        out('')
+        out('const char *_mesa_unmarshal_func_name[NUM_DISPATCH_CMD] = {')
+        with indent():
+            for func in api.functionIterateAll():
+                if func.marshal_flavor() in ('skip', 'sync'):
+                    continue
+                out('[DISPATCH_CMD_{0}] = "{0}",'.format(func.name))
+        out('};')
+
 
 def show_usage():
     print('Usage: %s [file_name]' % sys.argv[0])
diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h
index 3560754d39d..95f846548bb 100644
--- a/src/mesa/main/glthread_marshal.h
+++ b/src/mesa/main/glthread_marshal.h
@@ -54,6 +54,7 @@ struct marshal_cmd_base
 typedef uint32_t (*_mesa_unmarshal_func)(struct gl_context *ctx,
                                          const void *restrict cmd);
 extern const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD];
+extern const char *_mesa_unmarshal_func_name[NUM_DISPATCH_CMD];
 
 struct marshal_cmd_DrawElementsUserBuf
 {

Reply via email to