[PATCH 3/8] glx: Convert non-generated function pointer thunking

Adam Jackson ajax at redhat.com
Tue Dec 3 12:14:11 PST 2013


Same concept as the generated code conversion.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/indirect_program.c | 34 ++++++++++++++++++++++++----------
 glx/render2.c          | 12 ++++++++++--
 glx/render2swap.c      | 12 ++++++++++--
 3 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/glx/indirect_program.c b/glx/indirect_program.c
index db22d84..fa4a240 100644
--- a/glx/indirect_program.c
+++ b/glx/indirect_program.c
@@ -104,29 +104,43 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
 int
 __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
-    return DoGetProgramString(cl, pc, glGetProgramivARB,
-                              glGetProgramStringARB, False);
+    PFNGLGETPROGRAMIVARBPROC get_program =
+        __glGetProcAddress("glGetProgramivARB");
+    PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
+        __glGetProcAddress("glGetProgramStringARB");
+
+    return DoGetProgramString(cl, pc, get_program, get_program_string, False);
 }
 
 int
 __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
-    return DoGetProgramString(cl, pc, glGetProgramivARB,
-                              glGetProgramStringARB, True);
+    PFNGLGETPROGRAMIVARBPROC get_program =
+        __glGetProcAddress("glGetProgramivARB");
+    PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
+        __glGetProcAddress("glGetProgramStringARB");
+
+    return DoGetProgramString(cl, pc, get_program, get_program_string, True);
 }
 
 int
 __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
-    return DoGetProgramString(cl, pc, (PFNGLGETPROGRAMIVARBPROC)glGetProgramivNV,
-                              (PFNGLGETPROGRAMSTRINGARBPROC)glGetProgramStringNV,
-                              False);
+    PFNGLGETPROGRAMIVARBPROC get_program =
+        __glGetProcAddress("glGetProgramivARB");
+    PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
+        __glGetProcAddress("glGetProgramStringARB");
+
+    return DoGetProgramString(cl, pc, get_program, get_program_string, False);
 }
 
 int
 __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
-    return DoGetProgramString(cl, pc, (PFNGLGETPROGRAMIVARBPROC)glGetProgramivNV,
-                              (PFNGLGETPROGRAMSTRINGARBPROC)glGetProgramStringNV,
-                              True);
+    PFNGLGETPROGRAMIVARBPROC get_program =
+        __glGetProcAddress("glGetProgramivARB");
+    PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
+        __glGetProcAddress("glGetProgramStringARB");
+
+    return DoGetProgramString(cl, pc, get_program, get_program_string, True);
 }
diff --git a/glx/render2.c b/glx/render2.c
index 5a2f482..8d9b5f4 100644
--- a/glx/render2.c
+++ b/glx/render2.c
@@ -231,13 +231,21 @@ __glXDisp_DrawArrays(GLbyte * pc)
             glEdgeFlagPointer(stride, (const GLboolean *) pc);
             break;
         case GL_SECONDARY_COLOR_ARRAY:
+        {
+            PFNGLSECONDARYCOLORPOINTERPROC SecondaryColorPointerEXT =
+                __glGetProcAddress("glSecondaryColorPointerEXT");
             glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
-            glSecondaryColorPointerEXT(numVals, datatype, stride, pc);
+            SecondaryColorPointerEXT(numVals, datatype, stride, pc);
             break;
+        }
         case GL_FOG_COORD_ARRAY:
+        {
+            PFNGLFOGCOORDPOINTERPROC FogCoordPointerEXT =
+                __glGetProcAddress("glFogCoordPointerEXT");
             glEnableClientState(GL_FOG_COORD_ARRAY);
-            glFogCoordPointerEXT(datatype, stride, pc);
+            FogCoordPointerEXT(datatype, stride, pc);
             break;
+        }
         default:
             break;
         }
diff --git a/glx/render2swap.c b/glx/render2swap.c
index e6f73b8..6ed364f 100644
--- a/glx/render2swap.c
+++ b/glx/render2swap.c
@@ -353,13 +353,21 @@ __glXDispSwap_DrawArrays(GLbyte * pc)
             glEdgeFlagPointer(stride, (const GLboolean *) pc);
             break;
         case GL_SECONDARY_COLOR_ARRAY:
+        {
+            PFNGLSECONDARYCOLORPOINTERPROC SecondaryColorPointerEXT =
+                __glGetProcAddress("glSecondaryColorPointerEXT");
             glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
-            glSecondaryColorPointerEXT(numVals, datatype, stride, pc);
+            SecondaryColorPointerEXT(numVals, datatype, stride, pc);
             break;
+        }
         case GL_FOG_COORD_ARRAY:
+        {
+            PFNGLFOGCOORDPOINTERPROC FogCoordPointerEXT =
+                __glGetProcAddress("glFogCoordPointerEXT");
             glEnableClientState(GL_FOG_COORD_ARRAY);
-            glFogCoordPointerEXT(datatype, stride, pc);
+            FogCoordPointerEXT(datatype, stride, pc);
             break;
+        }
         default:
             break;
         }
-- 
1.8.4.2



More information about the xorg-devel mailing list