[PATCH 3/5] glx: Consistently use ARB-suffixed names for ARB_multitexture functions

Jon TURNEY jon.turney at dronecode.org.uk
Tue Apr 1 06:32:30 PDT 2014


On 18/12/2013 14:52, Jon TURNEY wrote:
> On 17/12/2013 01:35, Ian Romanick wrote:
>> On 12/08/2013 08:57 AM, Jon TURNEY wrote:
>>> At the moment we have a mix of ARB and non-ARB suffixed forms for ARB_multitexture functions
>>> e.g. glMultiTexCoord1fvARB and glMultiTexCoord1dv
>>>
>>> Consistently use the ARB-suffixed form, assuming that is present in all libGL
>>> which provide the OpenGL 1.2.1 ABI we expect to be able to directly link with.
>>
>> I'm assuming the patch to glX_proto_recv.py is just stuck in your
>> outbox?  Both those files clearly say:
>>
>> /* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */
> 
> This depends on Ajax's code generator changes from [1], for the current code
> in X server, which I don't think have landed yet.
> 
> [1] http://cgit.freedesktop.org/~ajax/mesa/log/?h=glapi
> 
> I think Ajax said he would try to update them to include this change before
> doing so.
> 
> I'm quite happy to do that work, but I haven't looked at it yet as I don't
> want to duplicate effort.

I think this still hasn't landed in mesa.  While investigating a different
issue, I wanted to re-run the generator, so attached is a patch to ensure
direct calls are made to functions in the OpenGL ABI, bringing the generator
into sync with this change.

(Note that there is still an inconsistency in Mesa's XML: commit 1a1db174
"mesa: Standardize names of OpenGL functions" articulates a policy of
standardizing on the non-suffixed version of the name (if one exists), and
follows it for MultiTexCoord[1234][dis](|v), but not for MultiTexCoord[1234]f(|v).

Assuming that is an oversight and not deliberate, I also wrote a patch to
correct that, but that turns out not to be necessary to fix this issue.)

-------------- next part --------------
>From 38ebd682fe928c053576b6b1123d2fc017185415 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Mon, 31 Mar 2014 19:44:17 +0100
Subject: [PATCH mesa/mesa] glapi/glx: Direct GL calls use OpenGL 1.2.1 ABI

Adjust X server code generator so direct GL calls are emitted using a name which
is in the OpenGL 1.2.1 ABI (OpenGL 1.2 + GL_ARB_multitexture)

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 src/mapi/glapi/gen/glX_proto_recv.py | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_proto_recv.py b/src/mapi/glapi/gen/glX_proto_recv.py
index 86cc8fd..93287be 100644
--- a/src/mapi/glapi/gen/glX_proto_recv.py
+++ b/src/mapi/glapi/gen/glX_proto_recv.py
@@ -222,7 +222,30 @@ 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 ""
+
+        if f.is_abi():
+            prefix = "gl"
+            name = None
+
+            # We should emit a direct function call to a name which is in the
+            # OpenGL 1.2.1 ABI (= OpenGL 1.2 + GL_ARB_multitexture)
+            for ent in f.entry_points:
+                [cat_name, cat_number] = api.category_dict[ent]
+                [cat_type, cat_key] = gl_XML.classify_category(cat_name, cat_number)
+                if cat_type == 0 and float(cat_name) <= 1.2:
+                    name = ent
+                    break
+                if cat_type == 1 and cat_name == 'GL_ARB_multitexture':
+                    name = ent
+                    break
+
+            # If we couldn't find one, something is wrong
+            if name == None:
+                raise RuntimeError('Direct call to non-ABI function "%s".' % (f.name))
+
+        else:
+            prefix = ""
+            name = f.name
 
         for param in f.parameterIterator():
             if param.is_padding:
@@ -235,7 +258,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
             list.append( '%s        %s' % (indent, location) )
 
-        print '%s    %s%s%s(%s);' % (indent, retval_assign, prefix, f.name, string.join(list, ',\n'))
+        print '%s    %s%s%s(%s);' % (indent, retval_assign, prefix, name, string.join(list, ',\n'))
 
 
     def common_func_print_just_start(self, f, indent):
-- 
1.8.3.4



More information about the xorg-devel mailing list