{
uint i;
- for (i = 0; i < lp->framebuffer.nr_cbufs; i++)
- lp_flush_tile_cache(lp->cbuf_cache[i]);
- lp_flush_tile_cache(lp->zsbuf_cache);
-
for (i = 0; i < lp->framebuffer.nr_cbufs; i++) {
lp_tile_cache_unmap_transfers(lp->cbuf_cache[i]);
}
+
lp_tile_cache_unmap_transfers(lp->zsbuf_cache);
}
}
}
- 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->cbuf_cache[i]);
- if (llvmpipe->zsbuf_cache)
- lp_flush_tile_cache(llvmpipe->zsbuf_cache);
-
/* Need this call for hardware buffers before swapbuffers.
*
* there should probably be another/different flush-type function
* 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_flush_tile_cache(llvmpipe->cbuf_cache[i]);
+
+ if (llvmpipe->zsbuf_cache)
+ lp_flush_tile_cache(llvmpipe->zsbuf_cache);
+
llvmpipe->dirty_render_cache = FALSE;
}