[EMAIL PROTECTED] wrote:

When indirect rendering is used, either because direct rendering is not
available or 'LIBGL_ALWAYS_INDIRECT=y' is set, functions related to
EXT_secondary_color, EXT_fog_coord, and EXT_blend_func_separate act as no-ops. glxinfo reports that all of this functionality should be available.


The source of the problem is that the GLX protocol for the new functions does
not exist on either the client-side or the server-side.

I know this is a breach of protocol, but I'd like to discuss the patch that I have for this before attaching it to the bug report or committing it.


In both the client-side and the server-side g_render.c I have created some template macros for generating the GLX protocol stubs. The client-side version was 3,600 lines of virtually identical code. That bugs me. If nothing else, it makes it difficult to determine which functions exist and which ones don't. It also makes the process of adding new functions tedious and error prone. I suspect that these files may have been automatically generated at one point, but the means for doing that are lost. After committing this fix, I intend to convert almost all of the client-side g_render.c functions to use some form of template.

I would also like to eliminate indirect_wrap.h. The only place that seems to be needed is in g_render.c and vertarr.c. The templates will allow it to be eliminated from g_render.c, and it should be easy enough to modify vertarr.c.

My server-side goals are slightly more ambitious. I intend to create a new header-file, dispatch_stubs.h or some such, that contains all of the templated functions. Under normal circumstances, the templates will generate the __glxDisp_ and __glxDispSwap_ prototypes for the functions. If the file is included and GLX_GENERATE_CODE is defined, the functions will be generated. A new C file, dispatch_stubs.c, will be the only file to define GLX_GENERATE_CODE. It will also contain the few functions that can't easilly be templatized. g_render.c (server-side only), g_renderswap.c, g_disptab.h, and g_disptab_EXT.h will go away. The benefit is that new functions won't need to be added to a C file and a header file.

In the current code, a person must modify 5 source files (g_disptab_EXT.c, g_disptab_EXT.h, g_render.c, g_renderswap.c, and rensizetab.c) in order to add protocol for a new function. My proposed changes will reduce that number to 3 (dispatch_stubs.h, g_disptab_EXT.c, and rensizetab.c).

There is some hand editing in the patch to trim out some other stuff. A couple of the client-side library changes may no apply 100% cleanly. If there's a problem, please let me know.

Index: lib/GL/glx/g_render.c
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/g_render.c,v
retrieving revision 1.6
diff -u -d -r1.6 g_render.c
--- lib/GL/glx/g_render.c       25 Nov 2002 19:57:48 -0000      1.6
+++ lib/GL/glx/g_render.c       14 Jan 2004 18:48:41 -0000
@@ -30,6 +30,104 @@
 
 #include "packrender.h"
 #include "size.h"
