Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / glx / x11 / indirect.c
index 80b6011bdd61f26b6a19cf94acf17a4e3a390deb..ae426c22a474bf0e179beef904157f44da5b5ff1 100644 (file)
@@ -30,6 +30,9 @@
 #include "indirect.h"
 #include "glxclient.h"
 #include "indirect_size.h"
+#include "dispatch.h"
+#include "glapi.h"
+#include "glthread.h"
 #include <GL/glxproto.h>
 #ifdef USE_XCB
 #include <X11/Xlib-xcb.h>
@@ -297,7 +300,9 @@ __indirect_glNewList(GLuint list, GLenum mode)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -321,7 +326,9 @@ __indirect_glEndList(void)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 0;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -357,6 +364,10 @@ __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint compsize = __glCallLists_size(type);
     const GLuint cmdlen = 12 + __GLX_PAD((compsize * n));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
         if (cmdlen <= gc->maxSmallRenderCommandSize) {
             if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -390,7 +401,9 @@ __indirect_glDeleteLists(GLuint list, GLsizei range)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -415,7 +428,9 @@ __indirect_glGenLists(GLsizei range)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     GLuint retval = (GLuint) 0;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -471,7 +486,7 @@ __indirect_glBegin(GLenum mode)
 void
 __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
                     GLfloat yorig, GLfloat xmove, GLfloat ymove,
-                    const GLubyte * bitmap)
+                    const GLubyte *bitmap)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint compsize =
@@ -538,7 +553,7 @@ __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
 
 #define X_GLrop_Color3bv 6
 void
-__indirect_glColor3bv(const GLbyte * v)
+__indirect_glColor3bv(const GLbyte *v)
 {
     generic_3_byte(X_GLrop_Color3bv, v);
 }
@@ -653,7 +668,7 @@ __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
 
 #define X_GLrop_Color3ubv 11
 void
-__indirect_glColor3ubv(const GLubyte * v)
+__indirect_glColor3ubv(const GLubyte *v)
 {
     generic_3_byte(X_GLrop_Color3ubv, v);
 }
@@ -723,7 +738,7 @@ __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
 
 #define X_GLrop_Color4bv 14
 void
-__indirect_glColor4bv(const GLbyte * v)
+__indirect_glColor4bv(const GLbyte *v)
 {
     generic_4_byte(X_GLrop_Color4bv, v);
 }
@@ -844,7 +859,7 @@ __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
 
 #define X_GLrop_Color4ubv 19
 void
-__indirect_glColor4ubv(const GLubyte * v)
+__indirect_glColor4ubv(const GLubyte *v)
 {
     generic_4_byte(X_GLrop_Color4ubv, v);
 }
@@ -1048,7 +1063,7 @@ __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
 
 #define X_GLrop_Normal3bv 28
 void
-__indirect_glNormal3bv(const GLbyte * v)
+__indirect_glNormal3bv(const GLbyte *v)
 {
     generic_3_byte(X_GLrop_Normal3bv, v);
 }
@@ -2581,7 +2596,7 @@ __indirect_glPolygonMode(GLenum face, GLenum mode)
 
 #define X_GLrop_PolygonStipple 102
 void
