mesa: bump GL_MAX_ELEMENTS_INDICES and GL_MAX_ELEMENTS_VERTICES
[mesa.git] / src / mesa / main / buffers.c
index d3640479f002ecd7dc6f823e56b89a8475bdc1de..bb856882da2ff1031b11ee083e0366a146008627 100644 (file)
@@ -299,14 +299,15 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
    }
 
    /* if we get here, there's no error so set new state */
-   _mesa_drawbuffers(ctx, fb, 1, &buffer, &destMask);
+   const GLenum16 buffer16 = buffer;
+   _mesa_drawbuffers(ctx, fb, 1, &buffer16, &destMask);
 
    /* Call device driver function only if fb is the bound draw buffer */
    if (fb == ctx->DrawBuffer) {
-      if (ctx->Driver.DrawBuffers)
-         ctx->Driver.DrawBuffers(ctx, 1, &buffer);
-      else if (ctx->Driver.DrawBuffer)
-         ctx->Driver.DrawBuffer(ctx, buffer);
+      if (ctx->Driver.DrawBuffer)
+         ctx->Driver.DrawBuffer(ctx);
+      if (ctx->Driver.DrawBufferAllocate)
+         ctx->Driver.DrawBufferAllocate(ctx);
    }
 }
 
@@ -573,7 +574,11 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n,
    }
 
    /* OK, if we get here, there were no errors so set the new state */
-   _mesa_drawbuffers(ctx, fb, n, buffers, destMask);
+   GLenum16 buffers16[MAX_DRAW_BUFFERS];
+   for (int i = 0; i < n; i++)
+      buffers16[i] = buffers[i];
+
+   _mesa_drawbuffers(ctx, fb, n, buffers16, destMask);
 
    /*
     * Call device driver function if fb is the bound draw buffer.
@@ -582,10 +587,10 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n,
     * may not be valid.
     */
    if (fb == ctx->DrawBuffer) {
-      if (ctx->Driver.DrawBuffers)
-         ctx->Driver.DrawBuffers(ctx, n, buffers);
-      else if (ctx->Driver.DrawBuffer)
-         ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
+      if (ctx->Driver.DrawBuffer)
+         ctx->Driver.DrawBuffer(ctx);
+      if (ctx->Driver.DrawBufferAllocate)
+         ctx->Driver.DrawBufferAllocate(ctx);
    }
 }
 
@@ -694,7 +699,8 @@ updated_drawbuffers(struct gl_context *ctx, struct gl_framebuffer *fb)
  */
 void
 _mesa_drawbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
-                  GLuint n, const GLenum *buffers, const GLbitfield *destMask)
+                  GLuint n, const GLenum16 *buffers,
+                  const GLbitfield *destMask)
 {
    GLbitfield mask[MAX_DRAW_BUFFERS];
    GLuint buf;