Mesa (gallium-0.2): statetracker: copy back color buffer to front buffer when needed

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 19 19:55:55 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: 2fa407be8b982016d355c51bd32f3023b9ee0140
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2fa407be8b982016d355c51bd32f3023b9ee0140

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jan 19 12:53:58 2009 -0700

statetracker: copy back color buffer to front buffer when needed

Fixes front-buffer rendering when following a SwapBuffers.
See progs/tests/rubberband.c

---

 src/mesa/state_tracker/st_atom_framebuffer.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index ca1a719..092cdab 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -34,6 +34,7 @@
 #include "st_context.h"
 #include "st_atom.h"
 #include "st_cb_fbo.h"
+#include "st_public.h"
 #include "st_texture.h"
 #include "pipe/p_context.h"
 #include "pipe/p_inlines.h"
@@ -146,7 +147,18 @@ update_framebuffer_state( struct st_context *st )
 
    if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
       if (st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) {
-         /* XXX copy back buf to front? */
+         /* copy back color buffer to front color buffer */
+         struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
+         struct pipe_surface *surf_front
+            = st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT);
+         struct pipe_surface *surf_back
+            = st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT);
+
+         st->pipe->surface_copy(st->pipe,
+                                FALSE,
+                                surf_front, 0, 0,  /* dest */
+                                surf_back, 0, 0,   /* src */
+                                fb->Width, fb->Height);
       }
       /* we're assuming we'll really draw to the front buffer */
       st->frontbuffer_status = FRONT_STATUS_DIRTY;




More information about the mesa-commit mailing list