+#include <stdio.h>
+
+#define GLdouble_SIZE   8
+#define GLfloat_SIZE    4
+#define GLint_SIZE      4
+#define GLuint_SIZE     4
+#define GLenum_SIZE     4
+#define GLshort_SIZE    2
+#define GLushort_SIZE   2
+#define GLbyte_SIZE     1
+#define GLubyte_SIZE    1
+#define GLboolean_SIZE  1
+
+#define __GLX_PUT_GLdouble(offset,value)   __GLX_PUT_DOUBLE(offset,value)
+#define __GLX_PUT_GLfloat(offset,value)    __GLX_PUT_FLOAT(offset,value)
+#define __GLX_PUT_GLint(offset,value)      __GLX_PUT_LONG(offset,value)
+#define __GLX_PUT_GLuint(offset,value)     __GLX_PUT_LONG(offset,value)
+#define __GLX_PUT_GLenum(offset,value)     __GLX_PUT_LONG(offset,value)
+#define __GLX_PUT_GLshort(offset,value)    __GLX_PUT_SHORT(offset,value)
+#define __GLX_PUT_GLushort(offset,value)   __GLX_PUT_SHORT(offset,value)
+#define __GLX_PUT_GLbyte(offset,value)     __GLX_PUT_CHAR(offset,value)
+#define __GLX_PUT_GLubyte(offset,value)    __GLX_PUT_CHAR(offset,value)
+#define __GLX_PUT_GLboolean(offset,value)  __GLX_PUT_CHAR(offset,value)
+
+#define RENDER_SIZE(t,c)  (((4 + (t ## _SIZE * c)) + 3) & ~3)
+
+#define vertex_template_1_scalar(name, rop, type ) \
+   void __indirect_ ## name ( type v1 ) \
+   { \
+       __GLX_DECLARE_VARIABLES(); \
+       __GLX_LOAD_VARIABLES(); \
+       __GLX_BEGIN( rop, RENDER_SIZE(type, 1) ); \
+       __GLX_PUT_ ## type ( 4 + (0 * type ## _SIZE), v1 ); \
+       __GLX_END( RENDER_SIZE(type, 1) ); \
+   }
+
+#define vertex_template_1(name, rop, type ) \
+   vertex_template_1_scalar( name, rop, type ) \
+   void __indirect_ ## name ## v ( const type * v ) \
+   { \
+       __GLX_DECLARE_VARIABLES(); \
+       __GLX_LOAD_VARIABLES(); \
+       __GLX_BEGIN( rop, RENDER_SIZE(type, 1) ); \
+       __GLX_PUT_ ## type ( 4 + (0 * type ## _SIZE), v[0] ); \
+       __GLX_END( RENDER_SIZE(type, 1) ); \
+   }
+
+#define vertex_template_3_scalar(name, rop, type ) \
+   void __indirect_ ## name ( type v1, type v2, type v3 ) \
+   { \
+       __GLX_DECLARE_VARIABLES(); \
+       __GLX_LOAD_VARIABLES(); \
+       __GLX_BEGIN( rop, RENDER_SIZE(type, 3) ); \
+       __GLX_PUT_ ## type ( 4 + (0 * type ## _SIZE), v1 ); \
+       __GLX_PUT_ ## type ( 4 + (1 * type ## _SIZE), v2 ); \
+       __GLX_PUT_ ## type ( 4 + (2 * type ## _SIZE), v3 ); \
+       __GLX_END( RENDER_SIZE(type, 3) ); \
+   }
+
+#define vertex_template_3(name, rop, type ) \
+   vertex_template_3_scalar(name, rop, type ) \
+   void __indirect_ ## name ## v ( const type * v ) \
+   { \
+       __GLX_DECLARE_VARIABLES(); \
+       __GLX_LOAD_VARIABLES(); \
+       __GLX_BEGIN( rop, RENDER_SIZE(type, 3) ); \
+       __GLX_PUT_ ## type ( 4 + (0 * type ## _SIZE), v[0] ); \
+       __GLX_PUT_ ## type ( 4 + (1 * type ## _SIZE), v[1] ); \
+       __GLX_PUT_ ## type ( 4 + (2 * type ## _SIZE), v[2] ); \
+       __GLX_END( RENDER_SIZE(type, 3) ); \
+   }
+
+#define vertex_template_4_scalar(name, rop, type ) \
+   void __indirect_ ## name ( type v1, type v2, type v3, type v4 ) \
+   { \
+       __GLX_DECLARE_VARIABLES(); \
+       __GLX_LOAD_VARIABLES(); \
+       __GLX_BEGIN( rop, RENDER_SIZE(type, 4) ); \
+       __GLX_PUT_ ## type ( 4 + (0 * type ## _SIZE), v1 ); \
+       __GLX_PUT_ ## type ( 4 + (1 * type ## _SIZE), v2 ); \
+       __GLX_PUT_ ## type ( 4 + (2 * type ## _SIZE), v3 ); \
+       __GLX_PUT_ ## type ( 4 + (3 * type ## _SIZE), v4 ); \
+       __GLX_END( RENDER_SIZE(type, 4) ); \
+   }
+
+#define vertex_template_4(name, rop, type ) \
+   vertex_template_4_scalar(name, rop, type ) \
+   void __indirect_ ## name ## v ( const type * v ) \
+   { \
+       __GLX_DECLARE_VARIABLES(); \
+       __GLX_LOAD_VARIABLES(); \
+       __GLX_BEGIN( rop, RENDER_SIZE(type, 4) ); \
+       __GLX_PUT_ ## type ( 4 + (0 * type ## _SIZE), v[0] ); \
+       __GLX_PUT_ ## type ( 4 + (1 * type ## _SIZE), v[1] ); \
+       __GLX_PUT_ ## type ( 4 + (2 * type ## _SIZE), v[2] ); \
+       __GLX_PUT_ ## type ( 4 + (3 * type ## _SIZE), v[3] ); \
+       __GLX_END( RENDER_SIZE(type, 4) ); \
+   }
 
 void glCallList(GLuint list)
 {
@@ -426,6 +524,18 @@
        __GLX_END(12);
 }
 
+vertex_template_1(glFogCoordf, X_GLrop_FogCoordfv, GLfloat)
+vertex_template_1(glFogCoordd, X_GLrop_FogCoorddv, GLdouble)
+
+vertex_template_3(glSecondaryColor3b,  X_GLrop_SecondaryColor3bv,  GLbyte)
+vertex_template_3(glSecondaryColor3s,  X_GLrop_SecondaryColor3sv,  GLshort)
+vertex_template_3(glSecondaryColor3i,  X_GLrop_SecondaryColor3iv,  GLint)
+vertex_template_3(glSecondaryColor3ub, X_GLrop_SecondaryColor3ubv, GLubyte)
+vertex_template_3(glSecondaryColor3us, X_GLrop_SecondaryColor3usv, GLushort)
+vertex_template_3(glSecondaryColor3ui, X_GLrop_SecondaryColor3uiv, GLuint)
+vertex_template_3(glSecondaryColor3f,  X_GLrop_SecondaryColor3fv,  GLfloat)
+vertex_template_3(glSecondaryColor3d,  X_GLrop_SecondaryColor3dv,  GLdouble)
+
 void glEdgeFlag(GLboolean flag)
 {
        __GLX_DECLARE_VARIABLES();
@@ -2423,6 +2533,8 @@
        __GLX_END(12);
 }
 
