glapi/glx: Thunk non-ABI calls through GetProcAddress
authorAdam Jackson <ajax@redhat.com>
Thu, 24 Mar 2016 17:57:57 +0000 (13:57 -0400)
committerAdam Jackson <ajax@redhat.com>
Mon, 28 Mar 2016 18:37:12 +0000 (14:37 -0400)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
src/mapi/glapi/gen/glX_proto_recv.py

index 916da94468930c058bb27393db3613f02c17a3e3..1cfa8c5c142cf749cfd377c130fe6d7189da853e 100644 (file)
@@ -117,6 +117,9 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
         return
 
+    def fptrType(self, name):
+       fptr = "pfngl" + name + "proc"
+       return fptr.upper()
 
     def printFunction(self, f, name):
         if (f.glx_sop or f.glx_vendorpriv) and (len(f.get_images()) != 0):
@@ -134,6 +137,9 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
         print '{'
 
+        if not f.is_abi():
+            print '    %s %s = __glGetProcAddress("gl%s");' % (self.fptrType(name), name, name)
+
         if f.glx_rop or f.vectorequiv:
             self.printRenderFunction(f)
         elif f.glx_sop or f.glx_vendorpriv:
@@ -218,6 +224,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
     def emit_function_call(self, f, retval_assign, indent):
         list = []
+        prefix = "gl" if f.is_abi() else ""
 
         for param in f.parameterIterator():
             if param.is_padding:
@@ -230,8 +237,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
             list.append( '%s        %s' % (indent, location) )
 
-
-        print '%s    %sgl%s(%s);' % (indent, retval_assign, f.name, string.join(list, ',\n'))
+        print '%s    %s%s%s(%s);' % (indent, retval_assign, prefix, f.name, string.join(list, ',\n'))
 
 
     def common_func_print_just_start(self, f, indent):