intel: fix renderbuffer map/unmap regression
authorBrian Paul <brianp@vmware.com>
Mon, 14 Sep 2009 18:40:53 +0000 (12:40 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 14 Sep 2009 18:42:18 +0000 (12:42 -0600)
Commit 36dd53a3cded9d003ec418732b7fc93c1476aa9b caused a few regressions
because the glReadBuffer() buffer wasn't getting mapped when GL_READ_BUFFER
!= GL_DRAW_BUFFER.

src/mesa/drivers/dri/intel/intel_span.c

index 1e739434577d9a98f119b3772fb7f85df7670d0e..97713076dd5462fd2916f8d2f750345cc543597a 100644 (file)
@@ -448,24 +448,22 @@ intel_map_unmap_framebuffer(struct intel_context *intel,
                            struct gl_framebuffer *fb,
                            GLboolean map)
 {
-   GLcontext *ctx = &intel->ctx;
    GLuint i, j;
 
-   /* color buffers */
-   if (fb == ctx->DrawBuffer) {
-      for (j = 0; j < fb->_NumColorDrawBuffers; j++) {
-        if (map)
-           intel_renderbuffer_map(intel, fb->_ColorDrawBuffers[j]);
-        else
-           intel_renderbuffer_unmap(intel, fb->_ColorDrawBuffers[j]);
-      }
-   } else {
+   /* color draw buffers */
+   for (j = 0; j < fb->_NumColorDrawBuffers; j++) {
       if (map)
-        intel_renderbuffer_map(intel, fb->_ColorReadBuffer);
+         intel_renderbuffer_map(intel, fb->_ColorDrawBuffers[j]);
       else
-        intel_renderbuffer_unmap(intel, fb->_ColorReadBuffer);
+         intel_renderbuffer_unmap(intel, fb->_ColorDrawBuffers[j]);
    }
 
+   /* color read buffer */
+   if (map)
+      intel_renderbuffer_map(intel, fb->_ColorReadBuffer);
+   else
+      intel_renderbuffer_unmap(intel, fb->_ColorReadBuffer);
+
    /* check for render to textures */
    for (i = 0; i < BUFFER_COUNT; i++) {
       struct gl_renderbuffer_attachment *att =
@@ -524,7 +522,8 @@ intelSpanRenderStart(GLcontext * ctx)
    }
 
    intel_map_unmap_framebuffer(intel, ctx->DrawBuffer, GL_TRUE);
-   intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_TRUE);
+   if (ctx->ReadBuffer != ctx->DrawBuffer)
+      intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_TRUE);
 }
 
 /**
@@ -547,7 +546,8 @@ intelSpanRenderFinish(GLcontext * ctx)
    }
 
    intel_map_unmap_framebuffer(intel, ctx->DrawBuffer, GL_FALSE);
-   intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_FALSE);
+   if (ctx->ReadBuffer != ctx->DrawBuffer)
+      intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_FALSE);
 
    UNLOCK_HARDWARE(intel);
 }