-__indirect_glPolygonStipple(const GLubyte * mask)
+__indirect_glPolygonStipple(const GLubyte *mask)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint compsize =
@@ -3579,6 +3594,10 @@ __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
+    if (mapsize < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
         if (cmdlen <= gc->maxSmallRenderCommandSize) {
             if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3612,6 +3631,10 @@ __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
+    if (mapsize < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
         if (cmdlen <= gc->maxSmallRenderCommandSize) {
             if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3645,6 +3668,10 @@ __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 2));
+    if (mapsize < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((mapsize >= 0) && (gc->currentDpy != NULL), 1)) {
         if (cmdlen <= gc->maxSmallRenderCommandSize) {
             if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3713,7 +3740,9 @@ __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
     __GLXcontext *const gc = __glXGetCurrentContext();
     const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 28;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3805,7 +3834,9 @@ __indirect_glGetClipPlane(GLenum plane, GLdouble * equation)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3838,7 +3869,9 @@ __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3876,7 +3909,9 @@ __indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3914,7 +3949,9 @@ __indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3950,7 +3987,9 @@ __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -3986,7 +4025,9 @@ __indirect_glGetMapiv(GLenum target, GLenum query, GLint * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4022,7 +4063,9 @@ __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4060,7 +4103,9 @@ __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4098,7 +4143,9 @@ __indirect_glGetPixelMapfv(GLenum map, GLfloat * values)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4134,7 +4181,9 @@ __indirect_glGetPixelMapuiv(GLenum map, GLuint * values)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4171,7 +4220,9 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4204,12 +4255,13 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values)
 
 #define X_GLsop_GetPolygonStipple 128
 void
-__indirect_glGetPolygonStipple(GLubyte * mask)
+__indirect_glGetPolygonStipple(GLubyte *mask)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4244,7 +4296,9 @@ __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4282,7 +4336,9 @@ __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4320,7 +4376,9 @@ __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4358,7 +4416,9 @@ __indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4396,7 +4456,9 @@ __indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4436,7 +4498,9 @@ __indirect_glGetTexImage(GLenum target, GLint level, GLenum format,
     __GLXcontext *const gc = __glXGetCurrentContext();
     const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 20;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4480,7 +4544,9 @@ __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4519,7 +4585,9 @@ __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4559,7 +4627,9 @@ __indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 12;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4600,7 +4670,9 @@ __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 12;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4641,7 +4713,9 @@ __indirect_glIsList(GLuint list)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -4974,7 +5048,7 @@ __indirect_glIndexub(GLubyte c)
 
 #define X_GLrop_Indexubv 194
 void
-__indirect_glIndexubv(const GLubyte * c)
+__indirect_glIndexubv(const GLubyte *c)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 8;
@@ -5001,42 +5075,6 @@ __indirect_glPolygonOffset(GLfloat factor, GLfloat units)
     }
 }
 
-#define X_GLsop_AreTexturesResident 143
-GLboolean
-__indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,
-                                 GLboolean * residences)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-#ifdef USE_XCB
-        xcb_connection_t *c = XGetXCBConnection(dpy);
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-        xcb_glx_are_textures_resident_reply_t *reply =
-            xcb_glx_are_textures_resident_reply(c,
-                                                xcb_glx_are_textures_resident
-                                                (c, gc->currentContextTag, n,
-                                                 textures), NULL);
-        (void) memcpy(residences, xcb_glx_are_textures_resident_data(reply),
-                      xcb_glx_are_textures_resident_data_length(reply) *
-                      sizeof(GLboolean));
-        retval = reply->ret_val;
-        free(reply);
-#else
-        GLubyte const *pc =
-            __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
-        retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-#endif /* USE_XCB */
-    }
-    return retval;
-}
-
 #define X_GLrop_CopyTexImage1D 4119
 void
 __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
@@ -5124,32 +5162,78 @@ __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
     }
 }
 
-#define X_GLvop_DeleteTextures 12
+#define X_GLsop_DeleteTextures 144
 void
 __indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+#ifdef USE_XCB
+        xcb_connection_t *c = XGetXCBConnection(dpy);
+        (void) __glXFlushRenderBuffer(gc, gc->pc);
+        xcb_glx_delete_textures(c, gc->currentContextTag, n, textures);
+#else
         GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
-                                    X_GLvop_DeleteTextures, cmdlen);
+            __glXSetupSingleRequest(gc, X_GLsop_DeleteTextures, cmdlen);
         (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
         (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
         UnlockDisplay(dpy);
         SyncHandle();
+#endif /* USE_XCB */
     }
     return;
 }
 
