}
}
- if (fb->Name == 0) {
- ctx->Pixel.ReadBuffer = buffer;
- }
+ ctx->Pixel.ReadBuffer = buffer;
+
fb->ColorReadBuffer = buffer;
fb->_ColorReadBufferIndex = srcBuffer;
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++) {
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);