code re-org in softpipe_clear()
authorBrian <brian.paul@tungstengraphics.com>
Sat, 8 Dec 2007 03:31:26 +0000 (20:31 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 8 Dec 2007 03:31:26 +0000 (20:31 -0700)
src/mesa/pipe/softpipe/sp_clear.c

index bfe4a291448886b3e35b9e4af082cabfb7fea228..f32e834ac0ef3a1ba56c72b8b9f5e3ddff08f9c1 100644 (file)
@@ -47,19 +47,28 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
                unsigned clearValue)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
+   uint i;
 
+#if 0
    softpipe_update_derived(softpipe); /* not needed?? */
+#endif
 
+#if TILE_CLEAR_OPTIMIZATION
    if (ps == sp_tile_cache_get_surface(softpipe->zbuf_cache)) {
       sp_tile_cache_clear(softpipe->zbuf_cache, clearValue);
+      return;
    }
-   else if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[0])) {
-      sp_tile_cache_clear(softpipe->cbuf_cache[0], clearValue);
+
+   for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+      if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[i])) {
+         sp_tile_cache_clear(softpipe->cbuf_cache[i], clearValue);
+         return;
+      }
    }
+#endif
 
-#if !TILE_CLEAR_OPTIMIZATION
+   /* non-cached surface */
    pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-#endif
 
 #if 0
    sp_clear_tile_cache(ps, clearValue);