+#define X_GLvop_DeleteTexturesEXT 12
+void
+glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+        if (n < 0) {
+            __glXSetError(gc, GL_INVALID_VALUE);
+            return;
+        }
+        if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
+                                        X_GLvop_DeleteTexturesEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GenTextures 145
 void
 __indirect_glGenTextures(GLsizei n, GLuint * textures)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5176,6 +5260,35 @@ __indirect_glGenTextures(GLsizei n, GLuint * textures)
     return;
 }
 
+#define X_GLvop_GenTexturesEXT 13
+void
+glGenTexturesEXT(GLsizei n, GLuint * textures)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GenTextures(GET_DISPATCH(), (n, textures));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 4;
+        if (n < 0) {
+            __glXSetError(gc, GL_INVALID_VALUE);
+            return;
+        }
+        if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GenTexturesEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
+            (void) __glXReadReply(dpy, 4, textures, GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_IsTexture 146
 GLboolean
 __indirect_glIsTexture(GLuint texture)
@@ -5183,7 +5296,9 @@ __indirect_glIsTexture(GLuint texture)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5207,6 +5322,32 @@ __indirect_glIsTexture(GLuint texture)
     return retval;
 }
 
+#define X_GLvop_IsTextureEXT 14
+GLboolean
+glIsTextureEXT(GLuint texture)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        return CALL_IsTexture(GET_DISPATCH(), (texture));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        GLboolean retval = (GLboolean) 0;
+        const GLuint cmdlen = 4;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_IsTextureEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&texture), 4);
+            retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return retval;
+    }
+}
+
 #define X_GLrop_PrioritizeTextures 4118
 void
 __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
@@ -5214,6 +5355,10 @@ __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 8 + __GLX_PAD((n * 4)) + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -5451,7 +5596,9 @@ __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type,
     __GLXcontext *const gc = __glXGetCurrentContext();
     const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 16;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5489,6 +5636,37 @@ __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type,
     return;
 }
 
+#define X_GLvop_GetColorTableSGI 4098
+void
+glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetColorTableSGI, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, table,
+                                GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetColorTableParameterfv 148
 void
 __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname,
