Add support for ARB_draw_buffers and ARB_occlusion_query. The GLX protocol
authorIan Romanick <idr@us.ibm.com>
Fri, 11 Mar 2005 20:55:03 +0000 (20:55 +0000)
committerIan Romanick <idr@us.ibm.com>
Fri, 11 Mar 2005 20:55:03 +0000 (20:55 +0000)
for these extensions (as well as ARB_vertex_program and ARB_matrix_palette)
was just approved by the ARB on 8-Mar-2005.  Now the only extension missing
for 1.5 support is ARB_vertex_buffer_object.

The opcodes for ARB_matrix_palette were also added to gl_API.xml.  Since
this extension isn't supported by Mesa, no code is generated for it.  Some
tabs were also converted to spaces in the comment for
GetCompressedTexImageARB.

src/glx/x11/glxextensions.c
src/glx/x11/glxextensions.h
src/glx/x11/indirect.c
src/glx/x11/indirect.h
src/glx/x11/indirect_init.c
src/mesa/glapi/gl_API.xml

index 166dd18..56ba5c9 100644 (file)
@@ -112,12 +112,13 @@ static const struct extension_info known_glx_extensions[] = {
 
 static const struct extension_info known_gl_extensions[] = {
    { GL(ARB_depth_texture),              VER(1,4), Y, N, N, N },
+   { GL(ARB_draw_buffers),               VER(0,0), Y, N, N, N },
    { GL(ARB_fragment_program),           VER(0,0), Y, N, N, N },
    { GL(ARB_fragment_program_shadow),    VER(0,0), Y, N, N, N },
    { GL(ARB_imaging),                    VER(0,0), Y, N, N, N },
    { GL(ARB_multisample),                VER(1,3), Y, N, N, N },
    { GL(ARB_multitexture),               VER(1,3), Y, N, N, N },
-   { GL(ARB_occlusion_query),            VER(1,5), N, N, N, N },
+   { GL(ARB_occlusion_query),            VER(1,5), Y, N, N, N },
    { GL(ARB_point_parameters),           VER(1,4), Y, N, N, N },
    { GL(ARB_point_sprite),               VER(0,0), Y, N, N, N },
    { GL(ARB_shadow),                     VER(1,4), Y, N, N, N },
@@ -184,6 +185,7 @@ static const struct extension_info known_gl_extensions[] = {
    { GL(3DFX_texture_compression_FXT1),  VER(0,0), Y, N, N, N },
    { GL(APPLE_packed_pixels),            VER(1,2), Y, N, N, N },
    { GL(APPLE_ycbcr_422),                VER(0,0), Y, N, N, N },
+   { GL(ATI_draw_buffers),               VER(0,0), Y, N, N, N },
    { GL(ATI_text_fragment_shader),       VER(0,0), Y, N, N, N },
    { GL(ATI_texture_env_combine3),       VER(0,0), Y, N, N, N },
    { GL(ATI_texture_float),              VER(0,0), Y, N, N, N },
index e374161..fd19bd2 100644 (file)
@@ -74,6 +74,7 @@ enum {
 
 enum {
    GL_ARB_depth_texture_bit = 0,
+   GL_ARB_draw_buffers_bit,
    GL_ARB_fragment_program_bit,
    GL_ARB_fragment_program_shadow_bit,
    GL_ARB_imaging_bit,
@@ -212,6 +213,7 @@ enum {
     */
 
    GL_ATI_blend_equation_separate_bit = GL_EXT_blend_equation_separate_bit,
+   GL_ATI_draw_buffers_bit = GL_ARB_draw_buffers_bit,
    GL_ATIX_texture_env_combine3_bit = GL_ATI_texture_env_combine3_bit,
    GL_EXT_point_parameters_bit = GL_ARB_point_parameters_bit,
    GL_EXT_texture_env_add_bit = GL_ARB_texture_env_add_bit,
index c654c93..4d564c1 100644 (file)
@@ -5451,6 +5451,35 @@ __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert)
     if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
 }
 
+#define X_GLrop_DrawBuffersARB 233
+void
+__indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs)
+{
+    __GLXcontext * const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
+    if (__builtin_expect((n >= 0) && (gc->currentDpy != NULL), 1)) {
+        if (cmdlen <= gc->maxSmallRenderCommandSize) {
+            if ( (gc->pc + cmdlen) > gc->bufEnd ) {
+                (void) __glXFlushRenderBuffer(gc, gc->pc);
+            }
+            emit_header(gc->pc, X_GLrop_DrawBuffersARB, cmdlen);
+            (void) memcpy((void *)(gc->pc + 4), (void *)(&n), 4);
+            (void) memcpy((void *)(gc->pc + 8), (void *)(bufs), (n * 4));
+            gc->pc += cmdlen;
+            if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+        }
+        else {
+            const GLint op = X_GLrop_DrawBuffersARB;
+            const GLuint cmdlenLarge = cmdlen + 4;
+            GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
+            (void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
+            (void) memcpy((void *)(pc + 4), (void *)(&op), 4);
+            (void) memcpy((void *)(pc + 8), (void *)(&n), 4);
+            __glXSendLargeCommand(gc, pc, 12, bufs, (n * 4));
+        }
+    }
+}
+
 #define X_GLvop_AreTexturesResidentEXT 11
 GLboolean
 __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences)
@@ -7145,6 +7174,131 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte
     return;
 }
 
+#define X_GLsop_GenQueriesARB 162
+void
+__indirect_glGenQueriesARB(GLsizei n, GLuint * ids)
+{
+    __GLXcontext * const gc = __glXGetCurrentContext();
+    Display * const dpy = gc->currentDpy;
+    const GLuint cmdlen = 4;
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_GenQueriesARB, cmdlen);
+        (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
+        (void) __glXReadReply(dpy, 4, ids, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
+    }
+    return;
+}
+
+#define X_GLsop_DeleteQueriesARB 161
+void
+__indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids)
+{
+    __GLXcontext * const gc = __glXGetCurrentContext();
+    Display * const dpy = gc->currentDpy;
+    const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
+    if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
+        GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_DeleteQueriesARB, cmdlen);
+        (void) memcpy((void *)(pc + 0), (void *)(&n), 4);
+        (void) memcpy((void *)(pc + 4), (void *)(ids), (n * 4));
+        UnlockDisplay(dpy); SyncHandle();
+    }
+    return;
+}
+
+#define X_GLsop_IsQueryARB 163
+GLboolean
+__indirect_glIsQueryARB(GLuint id)
+{
+    __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 = __glXSetupSingleRequest(gc, X_GLsop_IsQueryARB, cmdlen);
+        (void) memcpy((void *)(pc + 0), (void *)(&id), 4);
+        retval = (GLboolean) __glXReadReply(dpy, 0, NULL, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
+    }
+    return retval;
+}
+
+#define X_GLrop_BeginQueryARB 231
+void
+__indirect_glBeginQueryARB(GLenum target, GLuint id)
+{
+    __GLXcontext * const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 12;
+    emit_header(gc->pc, X_GLrop_BeginQueryARB, cmdlen);
+    (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
+    (void) memcpy((void *)(gc->pc + 8), (void *)(&id), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+}
+
+#define X_GLrop_EndQueryARB 232
+void
+__indirect_glEndQueryARB(GLenum target)
+{
+    __GLXcontext * const gc = __glXGetCurrentContext();
+    const GLuint cmdlen = 8;
+    emit_header(gc->pc, X_GLrop_EndQueryARB, cmdlen);
+    (void) memcpy((void *)(gc->pc + 4), (void *)(&target), 4);
+    gc->pc += cmdlen;
+    if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+}
+
+#define X_GLsop_GetQueryivARB 164
+void
+__indirect_glGetQueryivARB(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 = __glXSetupSingleRequest(gc, X_GLsop_GetQueryivARB, 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_GetQueryObjectivARB 165
+void
+__indirect_glGetQueryObjectivARB(GLuint id, 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 = __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectivARB, cmdlen);
+        (void) memcpy((void *)(pc + 0), (void *)(&id), 4);
+        (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
+    }
+    return;
+}
+
+#define X_GLsop_GetQueryObjectuivARB 166
+void
+__indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params)
+{
+    __GLXcontext * const gc = __glXGetCurrentContext();
+    Display * const dpy = gc->currentDpy;
+    const GLuint cmdlen = 8;
+    if (__builtin_expect(dpy != NULL, 1)) {
+        GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_GetQueryObjectuivARB, cmdlen);
+        (void) memcpy((void *)(pc + 0), (void *)(&id), 4);
+        (void) memcpy((void *)(pc + 4), (void *)(&pname), 4);
+        (void) __glXReadReply(dpy, 4, params, GL_FALSE);
+        UnlockDisplay(dpy); SyncHandle();
+    }
+    return;
+}
+
 #define X_GLvop_GetVertexAttribdvNV 1301
 void
 __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params)