+vertex_template_4_scalar(glBlendFuncSeparate, X_GLrop_BlendFuncSeparate, GLenum)
+
 void glLogicOp(GLenum opcode)
 {
        __GLX_DECLARE_VARIABLES();
Index: lib/GL/glx/glxclient.h
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/glxclient.h,v
retrieving revision 1.38
diff -u -d -r1.38 glxclient.h
--- lib/GL/glx/glxclient.h      23 Oct 2003 23:21:23 -0000      1.38
+++ lib/GL/glx/glxclient.h      14 Jan 2004 18:48:41 -0000
@@ -392,6 +392,8 @@
     __GLXvertexArrayPointerState vertex;
     __GLXvertexArrayPointerState normal;
     __GLXvertexArrayPointerState color;
+    __GLXvertexArrayPointerState secondaryColor;
+    __GLXvertexArrayPointerState fogCoord;
     __GLXvertexArrayPointerState index;
     __GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS];
     __GLXvertexArrayPointerState edgeFlag;
Index: lib/GL/glx/glxcmds.c
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/glxcmds.c,v
retrieving revision 1.68
diff -u -d -r1.68 glxcmds.c
--- lib/GL/glx/glxcmds.c        13 Jan 2004 19:31:40 -0000      1.68
+++ lib/GL/glx/glxcmds.c        14 Jan 2004 18:48:41 -0000
@@ -125,6 +125,7 @@
                        "GL_IBM_rasterpos_clip "
                        "GL_IBM_texture_clamp_nodraw "
                        "GL_IBM_texture_mirrored_repeat "
+                       "GL_INGR_blend_func_separate "
                        "GL_INGR_interlace_read "
                        "GL_MESA_pack_invert "
                        "GL_MESA_ycbcr_texture "
Index: lib/GL/glx/indirect.h
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/indirect.h,v
retrieving revision 1.11
diff -u -d -r1.11 indirect.h
--- lib/GL/glx/indirect.h       13 Jan 2004 19:31:40 -0000      1.11
+++ lib/GL/glx/indirect.h       14 Jan 2004 18:48:41 -0000
@@ -486,7 +486,37 @@
 void __indirect_glMultiDrawArrays(GLenum mode, GLint *first, GLsizei *count, GLsizei 
primcount);
 void __indirect_glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, 
const GLvoid ** indices, GLsizei primcount);
 
+void __indirect_glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB,GLenum 
sfactorA, GLenum dfactorA);
+
 void __indirect_glSampleMaskSGIS( GLfloat value, GLboolean invert );
 void __indirect_glSamplePatternSGIS( GLenum pass );
 
+/* 145. GL_EXT_secondary_color / GL 1.4 */
+
+void __indirect_glSecondaryColor3b (GLbyte, GLbyte, GLbyte);
+void __indirect_glSecondaryColor3bv (const GLbyte *);
+void __indirect_glSecondaryColor3d (GLdouble, GLdouble, GLdouble);
+void __indirect_glSecondaryColor3dv (const GLdouble *);
+void __indirect_glSecondaryColor3f (GLfloat, GLfloat, GLfloat);
+void __indirect_glSecondaryColor3fv (const GLfloat *);
+void __indirect_glSecondaryColor3i (GLint, GLint, GLint);
+void __indirect_glSecondaryColor3iv (const GLint *);
+void __indirect_glSecondaryColor3s (GLshort, GLshort, GLshort);
+void __indirect_glSecondaryColor3sv (const GLshort *);
+void __indirect_glSecondaryColor3ub (GLubyte, GLubyte, GLubyte);
+void __indirect_glSecondaryColor3ubv (const GLubyte *);
+void __indirect_glSecondaryColor3ui (GLuint, GLuint, GLuint);
+void __indirect_glSecondaryColor3uiv (const GLuint *);
+void __indirect_glSecondaryColor3us (GLushort, GLushort, GLushort);
+void __indirect_glSecondaryColor3usv (const GLushort *);
+void __indirect_glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *);
+
+/* 149. GL_EXT_fog_coord / GL 1.4 */
+
+void __indirect_glFogCoordf (GLfloat);
+void __indirect_glFogCoordfv (const GLfloat *);
+void __indirect_glFogCoordd (GLdouble);
+void __indirect_glFogCoorddv (const GLdouble *);
+void __indirect_glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
+
 #endif /* _INDIRECT_H_ */
Index: lib/GL/glx/indirect_init.c
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/indirect_init.c,v
retrieving revision 1.16
diff -u -d -r1.16 indirect_init.c
--- lib/GL/glx/indirect_init.c  13 Jan 2004 19:31:40 -0000      1.16
+++ lib/GL/glx/indirect_init.c  14 Jan 2004 18:48:41 -0000
@@ -520,6 +520,35 @@
     glAPI->SampleMaskSGIS = __indirect_glSampleMaskSGIS;
     glAPI->SamplePatternSGIS = __indirect_glSamplePatternSGIS;
 
