glthread: don't generate the sync fallback if the call size is not variable
authorMarek Olšák <marek.olsak@amd.com>
Wed, 19 Feb 2020 03:57:28 +0000 (22:57 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 6 Mar 2020 01:06:13 +0000 (01:06 +0000)
marshal_generated.c is 12% smaller.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>

src/mapi/glapi/gen/gl_marshal.py

index 4fd2bc2a5b9143dee0b0f00d31cc0b1d8b2955f7..a994a1425bc1a19308eb9860323917020f808a2f 100644 (file)
@@ -254,19 +254,23 @@ class PrintCode(gl_XML.gl_print_base):
                     out('return;')
                 out('}')
 
-            out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {')
+        if len(func.variable_params) > 0:
+            with indent():
+                out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {')
+                with indent():
+                    self.print_async_dispatch(func)
+                    out('return;')
+                out('}')
+            out('')
+            if need_fallback_sync:
+                out('fallback_to_sync:')
+            with indent():
+                out('_mesa_glthread_finish(ctx);')
+                self.print_sync_dispatch(func)
+        else:
             with indent():
                 self.print_async_dispatch(func)
-                out('return;')
-            out('}')
-
-        out('')
-        if need_fallback_sync:
-            out('fallback_to_sync:')
-        with indent():
-            out('_mesa_glthread_finish(ctx);')
-            self.print_sync_dispatch(func)
-
+                assert not need_fallback_sync
         out('}')
 
     def print_async_body(self, func):