index 5122846..b704ba8 100644 (file)
@@ -482,6 +482,7 @@ extern HIDDEN void __indirect_glLoadTransposeMatrixdARB(const GLdouble * m);
 extern HIDDEN void __indirect_glMultTransposeMatrixfARB(const GLfloat * m);
 extern HIDDEN void __indirect_glMultTransposeMatrixdARB(const GLdouble * m);
 extern HIDDEN void __indirect_glSampleCoverageARB(GLclampf value, GLboolean invert);
+extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs);
 extern HIDDEN GLboolean __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences);
 extern HIDDEN void __indirect_glGenTexturesEXT(GLsizei n, GLuint * textures);
 extern HIDDEN GLboolean __indirect_glIsTextureEXT(GLuint texture);
@@ -643,6 +644,14 @@ extern HIDDEN void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei le
 extern HIDDEN void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);
 extern HIDDEN void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params);
 extern HIDDEN void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params);
+extern HIDDEN void __indirect_glGenQueriesARB(GLsizei n, GLuint * ids);
+extern HIDDEN void __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids);
+extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id);
+extern HIDDEN void __indirect_glBeginQueryARB(GLenum target, GLuint id);
+extern HIDDEN void __indirect_glEndQueryARB(GLenum target);
+extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params);
 extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
 extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
 extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
