Mesa (master): dispatch: properly handle parameter name mismatches in glapitemp.h.

Paul Berry stereotype441 at kemper.freedesktop.org
Thu Nov 1 20:59:26 UTC 2012


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Tue Oct 30 08:45:29 2012 -0700

dispatch: properly handle parameter name mismatches in glapitemp.h.

Previously, when code-generating aliased functions in glapitemp.h, we
weren't consistent about which function alias we used to obtain the
parameter names, with the risk that we would generate incorrect code
like this:

  KEYWORD1 void KEYWORD2 NAME(Foo)(GLint x)
  {
    (void) x;
    DISPATCH(Foo, (x), (F, "glFoo(%d);\n", x));
  }
  KEYWORD1 void KEYWORD2 NAME(FooEXT)(GLint y)
  {
    (void) x;
    DISPATCH(Foo, (x), (F, "glFooEXT(%d);\n", x));
  }

At the moment there are no aliased functions with mismatched parameter
names, so this isn't the problem.  But when we introduce GLES1
functions into the dispatch table, there will be
(MapBufferRange/MapBufferRangeEXT).  This patch paves the way for that
by fixing the code generation script to handle the mismatch correctly.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>

---

 src/mapi/glapi/gen/gl_XML.py     |    7 +++++--
 src/mapi/glapi/gen/gl_apitemp.py |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index ef7ed51..0196879 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -757,8 +757,11 @@ class gl_function( gl_item ):
         return self.images
 
 
-    def parameterIterator(self):
-        return self.parameters.__iter__();
+    def parameterIterator(self, name = None):
+        if name is not None:
+            return self.entry_point_parameters[name].__iter__();
+        else:
+            return self.parameters.__iter__();
 
 
     def get_parameter_string(self, entrypoint = None):
diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
index c9a6e29..4157032 100644
--- a/src/mapi/glapi/gen/gl_apitemp.py
+++ b/src/mapi/glapi/gen/gl_apitemp.py
@@ -66,7 +66,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
 
         silence = ''
         space = ''
-        for p in f.parameterIterator():
+        for p in f.parameterIterator(name):
             if p.is_padding:
                 continue
 




More information about the mesa-commit mailing list