From 8aa209c766b79144db499063dd1c8482562b07bf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 27 Jan 2009 19:10:43 -0800 Subject: Make GL_ARB_draw_buffers mandatory Signed-off-by: Ian Romanick --- src/mesa/main/buffers.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index b23d2f612b..dc415c4f20 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -289,10 +289,6 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (!ctx->Extensions.ARB_draw_buffers) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB"); - return; - } if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)"); return; -- cgit v1.2.3 From 1ca05a066b8d8cb8a99da88743a48f7d97f695fe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Feb 2009 14:22:12 -0700 Subject: mesa: more info in error messages --- src/mesa/main/buffers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index dc415c4f20..7877ee0045 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -247,13 +247,14 @@ _mesa_DrawBuffer(GLenum buffer) destMask = draw_buffer_enum_to_bitmask(buffer); if (destMask == BAD_MASK) { /* totally bogus buffer */ - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer=0x%x)", buffer); return; } destMask &= supportedMask; if (destMask == 0x0) { /* none of the named color buffers exist! */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(buffer)"); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawBuffer(buffer=0x%x)", buffer); return; } } -- cgit v1.2.3 From 5de5ab428cf5516d91daa3f193a76b0d87853f55 Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Thu, 12 Feb 2009 13:47:36 -0700 Subject: glDrawBuffers(n==0) is valid According to the GL spec, calling glDrawBuffers() with n == 0 is a valid operation (and essentially prevents drawing to any buffers). But _msa_DrawBuffersARB() was producing a GL_INVALID_VALUE error in this case. This fix adjusts the error check, and makes a small change to the ctx->Driver.DrawBuffer() call below to ensure that, if n == 0, Driver.DrawBuffer() is called with GL_NONE and that buffers[0] is *not* referenced in this case (since we don't know whether it is valid). Internal identifier: 365833 --- src/mesa/main/buffers.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/buffers.c') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 818d068a12..85db3868c4 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -290,7 +290,10 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) { + /* Turns out n==0 is a valid input that should not produce an error. + * The remaining code below correctly handles the n==0 case. + */ + if (n < 0 || n > (GLsizei) ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)"); return; } @@ -332,12 +335,14 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) _mesa_drawbuffers(ctx, n, buffers, destMask); /* - * Call device driver function. + * Call device driver function. Note that n can be equal to 0, + * in which case we don't want to reference buffers[0], which + * may not be valid. */ if (ctx->Driver.DrawBuffers) ctx->Driver.DrawBuffers(ctx, n, buffers); else if (ctx->Driver.DrawBuffer) - ctx->Driver.DrawBuffer(ctx, buffers[0]); + ctx->Driver.DrawBuffer(ctx, n>0? buffers[0]:GL_NONE); } -- cgit v1.2.3