@@ -5496,7 +5674,9 @@ __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5529,6 +5709,34 @@ __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetColorTableParameterfvSGI 4099
+void
+glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetColorTableParameterfv(GET_DISPATCH(),
+                                      (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetColorTableParameterfvSGI,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetColorTableParameteriv 149
 void
 __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname,
@@ -5536,7 +5744,9 @@ __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5569,6 +5779,34 @@ __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetColorTableParameterivSGI 4100
+void
+glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetColorTableParameteriv(GET_DISPATCH(),
+                                      (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetColorTableParameterivSGI,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLrop_ColorSubTable 195
 void
 __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count,
@@ -5828,7 +6066,9 @@ __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
     __GLXcontext *const gc = __glXGetCurrentContext();
     const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 16;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5861,6 +6101,40 @@ __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
     return;
 }
 
+#define X_GLvop_GetConvolutionFilterEXT 1
+void
+gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
+                     GLvoid * image)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetConvolutionFilter(GET_DISPATCH(),
+                                  (target, format, type, image));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetConvolutionFilterEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            __glXReadPixelReply(dpy, gc, 2, 0, 0, 0, format, type, image,
+                                GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetConvolutionParameterfv 151
 void
 __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname,
@@ -5868,7 +6142,9 @@ __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5901,6 +6177,34 @@ __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetConvolutionParameterfvEXT 2
+void
+gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetConvolutionParameterfv(GET_DISPATCH(),
+                                       (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetConvolutionParameterfvEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetConvolutionParameteriv 152
 void
 __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname,
@@ -5908,7 +6212,9 @@ __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5941,6 +6247,34 @@ __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetConvolutionParameterivEXT 3
+void
+gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetConvolutionParameteriv(GET_DISPATCH(),
+                                       (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetConvolutionParameterivEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetHistogram 154
 void
 __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
@@ -5949,7 +6283,9 @@ __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
     __GLXcontext *const gc = __glXGetCurrentContext();
     const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 16;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -5987,6 +6323,40 @@ __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
     return;
 }
 
+#define X_GLvop_GetHistogramEXT 5
+void
+gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
+                     GLenum type, GLvoid * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetHistogram(GET_DISPATCH(),
+                          (target, reset, format, type, values));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetHistogramEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            *(int8_t *) (pc + 13) = reset;
+            __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, values,
+                                GL_TRUE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetHistogramParameterfv 155
 void
 __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname,
@@ -5994,7 +6364,9 @@ __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6026,6 +6398,33 @@ __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetHistogramParameterfvEXT 6
+void
+gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetHistogramParameterfvEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetHistogramParameteriv 156
 void
 __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname,
@@ -6033,7 +6432,9 @@ __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6065,6 +6466,33 @@ __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetHistogramParameterivEXT 7
+void
+gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetHistogramParameterivEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetMinmax 157
 void
 __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format,
@@ -6073,7 +6501,9 @@ __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format,
     __GLXcontext *const gc = __glXGetCurrentContext();
     const __GLXattribute *const state = gc->client_state_private;
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 16;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6107,6 +6537,39 @@ __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format,
     return;
 }
 
+#define X_GLvop_GetMinmaxEXT 8
+void
+gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
+                     GLenum type, GLvoid * values)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        const __GLXattribute *const state = gc->client_state_private;
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 16;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetMinmaxEXT, cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+            (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+            *(int32_t *) (pc + 12) = 0;
+            *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+            *(int8_t *) (pc + 13) = reset;
+            __glXReadPixelReply(dpy, gc, 1, 2, 1, 1, format, type, values,
+                                GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetMinmaxParameterfv 158
 void
 __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname,
@@ -6114,7 +6577,9 @@ __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6144,13 +6609,42 @@ __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname,
     return;
 }
 
+#define X_GLvop_GetMinmaxParameterfvEXT 9
+void
+gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetMinmaxParameterfvEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLsop_GetMinmaxParameteriv 159
 void
 __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -6180,6 +6674,33 @@ __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params)
     return;
 }
 
+#define X_GLvop_GetMinmaxParameterivEXT 10
+void
+gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
+{
+    __GLXcontext *const gc = __glXGetCurrentContext();
+
+    if (gc->driContext) {
+        CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
+    } else {
+        __GLXcontext *const gc = __glXGetCurrentContext();
+        Display *const dpy = gc->currentDpy;
+        const GLuint cmdlen = 8;
+        if (__builtin_expect(dpy != NULL, 1)) {
+            GLubyte const *pc =
+                __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+                                        X_GLvop_GetMinmaxParameterivEXT,
+                                        cmdlen);
+            (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+            (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
+            (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+            UnlockDisplay(dpy);
+            SyncHandle();
+        }
+        return;
+    }
+}
+
 #define X_GLrop_Histogram 4110
 void
 __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat,
@@ -7002,26 +7523,6 @@ __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params)
     return;
 }
 
-#define X_GLrop_ProgramEnvParameter4dvARB 4185
-void
-__indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x,
-                                      GLdouble y, GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
 #define X_GLrop_ProgramEnvParameter4dvARB 4185
 void
 __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
@@ -7039,26 +7540,6 @@ __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
     }
 }
 
-#define X_GLrop_ProgramEnvParameter4fvARB 4184
-void
-__indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x,
-                                      GLfloat y, GLfloat z, GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
 #define X_GLrop_ProgramEnvParameter4fvARB 4184
 void
 __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index,
@@ -7159,6 +7640,10 @@ __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 16 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((len >= 0) && (gc->currentDpy != NULL), 1)) {
         if (cmdlen <= gc->maxSmallRenderCommandSize) {
             if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -7469,7 +7954,7 @@ __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v)
 
 #define X_GLrop_VertexAttrib4NbvARB 4235
 void
-__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v)
+__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte *v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12;
@@ -7533,7 +8018,7 @@ __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y,
 
 #define X_GLrop_VertexAttrib4NubvARB 4201
 void