+    /* 145. GL_EXT_secondary_color / GL 1.4 */
+    glAPI->SecondaryColor3bEXT       = __indirect_glSecondaryColor3b;
+    glAPI->SecondaryColor3bvEXT      = __indirect_glSecondaryColor3bv;
+    glAPI->SecondaryColor3sEXT       = __indirect_glSecondaryColor3s;
+    glAPI->SecondaryColor3svEXT      = __indirect_glSecondaryColor3sv;
+    glAPI->SecondaryColor3iEXT       = __indirect_glSecondaryColor3i;
+    glAPI->SecondaryColor3ivEXT      = __indirect_glSecondaryColor3iv;
+    glAPI->SecondaryColor3ubEXT      = __indirect_glSecondaryColor3ub;
+    glAPI->SecondaryColor3ubvEXT     = __indirect_glSecondaryColor3ubv;
+    glAPI->SecondaryColor3usEXT      = __indirect_glSecondaryColor3us;
+    glAPI->SecondaryColor3usvEXT     = __indirect_glSecondaryColor3usv;
+    glAPI->SecondaryColor3uiEXT      = __indirect_glSecondaryColor3ui;
+    glAPI->SecondaryColor3uivEXT     = __indirect_glSecondaryColor3uiv;
+    glAPI->SecondaryColor3fEXT       = __indirect_glSecondaryColor3f;
+    glAPI->SecondaryColor3fvEXT      = __indirect_glSecondaryColor3fv;
+    glAPI->SecondaryColor3dEXT       = __indirect_glSecondaryColor3d;
+    glAPI->SecondaryColor3dvEXT      = __indirect_glSecondaryColor3dv;
+    glAPI->SecondaryColorPointerEXT  = __indirect_glSecondaryColor3dv;
+
+    /* 149. GL_EXT_fog_coord / GL 1.4 */
+    glAPI->FogCoordfEXT       = __indirect_glFogCoordf;
+    glAPI->FogCoordfvEXT      = __indirect_glFogCoordfv;
+    glAPI->FogCoorddEXT       = __indirect_glFogCoordd;
+    glAPI->FogCoorddvEXT      = __indirect_glFogCoorddv;
+    glAPI->FogCoordPointerEXT = __indirect_glFogCoordPointer;
+
+    /* 173. GL_EXT_blend_func_separate / GL 1.4 */
+    glAPI->BlendFuncSeparateEXT = __indirect_glBlendFuncSeparate;
+
     /* 268. GL_EXT_stencil_two_side */
     glAPI->ActiveStencilFaceEXT = __indirect_glActiveStencilFaceEXT;
 
Index: lib/GL/glx/indirect_wrap.h
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/indirect_wrap.h,v
retrieving revision 1.7
diff -u -d -r1.7 indirect_wrap.h
--- lib/GL/glx/indirect_wrap.h  13 Jan 2004 19:31:40 -0000      1.7
+++ lib/GL/glx/indirect_wrap.h  14 Jan 2004 18:48:41 -0000
@@ -383,6 +383,7 @@
 /* 1.4 */
 #define glMultiDrawArrays __indirect_glMultiDrawArrays
 #define glMultiDrawElements __indirect_glMultiDrawElements
+#define glBlendFuncSeparate __indirect_glBlendFuncSeparate
 
 /* GL_ARB_imaging */
 #define glBlendColor __indirect_glBlendColor
@@ -696,5 +697,32 @@
 #define glWindowPos3ivARB __indirect_glWindowPos3ivARB
 #define glWindowPos3svARB __indirect_glWindowPos3svARB
 
+/* 145. GL_EXT_secondary_color / GL 1.4 */
+
+#define glSecondaryColor3b __indirect_glSecondaryColor3b
+#define glSecondaryColor3bv __indirect_glSecondaryColor3bv
+#define glSecondaryColor3d __indirect_glSecondaryColor3d
+#define glSecondaryColor3dv __indirect_glSecondaryColor3dv
+#define glSecondaryColor3f __indirect_glSecondaryColor3f
+#define glSecondaryColor3fv __indirect_glSecondaryColor3fv
+#define glSecondaryColor3i __indirect_glSecondaryColor3i
+#define glSecondaryColor3iv __indirect_glSecondaryColor3iv
+#define glSecondaryColor3s __indirect_glSecondaryColor3s
+#define glSecondaryColor3sv __indirect_glSecondaryColor3sv
+#define glSecondaryColor3ub __indirect_glSecondaryColor3ub
+#define glSecondaryColor3ubv __indirect_glSecondaryColor3ubv
+#define glSecondaryColor3ui __indirect_glSecondaryColor3ui
+#define glSecondaryColor3uiv __indirect_glSecondaryColor3uiv
+#define glSecondaryColor3us __indirect_glSecondaryColor3us
+#define glSecondaryColor3usv __indirect_glSecondaryColor3usv
+#define glSecondaryColorPointer __indirect_glSecondaryColorPointer
+
+/* 149. GL_EXT_fog_coord / GL 1.4 */
+
+#define glFogCoordf __indirect_glFogCoordf
+#define glFogCoordd __indirect_glFogCoordd
+#define glFogCoordfv __indirect_glFogCoordfv
+#define glFogCoorddv __indirect_glFogCoorddv
+#define glFogCoordPointer __indirect_glFogCoordPointer
 
 #endif /* _INDIRECT_WRAP_H_ */
Index: lib/GL/glx/vertarr.c
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/vertarr.c,v
retrieving revision 1.4
diff -u -d -r1.4 vertarr.c
--- lib/GL/glx/vertarr.c        13 Jan 2004 19:31:40 -0000      1.4
+++ lib/GL/glx/vertarr.c        14 Jan 2004 18:48:41 -0000
@@ -64,6 +64,14 @@
        colorPointer->proc = (void (*)(const void *))glColor4##let##v; \
       break
 
