diff options
author | Brian Paul <[email protected]> | 2009-08-07 09:24:00 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-07 09:50:38 -0600 |
commit | 94504be63a9a70263a0eb2872295867c989be2b1 (patch) | |
tree | 0bf2133e288d7c0ca954081b4193f09e40362c33 /src/mesa/main/framebuffer.c | |
parent | 2dec62405f9e2e46997046a32211f25ba83d2600 (diff) |
mesa: test DrawBuffer, not ReadBuffer in _mesa_dest_buffer_exists()
Also, update comments.
Diffstat (limited to 'src/mesa/main/framebuffer.c')
-rw-r--r-- | src/mesa/main/framebuffer.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 5a13c88a7ab..9d9c4217a6c 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -817,7 +817,7 @@ _mesa_update_framebuffer(GLcontext *ctx) /** * Check if the renderbuffer for a read operation (glReadPixels, glCopyPixels, - * glCopyTex[Sub]Image, etc. exists. + * glCopyTex[Sub]Image, etc) exists. * \param format a basic image format such as GL_RGB, GL_RGBA, GL_ALPHA, * GL_DEPTH_COMPONENT, etc. or GL_COLOR, GL_DEPTH, GL_STENCIL. * \return GL_TRUE if buffer exists, GL_FALSE otherwise @@ -825,8 +825,10 @@ _mesa_update_framebuffer(GLcontext *ctx) GLboolean _mesa_source_buffer_exists(GLcontext *ctx, GLenum format) { - const struct gl_renderbuffer_attachment *att - = ctx->ReadBuffer->Attachment; + const struct gl_renderbuffer_attachment *att = ctx->ReadBuffer->Attachment; + + /* state validation should have already been done */ + ASSERT(ctx->NewState == 0x0); if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { return GL_FALSE; @@ -850,10 +852,8 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format) if (ctx->ReadBuffer->_ColorReadBuffer == NULL) { return GL_FALSE; } - /* XXX enable this post 6.5 release: ASSERT(ctx->ReadBuffer->_ColorReadBuffer->RedBits > 0 || ctx->ReadBuffer->_ColorReadBuffer->IndexBits > 0); - */ break; case GL_DEPTH: case GL_DEPTH_COMPONENT: @@ -891,13 +891,15 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format) /** * As above, but for drawing operations. - * XXX code do some code merging w/ above function. + * XXX could do some code merging w/ above function. */ GLboolean _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) { - const struct gl_renderbuffer_attachment *att - = ctx->ReadBuffer->Attachment; + const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment; + + /* state validation should have already been done */ + ASSERT(ctx->NewState == 0x0); if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { return GL_FALSE; @@ -918,7 +920,7 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) case GL_BGRA: case GL_ABGR_EXT: case GL_COLOR_INDEX: - /* nothing special */ + /* Nothing special since GL_DRAW_BUFFER could be GL_NONE. */ /* Could assert that colorbuffer has RedBits > 0 */ break; case GL_DEPTH: @@ -945,7 +947,7 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) break; default: _mesa_problem(ctx, - "Unexpected format 0x%x in _mesa_source_buffer_exists", + "Unexpected format 0x%x in _mesa_dest_buffer_exists", format); return GL_FALSE; } |