index 5e2fc04..70e9dab 100644 (file)
@@ -503,6 +503,10 @@ __GLapi * __glXNewIndirectAPI( void )
 
     glAPI->SampleCoverageARB = __indirect_glSampleCoverageARB;
 
+    /* GL_ARB_draw_buffers */
+
+    glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB;
+
     /* GL_EXT_texture_object */
 
     glAPI->AreTexturesResidentEXT = __indirect_glAreTexturesResidentEXT;
@@ -721,6 +725,17 @@ __GLapi * __glXNewIndirectAPI( void )
     glAPI->GetProgramNamedParameterfvNV = __indirect_glGetProgramNamedParameterfvNV;
     glAPI->GetProgramNamedParameterdvNV = __indirect_glGetProgramNamedParameterdvNV;
 
+    /* GL_ARB_occlusion_query */
+
+    glAPI->GenQueriesARB = __indirect_glGenQueriesARB;
+    glAPI->DeleteQueriesARB = __indirect_glDeleteQueriesARB;
+    glAPI->IsQueryARB = __indirect_glIsQueryARB;
+    glAPI->BeginQueryARB = __indirect_glBeginQueryARB;
+    glAPI->EndQueryARB = __indirect_glEndQueryARB;
+    glAPI->GetQueryivARB = __indirect_glGetQueryivARB;
+    glAPI->GetQueryObjectivARB = __indirect_glGetQueryObjectivARB;
+    glAPI->GetQueryObjectuivARB = __indirect_glGetQueryObjectuivARB;
+
     /* GL_NV_vertex_program */
 
     glAPI->GetVertexAttribdvNV = __indirect_glGetVertexAttribdvNV;
index 919803a..e13815c 100644 (file)
@@ -4979,11 +4979,11 @@ glx:
         <param name="level" type="GLint"/>
         <param name="img" type="GLvoid *" output="true"/>
 
-       <!-- This has to be hand coded because the image size is in the
-            "wrong" place.  Technically, this should be a
-            'always_array="true"' case.  The size field in the reply would
-            be at offset 12.  However, the size is actually at offset 16.
-            This is where the 'width' is in a GetTexImage reply. -->
+        <!-- This has to be hand coded because the image size is in the
+             "wrong" place.  Technically, this should be a
+             'always_array="true"' case.  The size field in the reply would
+             be at offset 12.  However, the size is actually at offset 16.
+             This is where the 'width' is in a GetTexImage reply. -->
         <glx sop="160" handcode="true"/>
     </function>
 </category>
@@ -5130,21 +5130,25 @@ glx:
 
     <function name="CurrentPaletteMatrixARB" offset="?">
         <param name="index" type="GLint"/>
+        <glx ignore="true" rop="4329"/>
     </function>
 
     <function name="MatrixIndexubvARB" offset="?">
-        <param name="size" type="GLint"/>
-        <param name="indices" type="const GLubyte *"/>
+        <param name="size" type="GLint" counter="true"/>
+        <param name="indices" type="const GLubyte *" count="size"/>
+        <glx ignore="true" rop="4326"/>
     </function>
 
     <function name="MatrixIndexusvARB" offset="?">
-        <param name="size" type="GLint"/>
-        <param name="indices" type="const GLushort *"/>
+        <param name="size" type="GLint" counter="true"/>
+        <param name="indices" type="const GLushort *" count="size"/>
+        <glx ignore="true" rop="4327"/>
     </function>
 
     <function name="MatrixIndexuivARB" offset="?">