+#define __GL_SEC_COLOR_FUNC(NAME, let) \
+    case GL_##NAME: \
+      seccolorPointer->proc = (void (*)(const void *))glSecondaryColor3##let##v; \
+
+#define __GL_FOG_FUNC(NAME, let) \
+    case GL_##NAME: \
+      fogPointer->proc = (void (*)(const void *))glFogCoord##let##v; \
+
 #define __GL_INDEX_FUNC(NAME, let) \
     case GL_##NAME: \
       indexPointer->proc = (void (*)(const void *))glIndex##let##v; \
@@ -126,6 +134,22 @@
     va->color.type = GL_FLOAT;
     va->color.stride = 0;
 
+    va->secondaryColor.enable = GL_FALSE;
+    va->secondaryColor.proc = NULL;
+    va->secondaryColor.skip = 0;
+    va->secondaryColor.ptr = 0;
+    va->secondaryColor.size = 3;
+    va->secondaryColor.type = GL_FLOAT;
+    va->secondaryColor.stride = 0;
+
+    va->fogCoord.enable = GL_FALSE;
+    va->fogCoord.proc = NULL;
+    va->fogCoord.skip = 0;
+    va->fogCoord.ptr = 0;
+    va->fogCoord.size = 1;
+    va->fogCoord.type = GL_FLOAT;
+    va->fogCoord.stride = 0;
+
     va->index.enable = GL_FALSE;
     va->index.proc = NULL;
     va->index.skip = 0;
@@ -369,6 +393,79 @@
 
 }
 
+void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride,
+                            const GLvoid * pointer )
+{
+    __GLXcontext *gc = __glXGetCurrentContext();
+    __GLXvertexArrayPointerState *seccolorPointer = 
&gc->state.vertArray.secondaryColor;
+
+    /* Check arguments */
+    if ( (stride < 0) || (size != 3) ) {
+       __glXSetError(gc, GL_INVALID_VALUE);
+       return;
+    } 
+
+    /* Choose appropriate api proc */
+    switch(type) {
+       __GL_SEC_COLOR_FUNC(BYTE, b);
+       __GL_SEC_COLOR_FUNC(UNSIGNED_BYTE, ub);
+       __GL_SEC_COLOR_FUNC(SHORT, s);
+       __GL_SEC_COLOR_FUNC(UNSIGNED_SHORT, us);
+       __GL_SEC_COLOR_FUNC(INT, i);
+       __GL_SEC_COLOR_FUNC(UNSIGNED_INT, ui);
+       __GL_SEC_COLOR_FUNC(FLOAT, f);
+       __GL_SEC_COLOR_FUNC(DOUBLE, d);
+      default:
+        __glXSetError(gc, GL_INVALID_ENUM);
+        return;
+    }
+
+    seccolorPointer->size = size;
+    seccolorPointer->type = type;
+    seccolorPointer->stride = stride;
+    seccolorPointer->ptr = pointer;
+
+    /* Set internal state */
+    if (stride == 0) {
+        seccolorPointer->skip = size * __glXTypeSize(type);
+    } else {
+        seccolorPointer->skip = stride;
+    }
+}
+
+void glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid * pointer)
+{
+    __GLXcontext *gc = __glXGetCurrentContext();
+    __GLXvertexArrayPointerState *fogPointer = &gc->state.vertArray.fogCoord;
+
+    /* Check arguments */
+    if (stride < 0) {
+       __glXSetError(gc, GL_INVALID_VALUE);
+       return;
+    } 
+
+    /* Choose appropriate api proc */
+    switch(type) {
+       __GL_FOG_FUNC(FLOAT, f);
+       __GL_FOG_FUNC(DOUBLE, d);
+      default:
+        __glXSetError(gc, GL_INVALID_ENUM);
+        return;
+    }
+
+    fogPointer->size = 1;
+    fogPointer->type = type;
+    fogPointer->stride = stride;
+    fogPointer->ptr = pointer;
+
+    /* Set internal state */
+    if (stride == 0) {
+        fogPointer->skip = __glXTypeSize(type);
+    } else {
+        fogPointer->skip = stride;
+    }
+}
+
 void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
 {
     __GLXcontext *gc = __glXGetCurrentContext();
@@ -552,6 +649,10 @@
        (*va->color.proc)(va->color.ptr+i*va->color.skip);
     }
 
+    if (va->secondaryColor.enable == GL_TRUE) {
+       (*va->secondaryColor.proc)(va->secondaryColor.ptr+i*va->secondaryColor.skip);
+    }
+
     if (va->index.enable == GL_TRUE) {
        (*va->index.proc)(va->index.ptr+i*va->index.skip);
     }
@@ -560,6 +661,10 @@
        (*va->normal.proc)(va->normal.ptr+i*va->normal.skip);
     }
 
+    if (va->fogCoord.enable == GL_TRUE) {
+       (*va->fogCoord.proc)(va->fogCoord.ptr+i*va->fogCoord.skip);
+    }
+
     if (va->vertex.enable == GL_TRUE) {
        (*va->vertex.proc)(va->vertex.ptr+i*va->vertex.skip);
     }