-__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v)
+__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte *v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12;
@@ -7578,7 +8063,7 @@ __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v)
 
 #define X_GLrop_VertexAttrib4bvARB 4230
 void
-__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte * v)
+__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte *v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12;
@@ -7710,7 +8195,7 @@ __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v)
 
 #define X_GLrop_VertexAttrib4ubvARB 4232
 void
-__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v)
+__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte *v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12;
@@ -7774,7 +8259,13 @@ __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -7812,7 +8303,13 @@ __indirect_glGenQueriesARB(GLsizei n, GLuint * ids)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -7845,7 +8342,9 @@ __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -7881,7 +8380,9 @@ __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -7917,7 +8418,9 @@ __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
+#ifndef USE_XCB
     const GLuint cmdlen = 8;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -7957,7 +8460,9 @@ __indirect_glIsQueryARB(GLuint id)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
+#ifndef USE_XCB
     const GLuint cmdlen = 4;
+#endif
     if (__builtin_expect(dpy != NULL, 1)) {
 #ifdef USE_XCB
         xcb_connection_t *c = XGetXCBConnection(dpy);
@@ -7988,6 +8493,10 @@ __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
         if (cmdlen <= gc->maxSmallRenderCommandSize) {
             if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -8012,137 +8521,6 @@ __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
     }
 }
 
-#define X_GLvop_GetColorTableParameterfvSGI 4099
-void
-__indirect_glGetColorTableParameterfvSGI(GLenum target, GLenum pname,
-                                         GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetColorTableParameterfvSGI,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetColorTableParameterivSGI 4100
-void
-__indirect_glGetColorTableParameterivSGI(GLenum target, GLenum pname,
-                                         GLint * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 8;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetColorTableParameterivSGI,
-                                    cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&pname), 4);
-        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_GetColorTableSGI 4098
-void
-__indirect_glGetColorTableSGI(GLenum target, GLenum format, GLenum type,
-                              GLvoid * table)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const __GLXattribute *const state = gc->client_state_private;
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 16;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GetColorTableSGI, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
-        (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
-        *(int32_t *) (pc + 12) = 0;
-        *(int8_t *) (pc + 12) = state->storePack.swapEndian;
-        __glXReadPixelReply(dpy, gc, 1, 0, 0, 0, format, type, table,
-                            GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_AreTexturesResidentEXT 11
-GLboolean
-__indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
-                                    GLboolean * residences)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_AreTexturesResidentEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
-        retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
-#define X_GLvop_GenTexturesEXT 13
-void
-__indirect_glGenTexturesEXT(GLsizei n, GLuint * textures)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    const GLuint cmdlen = 4;
-    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_GenTexturesEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&n), 4);
-        (void) __glXReadReply(dpy, 4, textures, GL_TRUE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return;
-}
-
-#define X_GLvop_IsTextureEXT 14
-GLboolean
-__indirect_glIsTextureEXT(GLuint texture)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    Display *const dpy = gc->currentDpy;
-    GLboolean retval = (GLboolean) 0;
-    const GLuint cmdlen = 4;
-    if (__builtin_expect(dpy != NULL, 1)) {
-        GLubyte const *pc =
-            __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
-                                    X_GLvop_IsTextureEXT, cmdlen);
-        (void) memcpy((void *) (pc + 0), (void *) (&texture), 4);
-        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
-        UnlockDisplay(dpy);
-        SyncHandle();
-    }
-    return retval;
-}
-
 #define X_GLrop_SampleMaskSGIS 2048
 void
 __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert)
