mesa: Fix display list handling for GL_ARB_draw_instanced.
authorEric Anholt <eric@anholt.net>
Tue, 28 Feb 2012 21:33:51 +0000 (13:33 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Feb 2012 21:21:12 +0000 (13:21 -0800)
When you called them in a display list compile before, you would just
end up calling through NULL.

Fixes piglit GL_ARB_draw_instanced/dlist.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/api_validate.c
src/mesa/main/dlist.c

index 1ae491f25b5d8141be3e0dfff2c1cc04f4fa04fe..b10d8cd053c9b568260ac0e9450479d6da6ce606 100644 (file)
@@ -399,12 +399,6 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
    if (!check_valid_to_render(ctx, "glDrawArraysInstanced(invalid to render)"))
       return GL_FALSE;
 
-   if (ctx->CompileFlag) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glDrawArraysInstanced(display list");
-      return GL_FALSE;
-   }
-
    if (ctx->Const.CheckArrayBounds) {
       if (first + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
          return GL_FALSE;
index 677debffcb77959f712572db775acb326206adc9..0eefd4026172de17735b57c223775d925edc985b 100644 (file)
@@ -1300,6 +1300,30 @@ save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
 }
 
 
+/* GL_ARB_draw_instanced. */
+static void GLAPIENTRY
+save_DrawArraysInstancedARB(GLenum mode,
+                           GLint first,
+                           GLsizei count,
+                           GLsizei primcount)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_error(ctx, GL_INVALID_OPERATION,
+              "glDrawArraysInstanced() during display list compile");
+}
+
+static void GLAPIENTRY
+save_DrawElementsInstancedARB(GLenum mode,
+                             GLsizei count,
+                             GLenum type,
+                             const GLvoid *indices,
+                             GLsizei primcount)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_error(ctx, GL_INVALID_OPERATION,
+              "glDrawElementsInstanced() during display list compile");
+}
+
 static void invalidate_saved_current_state( struct gl_context *ctx )
 {
    GLint i;
@@ -10751,6 +10775,10 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
 
    vfmt->Rectf = save_Rectf;
 
+   /* GL_ARB_draw_instanced */
+   vfmt->DrawArraysInstanced = save_DrawArraysInstancedARB;
+   vfmt->DrawElementsInstanced = save_DrawElementsInstancedARB;
+
    /* The driver is required to implement these as
     * 1) They can probably do a better job.
     * 2) A lot of new mechanisms would have to be added to this module