[Mesa-dev] [PATCH 20/26] mesa: Add support for asynchronous glDraw* on GL core.

Marek Olšák maraeo at gmail.com
Wed Feb 8 18:03:34 UTC 2017


From: Eric Anholt <eric at anholt.net>

---
 src/mapi/glapi/gen/gl_marshal.py  | 4 ++++
 src/mapi/glapi/gen/marshal_XML.py | 9 ++-------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index 3b9868f..1a63343 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -237,20 +237,24 @@ class PrintCode(gl_XML.gl_print_base):
             self.validate_count_or_return(func)
 
             out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {')
             with indent():
                 self.print_async_dispatch(func)
             out('} else {')
             with indent():
                 self.print_sync_dispatch(func)
             out('}')
 
+            if func.marshal == 'draw':
+                out('/* We relied on all vertex and index data being in VBOs */')
+                out('assert(ctx->API == API_OPENGL_CORE);')
+
         out('}')
 
     def print_async_body(self, func):
         out('/* {0}: marshalled asynchronously */'.format(func.name))
         self.print_async_struct(func)
         self.print_async_unmarshal(func)
         self.print_async_marshal(func)
         out('')
         out('')
 
diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py
index 9d5688d..d56e4dd 100644
--- a/src/mapi/glapi/gen/marshal_XML.py
+++ b/src/mapi/glapi/gen/marshal_XML.py
@@ -57,35 +57,30 @@ class marshal_function(gl_XML.gl_function):
                 self.fixed_params.append(p)
 
         # Store the "marshal" attribute, if present.
         self.marshal = element.get('marshal')
 
     def marshal_flavor(self):
         """Find out how this function should be marshalled between
         client and server threads."""
         # If a "marshal" attribute was present, that overrides any
         # determination that would otherwise be made by this function.
-        if self.marshal != None:
-            if self.marshal == 'draw':
-                # TODO: as a temporary measure, do draw functions
-                # synchronously, since they may access client memory
-                # via vertex attribute pointers.
-                return 'sync'
+        if self.marshal not in (None, 'draw'):
             return self.marshal
 
         if self.exec_flavor == 'skip':
             # Functions marked exec="skip" are not yet implemented in
             # Mesa, so don't bother trying to marshal them.
             return 'skip'
 
         if self.return_type != 'void':
             return 'sync'
         for p in self.parameters:
             if p.is_output:
                 return 'sync'
-            if p.is_pointer() and not (p.count or p.counter):
+            if p.is_pointer() and not (p.count or p.counter) and not (self.marshal == 'draw' and p.name == 'indices'):
                 return 'sync'
             if p.count_parameter_list:
                 # Parameter size is determined by enums; haven't
                 # written logic to handle this yet.  TODO: fix.
                 return 'sync'
         return 'async'
-- 
2.7.4



More information about the mesa-dev mailing list