@@ -8221,7 +8599,7 @@ __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue)
 
 #define X_GLrop_SecondaryColor3bvEXT 4126
 void
-__indirect_glSecondaryColor3bvEXT(const GLbyte * v)
+__indirect_glSecondaryColor3bvEXT(const GLbyte *v)
 {
     generic_3_byte(X_GLrop_SecondaryColor3bvEXT, v);
 }
@@ -8336,7 +8714,7 @@ __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue)
 
 #define X_GLrop_SecondaryColor3ubvEXT 4131
 void
-__indirect_glSecondaryColor3ubvEXT(const GLubyte * v)
+__indirect_glSecondaryColor3ubvEXT(const GLubyte *v)
 {
     generic_3_byte(X_GLrop_SecondaryColor3ubvEXT, v);
 }
@@ -8479,6 +8857,10 @@ __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids,
     Display *const dpy = gc->currentDpy;
     GLboolean retval = (GLboolean) 0;
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return 0;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -8514,6 +8896,10 @@ __indirect_glDeleteProgramsNV(GLsizei n, const GLuint * programs)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivate,
@@ -8550,6 +8936,10 @@ __indirect_glGenProgramsNV(GLsizei n, GLuint * programs)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -8608,7 +8998,7 @@ __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index,
 
 #define X_GLvop_GetProgramStringNV 1299
 void
-__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program)
+__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
@@ -8752,10 +9142,14 @@ __indirect_glIsProgramNV(GLuint program)
 #define X_GLrop_LoadProgramNV 4183
 void
 __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
-                           const GLubyte * program)
+                           const GLubyte *program)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 16 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(len >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_LoadProgramNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
@@ -8769,80 +9163,6 @@ __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
     }
 }
 