-        <param name="size" type="GLint"/>
-        <param name="indices" type="const GLuint *"/>
+        <param name="size" type="GLint" counter="true"/>
+        <param name="indices" type="const GLuint *" count="size"/>
+        <glx ignore="true" rop="4328"/>
     </function>
 
     <function name="MatrixIndexPointerARB" offset="?">
@@ -6022,60 +6026,70 @@ glx:
 </category>
 
 <category name="GL_ARB_occlusion_query" number="29">
-    <enum name="QUERY_COUNTER_BITS_ARB"                   value="0x8864"/>
-    <enum name="CURRENT_QUERY_ARB"                        value="0x8865"/>
-    <enum name="QUERY_RESULT_ARB"                         value="0x8866"/>
-    <enum name="QUERY_RESULT_AVAILABLE_ARB"               value="0x8867"/>
+    <enum name="QUERY_COUNTER_BITS_ARB"        count="1"  value="0x8864">
+        <size name="GetQueryivARB" mode="get"/>
+    </enum>
+    <enum name="CURRENT_QUERY_ARB"             count="1"  value="0x8865">
+        <size name="GetQueryivARB" mode="get"/>
+    </enum>
+    <enum name="QUERY_RESULT_ARB"              count="1"  value="0x8866">
+        <size name="GetQueryObjectivARB" mode="get"/>
+        <size name="GetQueryObjectuivARB" mode="get"/>
+    </enum>
+    <enum name="QUERY_RESULT_AVAILABLE_ARB"    count="1"  value="0x8867">
+        <size name="GetQueryObjectivARB" mode="get"/>
+        <size name="GetQueryObjectuivARB" mode="get"/>
+    </enum>
     <enum name="SAMPLES_PASSED_ARB"                       value="0x8914"/>
 
     <function name="GenQueriesARB" offset="700">
         <param name="n" type="GLsizei" counter="true"/>
         <param name="ids" type="GLuint *" output="true" count="n"/>
-        <glx ignore="true"/>
+        <glx sop="162"/>
     </function>
 
     <function name="DeleteQueriesARB" offset="701">
-        <param name="n" type="GLsizei"/>
-        <param name="ids" type="const GLuint *"/>
-        <glx ignore="true"/>
+        <param name="n" type="GLsizei" counter="true"/>
+        <param name="ids" type="const GLuint *" count="n"/>
+        <glx sop="161"/>
     </function>
 
     <function name="IsQueryARB" offset="702">
         <param name="id" type="GLuint"/>
         <return type="GLboolean"/>
-        <glx ignore="true"/>
+        <glx sop="163"/>
     </function>
 
     <function name="BeginQueryARB" offset="703">
         <param name="target" type="GLenum"/>
         <param name="id" type="GLuint"/>
-        <glx ignore="true"/>
+        <glx rop="231"/>
     </function>
 
     <function name="EndQueryARB" offset="704">
         <param name="target" type="GLenum"/>
-        <glx ignore="true"/>
+        <glx rop="232"/>
     </function>
 
     <function name="GetQueryivARB" offset="705">
         <param name="target" type="GLenum"/>
         <param name="pname" type="GLenum"/>
-        <param name="params" type="GLint *" output="true"/>
-        <glx ignore="true"/>
+        <param name="params" type="GLint *" output="true" variable_param="pname"/>
+        <glx sop="164"/>
     </function>
 
     <function name="GetQueryObjectivARB" offset="706">
         <param name="id" type="GLuint"/>
         <param name="pname" type="GLenum"/>
-        <param name="params" type="GLint *" output="true"/>
-        <glx ignore="true"/>
+        <param name="params" type="GLint *" output="true" variable_param="pname"/>
+        <glx sop="165"/>
     </function>
 
     <function name="GetQueryObjectuivARB" offset="707">
         <param name="id" type="GLuint"/>
         <param name="pname" type="GLenum"/>
-        <param name="params" type="GLuint *" output="true"/>
-        <glx ignore="true"/>
+        <param name="params" type="GLuint *" output="true" variable_param="pname"/>
+        <glx sop="166"/>
     </function>
 </category>
 
@@ -6467,7 +6481,7 @@ glx:
     <function name="DrawBuffersARB" offset="413">
         <param name="n" type="GLsizei" counter="true"/>
         <param name="bufs" type="const GLenum *" count="n"/>
-        <glx ignore="true"/>
+        <glx rop="233" large="true"/>
     </function>
 </category>