gallium: only mark back color buffer surfaces as undefined after swapbuffers
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 11 Dec 2008 01:00:59 +0000 (18:00 -0700)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 11 Dec 2008 01:06:38 +0000 (18:06 -0700)
Marking all surfaces as undefined was wrong and cause some glean failures
because glReadPixels was used after SwapBuffers.

src/mesa/state_tracker/st_framebuffer.c

index 6ee1777fb7adeb3c13319fe074ced49c1c8ed7f2..7d270a3272947444d30c748c8b035587a9f56d7d 100644 (file)
@@ -284,15 +284,17 @@ st_notify_swapbuffers_complete(struct st_framebuffer *stfb)
 
    if (ctx && ctx->DrawBuffer == &stfb->Base) {
       struct st_renderbuffer *strb;
-      int i;
-
-      for (i = 0; i < BUFFER_COUNT; i++) {
-        if (stfb->Base.Attachment[i].Renderbuffer) {
-           strb = st_renderbuffer(stfb->Base.Attachment[i].Renderbuffer);
-            if (strb->surface)
-               strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
-        }
-      }
+
+      /* Mark back color buffers as undefined */
+      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].
+                             Renderbuffer);
+      if (strb && strb->surface)
+         strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
+
+      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_RIGHT].
+                             Renderbuffer);
+      if (strb && strb->surface)
+         strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
    }
 }