@@ -569,7 +674,8 @@
 {
     __GLXcontext *gc = __glXGetCurrentContext();
     __GLXvertArrayState *va = &gc->state.vertArray;
-    const GLubyte *vaPtr = NULL, *naPtr = NULL, *caPtr = NULL, 
+    const GLubyte *vaPtr = NULL, *naPtr = NULL, *caPtr = NULL,
+                  *scaPtr = NULL, faPtr = NULL,
                   *iaPtr = NULL, *tcaPtr[__GLX_MAX_TEXTURE_UNITS];
     const GLboolean *efaPtr = NULL;
     GLint i, j;
@@ -603,6 +709,10 @@
        naPtr = va->normal.ptr + first * va->normal.skip;
     if (va->color.enable == GL_TRUE) 
        caPtr = va->color.ptr + first * va->color.skip;
+    if (va->secondaryColor.enable == GL_TRUE) 
+       scaPtr = va->secondaryColor.ptr + first * va->secondaryColor.skip;
+    if (va->fogCoord.enable == GL_TRUE) 
+       faPtr = va->fogCoord.ptr + first * va->fogCoord.skip;
     if (va->index.enable == GL_TRUE) 
        iaPtr = va->index.ptr + first * va->index.skip;
     for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) {
@@ -630,6 +740,14 @@
                 (*va->color.proc)(caPtr);
                 caPtr += va->color.skip;
             }
+            if (va->secondaryColor.enable == GL_TRUE) {
+                (*va->secondaryColor.proc)(scaPtr);
+                scaPtr += va->secondaryColor.skip;
+            }
+            if (va->fogCoord.enable == GL_TRUE) {
+                (*va->fogCoord.proc)(faPtr);
+                faPtr += va->fogCoord.skip;
+            }
             if (va->index.enable == GL_TRUE) {
                 (*va->index.proc)(iaPtr);
                 iaPtr += va->index.skip;
Index: programs/Xserver/GL/glx/g_disptab_EXT.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v
retrieving revision 1.4
diff -u -d -r1.4 g_disptab_EXT.c
--- programs/Xserver/GL/glx/g_disptab_EXT.c     25 Nov 2002 19:58:37 -0000      1.4
+++ programs/Xserver/GL/glx/g_disptab_EXT.c     14 Jan 2004 18:48:41 -0000
@@ -2104,22 +2104,22 @@
        __glXDisp_CopyTexSubImage1D,  /* 4121 */
        __glXDisp_CopyTexSubImage2D,  /* 4122 */
        __glXDisp_CopyTexSubImage3D,  /* 4123 */
-       __glXNoSuchRenderOpcode, /* 4124 */
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode, /* 4130 */
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
+       __glXDisp_FogCoordfv,         /* 4124 */
+       __glXDisp_FogCoorddv,         /* 4125 */
+       __glXDisp_SecondaryColor3bv,  /* 4126 */
+       __glXDisp_SecondaryColor3sv,  /* 4127 */
+       __glXDisp_SecondaryColor3iv,  /* 4128 */
+       __glXDisp_SecondaryColor3fv,  /* 4129 */
+       __glXDisp_SecondaryColor3dv,  /* 4130 */
+       __glXDisp_SecondaryColor3ubv, /* 4131 */
+       __glXDisp_SecondaryColor3usv, /* 4132 */
+       __glXDisp_SecondaryColor3uiv, /* 4133 */
+       __glXDisp_BlendFuncSeparate,  /* 4134 */
+       __glXNoSuchRenderOpcode,      /* 4135 */
+       __glXNoSuchRenderOpcode,      /* 4136 */
+       __glXNoSuchRenderOpcode,      /* 4137 */
+       __glXNoSuchRenderOpcode,      /* 4138 */
+       __glXNoSuchRenderOpcode,      /* 4139 */
        __glXNoSuchRenderOpcode, /* 4140 */
        __glXNoSuchRenderOpcode,
        __glXNoSuchRenderOpcode,
@@ -4282,22 +4282,22 @@
        __glXDispSwap_CopyTexSubImage1D,  /* 4121 */
        __glXDispSwap_CopyTexSubImage2D,  /* 4122 */
        __glXDispSwap_CopyTexSubImage3D,  /* 4123 */
-       __glXNoSuchRenderOpcode, /* 4124 */
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode, /* 4130 */
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
-       __glXNoSuchRenderOpcode,
+       __glXDispSwap_FogCoordfv,         /* 4124 */
+       __glXDispSwap_FogCoorddv,         /* 4125 */
+       __glXDispSwap_SecondaryColor3bv,  /* 4126 */
+       __glXDispSwap_SecondaryColor3sv,  /* 4127 */
+       __glXDispSwap_SecondaryColor3iv,  /* 4128 */
+       __glXDispSwap_SecondaryColor3fv,  /* 4129 */
+       __glXDispSwap_SecondaryColor3dv,  /* 4130 */
+       __glXDispSwap_SecondaryColor3ubv, /* 4131 */
+       __glXDispSwap_SecondaryColor3usv, /* 4132 */
+       __glXDispSwap_SecondaryColor3uiv, /* 4133 */
+       __glXDisp_BlendFuncSeparate,      /* 4134 */
+       __glXNoSuchRenderOpcode,          /* 4135 */
+       __glXNoSuchRenderOpcode,          /* 4136 */
+       __glXNoSuchRenderOpcode,          /* 4137 */
+       __glXNoSuchRenderOpcode,          /* 4138 */
+       __glXNoSuchRenderOpcode,          /* 4139 */
        __glXNoSuchRenderOpcode, /* 4140 */
        __glXNoSuchRenderOpcode,
        __glXNoSuchRenderOpcode,
Index: programs/Xserver/GL/glx/g_disptab_EXT.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v
retrieving revision 1.4
diff -u -d -r1.4 g_disptab_EXT.h
--- programs/Xserver/GL/glx/g_disptab_EXT.h     25 Nov 2002 19:58:37 -0000      1.4
+++ programs/Xserver/GL/glx/g_disptab_EXT.h     14 Jan 2004 18:48:41 -0000
@@ -69,6 +69,34 @@
 extern void __glXDisp_CopyTexSubImage3D(GLbyte*);
 extern void __glXDisp_PointParameterfARB(GLbyte*);
 extern void __glXDisp_PointParameterfvARB(GLbyte*);
+extern void __glXDisp_PointParameteri(GLbyte*);
+extern void __glXDisp_PointParameteriv(GLbyte*);
+
+extern void __glXDisp_FogCoordfv( GLbyte * );
+extern void __glXDisp_FogCoorddv( GLbyte * );
+extern void __glXDispSwap_FogCoordfv( GLbyte * );
+extern void __glXDispSwap_FogCoorddv( GLbyte * );
+
+extern void __glXDisp_SecondaryColor3bv( GLbyte * );
+extern void __glXDisp_SecondaryColor3sv( GLbyte * );
+extern void __glXDisp_SecondaryColor3iv( GLbyte * );
+extern void __glXDisp_SecondaryColor3ubv( GLbyte * );
+extern void __glXDisp_SecondaryColor3usv( GLbyte * );
+extern void __glXDisp_SecondaryColor3uiv( GLbyte * );
+extern void __glXDisp_SecondaryColor3fv( GLbyte * );
+extern void __glXDisp_SecondaryColor3dv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3bv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3sv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3iv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3ubv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3usv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3uiv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3fv( GLbyte * );
+extern void __glXDispSwap_SecondaryColor3dv( GLbyte * );
+
+extern void __glXDisp_BlendFuncSeparate( GLbyte * );
+extern void __glXDispSwap_BlendFuncSeparate( GLbyte * );
+
 extern void __glXDisp_ActiveStencilFaceEXT(GLbyte*);
 
 extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*);
