diff options
author | Roland Scheidegger <[email protected]> | 2007-07-18 18:07:12 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2007-07-18 18:07:12 +0200 |
commit | 3f318c2eb98cf7216ae7033806fa764ac40192bf (patch) | |
tree | 5f7d2901e0651966409f9034100dd719263cbb41 /src/mesa | |
parent | ccb713cdb8831617880ac71ac357361b586d05c6 (diff) |
more fixes for mesa's fbo handling (fixes tests/fbotest1/2)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/buffers.c | 5 | ||||
-rw-r--r-- | src/mesa/main/context.c | 5 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 7 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index c280f89e1d1..68a0575d93d 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -557,9 +557,8 @@ _mesa_ReadBuffer(GLenum buffer) } } - if (fb->Name == 0) { - ctx->Pixel.ReadBuffer = buffer; - } + ctx->Pixel.ReadBuffer = buffer; + fb->ColorReadBuffer = buffer; fb->_ColorReadBufferIndex = srcBuffer; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 183a552d406..5239e739568 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1499,6 +1499,11 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, if the DRIdrawable changes, and someone may rely on them. */ /* What a mess!?! */ + /* XXX this is still not quite correct. Imagine a user-created fbo + bound on a context. Now rebind with a completely new drawable. + Upon rebinding to the window-framebuffer, we have no idea what + the read and write buffers should be (front, back, ...) - that + information was only available in the previously used drawable... */ int i; GLenum buffers[MAX_DRAW_BUFFERS]; for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) { diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 5345310ca1f..f300e481ce0 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1003,13 +1003,20 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) if (bindReadBuf) { _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); + /* set context value */ + ctx->Pixel.ReadBuffer = newFbread->ColorReadBuffer; } if (bindDrawBuf) { + GLuint i; /* 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); + /* set context value */ + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + ctx->Color.DrawBuffer[i] = newFb->ColorDrawBuffer[i]; + } if (newFb->Name != 0) { /* check if newly bound framebuffer has any texture attachments */ check_begin_texture_render(ctx, newFb); |