i965g: fix some reloc counts
[mesa.git] / src / gallium / drivers / llvmpipe / lp_flush.c
index 2bb6414b3f4c6414553265aee97fb9b1eee6da39..cd8381fe3086c1c6702286c488a04ee05cf0bfcd 100644 (file)
@@ -37,6 +37,7 @@
 #include "lp_surface.h"
 #include "lp_state.h"
 #include "lp_tile_cache.h"
+#include "lp_tex_cache.h"
 #include "lp_winsys.h"
 
 
@@ -50,19 +51,17 @@ llvmpipe_flush( struct pipe_context *pipe,
 
    draw_flush(llvmpipe->draw);
 
-   if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
-      for (i = 0; i < llvmpipe->num_textures; i++) {
-         lp_flush_tile_cache(llvmpipe, llvmpipe->tex_cache[i]);
-      }
-   }
-
-   if (flags & PIPE_FLUSH_RENDER_CACHE) {
+   if (flags & PIPE_FLUSH_SWAPBUFFERS) {
+      /* If this is a swapbuffers, just flush color buffers.
+       *
+       * The zbuffer changes are not discarded, but held in the cache
+       * in the hope that a later clear will wipe them out.
+       */
       for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++)
-         if (llvmpipe->cbuf_cache[i])
-            lp_flush_tile_cache(llvmpipe, llvmpipe->cbuf_cache[i]);
-
-      if (llvmpipe->zsbuf_cache)
-         lp_flush_tile_cache(llvmpipe, llvmpipe->zsbuf_cache);
+         if (llvmpipe->cbuf_cache[i]) {
+            lp_tile_cache_map_transfers(llvmpipe->cbuf_cache[i]);
+            lp_flush_tile_cache(llvmpipe->cbuf_cache[i]);
+         }
 
       /* Need this call for hardware buffers before swapbuffers.
        *
@@ -71,7 +70,16 @@ llvmpipe_flush( struct pipe_context *pipe,
        * to unmap surfaces when flushing.
        */
       llvmpipe_unmap_transfers(llvmpipe);
-      
+   }
+   else if (flags & PIPE_FLUSH_RENDER_CACHE) {
+      for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++)
+         if (llvmpipe->cbuf_cache[i]) {
+            lp_tile_cache_map_transfers(llvmpipe->cbuf_cache[i]);
+            lp_flush_tile_cache(llvmpipe->cbuf_cache[i]);
+         }
+
+      /* FIXME: untile zsbuf! */
+     
       llvmpipe->dirty_render_cache = FALSE;
    }