Index: programs/Xserver/GL/glx/g_render.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/GL/glx/g_render.c,v
retrieving revision 1.5
diff -u -d -r1.5 g_render.c
--- programs/Xserver/GL/glx/g_render.c  4 Oct 2003 00:18:57 -0000       1.5
+++ programs/Xserver/GL/glx/g_render.c  14 Jan 2004 18:48:41 -0000
@@ -59,6 +59,110 @@
        );
 }
 
+#define __GLX_SWAP_GLbyte(ptr)
+#define __GLX_SWAP_GLshort(ptr)  __GLX_SWAP_SHORT(ptr)
+#define __GLX_SWAP_GLint(ptr)    __GLX_SWAP_INT(ptr)
+#define __GLX_SWAP_GLubyte(ptr)
+#define __GLX_SWAP_GLushort(ptr) __GLX_SWAP_SHORT(ptr)
+#define __GLX_SWAP_GLuint(ptr)   __GLX_SWAP_INT(ptr)
+#define __GLX_SWAP_GLdouble(ptr) __GLX_SWAP_DOUBLE(ptr)
+#define __GLX_SWAP_GLfloat(ptr)  __GLX_SWAP_FLOAT(ptr)
+
+#define __GLX_SWAP_GLbyte_ARRAY(ptr,count)
+#define __GLX_SWAP_GLshort_ARRAY(ptr,count)  __GLX_SWAP_SHORT_ARRAY(ptr,count)
+#define __GLX_SWAP_GLint_ARRAY(ptr,count)    __GLX_SWAP_INT_ARRAY(ptr,count)
+#define __GLX_SWAP_GLubyte_ARRAY(ptr,count)
+#define __GLX_SWAP_GLushort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count)
+#define __GLX_SWAP_GLuint_ARRAY(ptr,count)   __GLX_SWAP_INT_ARRAY(ptr,count)
+#define __GLX_SWAP_GLdouble_ARRAY(ptr,count) __GLX_SWAP_DOUBLE_ARRAY(ptr,count)
+#define __GLX_SWAP_GLfloat_ARRAY(ptr,count)  __GLX_SWAP_FLOAT_ARRAY(ptr,count)
+
+#ifdef __GLX_ALIGN64
+/* If type is not GLdouble, the compiler should optimize this away.
+ */
+# define GLX_DO_ALIGN_MAGIC(count, type) \
+       do { if ( (sizeof(type) == 8) && ((unsigned long)(pc) & 7)) { \
+           __GLX_MEM_COPY(pc-4, pc, (count * sizeof( type ) ); \
+           pc -= 4; \
+       } } while( 0 )
+#else
+# define GLX_DO_ALIGN_MAGIC(count, type)
+#endif
+
+#define dispatch_template_1( name, type ) \
+    void __glXDisp_ ## name ( GLbyte * pc ) \
+    { \
+       GLX_DO_ALIGN_MAGIC( 1, type ); \
+       gl ## name ( (type *) pc ); \
+    } \
+    void __glXDispSwap_ ## name ( GLbyte * pc ) \
+    { \
+       __GLX_DECLARE_SWAP_VARIABLES; \
+       GLX_DO_ALIGN_MAGIC( 1, type ); \
+       __GLX_SWAP_ ## type ( pc ); \
+       gl ## name ( (type *) pc ); \
+    }
+
+#define dispatch_template_3( name, type ) \
+    void __glXDisp_ ## name ( GLbyte * pc ) \
+    { \
+       GLX_DO_ALIGN_MAGIC( 3, type ); \
+       gl ## name ( (type *) pc ); \
+    } \
+    void __glXDispSwap_ ## name ( GLbyte * pc ) \
+    { \
+       __GLX_DECLARE_SWAP_VARIABLES; \
+       __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \
+       GLX_DO_ALIGN_MAGIC( 3, type ); \
+       __GLX_SWAP_ ## type ## _ARRAY(pc, 3); \
+       gl ## name ( (type *) pc ); \
+    } \
+
+#define dispatch_template_4( name, type ) \
+    void __glXDisp_ ## name ( GLbyte * pc ) \
+    { \
+       GLX_DO_ALIGN_MAGIC( 4, type ); \
+       gl ## name ( (type *) pc ); \
+    } \
+    void __glXDispSwap_ ## name ( GLbyte * pc ) \
+    { \
+       __GLX_DECLARE_SWAP_VARIABLES; \
+       __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \
+       GLX_DO_ALIGN_MAGIC( 4, type ); \
+       __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \
+       gl ## name ( (type *) pc ); \
+    } \
+
+#define dispatch_template_4_scalar( name, type ) \
+    void __glXDisp_ ## name ( GLbyte * pc ) \
+    { \
+       GLX_DO_ALIGN_MAGIC( 4, type ); \
+       gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \
+                    ((type *) pc)[2], ((type *) pc)[3] ); \
+    } \
+    void __glXDispSwap_ ## name ( GLbyte * pc ) \
+    { \
+       __GLX_DECLARE_SWAP_VARIABLES; \
+       __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \
+       GLX_DO_ALIGN_MAGIC( 4, type ); \
+       __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \
+       gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \
+                    ((type *) pc)[2], ((type *) pc)[3] ); \
+    } \
+
+dispatch_template_1( FogCoordfv,         GLfloat )
+dispatch_template_1( FogCoorddv,         GLdouble )
+dispatch_template_3( SecondaryColor3bv,  GLbyte )
+dispatch_template_3( SecondaryColor3sv,  GLshort )
+dispatch_template_3( SecondaryColor3iv,  GLint )
+dispatch_template_3( SecondaryColor3ubv, GLubyte )
+dispatch_template_3( SecondaryColor3usv, GLushort )
+dispatch_template_3( SecondaryColor3uiv, GLuint )
+dispatch_template_3( SecondaryColor3fv,  GLfloat )
+dispatch_template_3( SecondaryColor3dfv, GLdouble )
+
+dispatch_template_4_scalar( BlendFuncSeparate,  GLenum )
+
 void __glXDisp_Color3bv(GLbyte *pc)
 {
        glColor3bv( 
Index: programs/Xserver/GL/glx/rensizetab.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/GL/glx/rensizetab.c,v
retrieving revision 1.4
diff -u -d -r1.4 rensizetab.c
--- programs/Xserver/GL/glx/rensizetab.c        25 Nov 2002 19:58:40 -0000      1.4
+++ programs/Xserver/GL/glx/rensizetab.c        14 Jan 2004 18:48:41 -0000
@@ -2342,17 +2342,17 @@
        /* CopyTexSubImage1D   */       {  28,  0 },
        /* CopyTexSubImage2D   */       {  36,  0 },
        /* CopyTexSubImage3D    4123 */ {  40,  0 },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
-       /* no such opcode      */       {   0,  0                         },
+       /* FogCoordfv           4124 */ {   8,  0 },
+       /* FogCoorddv           4125 */ {  12,  0 },
+       /* SecondaryColor3bv    4126 */ {   8,  0 },
+       /* SecondaryColor3sv    4127 */ {  12,  0 },
+       /* SecondaryColor3iv    4128 */ {  16,  0 },
+       /* SecondaryColor3fv    4129 */ {  16,  0 },
+       /* SecondaryColor3dv    4130 */ {  28,  0 },
+       /* SecondaryColor3ubv   4131 */ {   8,  0 },
+       /* SecondaryColor3usv   4132 */ {  12,  0 },
+       /* SecondaryColor3uiv   4133 */ {  16,  0 },
+       /* BlendFuncSeparate    4134 */ {  20,  0 },
        /* no such opcode      */       {   0,  0                         },
        /* no such opcode      */       {   0,  0                         },
        /* no such opcode      */       {   0,  0                         },

Reply via email to