-#define X_GLrop_ProgramParameter4dvNV 4185
-void
-__indirect_glProgramParameter4dNV(GLenum target, GLuint index, GLdouble x,
-                                  GLdouble y, GLdouble z, GLdouble w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramParameter4dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
-    (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
-    (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramParameter4dvNV 4185
-void
-__indirect_glProgramParameter4dvNV(GLenum target, GLuint index,
-                                   const GLdouble * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 44;
-    emit_header(gc->pc, X_GLrop_ProgramParameter4dvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 32);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramParameter4fvNV 4184
-void
-__indirect_glProgramParameter4fNV(GLenum target, GLuint index, GLfloat x,
-                                  GLfloat y, GLfloat z, GLfloat w)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramParameter4fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
-    (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
-    (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
-    (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
-#define X_GLrop_ProgramParameter4fvNV 4184
-void
-__indirect_glProgramParameter4fvNV(GLenum target, GLuint index,
-                                   const GLfloat * params)
-{
-    __GLXcontext *const gc = __glXGetCurrentContext();
-    const GLuint cmdlen = 28;
-    emit_header(gc->pc, X_GLrop_ProgramParameter4fvNV, cmdlen);
-    (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
-    (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
-    (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
-    gc->pc += cmdlen;
-    if (__builtin_expect(gc->pc > gc->limit, 0)) {
-        (void) __glXFlushRenderBuffer(gc, gc->pc);
-    }
-}
-
 #define X_GLrop_ProgramParameters4dvNV 4187
 void
 __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
@@ -8850,6 +9170,10 @@ __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 16 + __GLX_PAD((num * 32));
+    if (num < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(num >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_ProgramParameters4dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
@@ -8870,6 +9194,10 @@ __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 16 + __GLX_PAD((num * 16));
+    if (num < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(num >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_ProgramParameters4fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
@@ -8889,6 +9217,10 @@ __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_RequestResidentProgramsNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -9321,7 +9653,7 @@ __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z,
 
 #define X_GLrop_VertexAttrib4ubvNV 4277
 void
-__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v)
+__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte *v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12;
@@ -9340,6 +9672,10 @@ __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs1dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9358,6 +9694,10 @@ __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs1fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9376,6 +9716,10 @@ __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 2));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs1svNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9394,6 +9738,10 @@ __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs2dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9412,6 +9760,10 @@ __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs2fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9430,6 +9782,10 @@ __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs2svNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9448,6 +9804,10 @@ __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 24));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs3dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9466,6 +9826,10 @@ __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 12));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs3fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9484,6 +9848,10 @@ __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 6));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs3svNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9502,6 +9870,10 @@ __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 32));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs4dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9520,6 +9892,10 @@ __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs4fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9538,6 +9914,10 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs4svNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9552,10 +9932,14 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
 
 #define X_GLrop_VertexAttribs4ubvNV 4214
 void
-__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v)
+__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_VertexAttribs4ubvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
@@ -9616,12 +10000,16 @@ __indirect_glActiveStencilFaceEXT(GLenum face)
 #define X_GLvop_GetProgramNamedParameterdvNV 1311
 void
 __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
-                                          const GLubyte * name,
+                                          const GLubyte *name,
                                           GLdouble * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     const GLuint cmdlen = 8 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -9640,12 +10028,16 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
 #define X_GLvop_GetProgramNamedParameterfvNV 1310
 void
 __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
-                                          const GLubyte * name,
+                                          const GLubyte *name,
                                           GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     const GLuint cmdlen = 8 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((len >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -9664,11 +10056,15 @@ __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
 #define X_GLrop_ProgramNamedParameter4dvNV 4219
 void
 __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
-                                       const GLubyte * name, GLdouble x,
+                                       const GLubyte *name, GLdouble x,
                                        GLdouble y, GLdouble z, GLdouble w)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 44 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(len >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&x), 8);
@@ -9688,11 +10084,15 @@ __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
 #define X_GLrop_ProgramNamedParameter4dvNV 4219
 void
 __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
-                                        const GLubyte * name,
+                                        const GLubyte *name,
                                         const GLdouble * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 44 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(len >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_ProgramNamedParameter4dvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (v), 32);
@@ -9709,11 +10109,15 @@ __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
 #define X_GLrop_ProgramNamedParameter4fvNV 4218
 void
 __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
-                                       const GLubyte * name, GLfloat x,
+                                       const GLubyte *name, GLfloat x,
                                        GLfloat y, GLfloat z, GLfloat w)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 28 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(len >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
@@ -9733,11 +10137,15 @@ __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
 #define X_GLrop_ProgramNamedParameter4fvNV 4218
 void
 __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
-                                        const GLubyte * name,
+                                        const GLubyte *name,
                                         const GLfloat * v)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 28 + __GLX_PAD(len);
+    if (len < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(len >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_ProgramNamedParameter4fvNV, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&id), 4);
@@ -9823,6 +10231,10 @@ __indirect_glDeleteFramebuffersEXT(GLsizei n, const GLuint * framebuffers)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_DeleteFramebuffersEXT, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -9841,6 +10253,10 @@ __indirect_glDeleteRenderbuffersEXT(GLsizei n, const GLuint * renderbuffers)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
     const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect(n >= 0, 1)) {
         emit_header(gc->pc, X_GLrop_DeleteRenderbuffersEXT, cmdlen);
         (void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
@@ -9940,6 +10356,10 @@ __indirect_glGenFramebuffersEXT(GLsizei n, GLuint * framebuffers)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
@@ -9959,6 +10379,10 @@ __indirect_glGenRenderbuffersEXT(GLsizei n, GLuint * renderbuffers)
     __GLXcontext *const gc = __glXGetCurrentContext();
     Display *const dpy = gc->currentDpy;
     const GLuint cmdlen = 4;
+    if (n < 0) {
+        __glXSetError(gc, GL_INVALID_VALUE);
+        return;
+    }
     if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
         GLubyte const *pc =
             __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,