diff options
author | Brian <[email protected]> | 2007-08-16 18:52:48 +0100 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-16 18:52:48 +0100 |
commit | 32d86eb28aedd01a03ceab746214a8db2a4cbbab (patch) | |
tree | 2a6beb7c18ca16070f1e7ed01a89b590c623a92a /src/mesa/main/fbobject.c | |
parent | c033ccc36d08c669dcdfbfc1cf89e472e8211c5f (diff) |
Rework the GL_READ_BUFFER, GL_DRAW_BUFFER state repairs that Roland previously did.
Basically, in update_framebuffer() (which should be called after an FBO is bound
with MakeCurrent or BindFramebuffer) we check if the FBO is a window-system FBO.
If it is, update the FBO's GL_READ/DRAW_BUFFER state according to the context state.
Old code still in place but disabled with #if 0 / #endif.
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r-- | src/mesa/main/fbobject.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index fcb620b39d8..5cd18d02872 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -962,9 +962,11 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } FLUSH_VERTICES(ctx, _NEW_BUFFERS); + if (ctx->Driver.Flush) { ctx->Driver.Flush(ctx); } + if (framebuffer) { /* Binding a user-created framebuffer object */ newFb = _mesa_lookup_framebuffer(ctx, framebuffer); @@ -998,34 +1000,43 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) * XXX check if re-binding same buffer and skip some of this code. */ +#if 000 /* for window-framebuffers, re-initialize the fbo values, as they could be wrong (makecurrent with a new drawable while still a fbo was bound will lead to default init fbo values). note that therefore the context ReadBuffer/DrawBuffer values are not valid while fbo's are bound!!! */ +#endif if (bindReadBuf) { _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); +#if 000 if (!newFbread->Name) { _mesa_readbuffer_update_fields(ctx, ctx->Pixel.ReadBuffer); } +#endif } if (bindDrawBuf) { /* check if old FB had any texture attachments */ check_end_texture_render(ctx, ctx->DrawBuffer); + /* check if time to delete this framebuffer */ _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); - if (!newFb->Name) { + + if (newFb->Name != 0) { + /* check if newly bound framebuffer has any texture attachments */ + check_begin_texture_render(ctx, newFb); + } + else { + /* XXX try to remove this: */ +#if 000 GLuint i; GLenum buffers[MAX_DRAW_BUFFERS]; for(i = 0; i < ctx->Const.MaxDrawBuffers; i++) { buffers[i] = ctx->Color.DrawBuffer[i]; } _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL); - } - else { - /* check if newly bound framebuffer has any texture attachments */ - check_begin_texture_render(ctx, newFb); +#endif } } |