diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-12-07 20:13:10 -0700 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2007-12-09 12:05:27 +1100 |
commit | 7c8cc71a28e5d02c01c0a528f1c35f29281e88f2 (patch) | |
tree | 4e55b68faae1997e7019fe56f0d3436c83e8a929 /src/mesa/pipe/softpipe/sp_clear.c | |
parent | 77c7fd3cec458511ea0789130a72e443a8d16d2f (diff) |
Tile clearing optimizations.
Clear using int values rather than floats when possible. Better performance now.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_clear.c')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_clear.c | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index a6352e0616..bfe4a29144 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -51,49 +51,15 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps, softpipe_update_derived(softpipe); /* not needed?? */ if (ps == sp_tile_cache_get_surface(softpipe->zbuf_cache)) { - float clear[4]; - clear[0] = 1.0; /* XXX hack */ - sp_tile_cache_clear(softpipe->zbuf_cache, clear); + sp_tile_cache_clear(softpipe->zbuf_cache, clearValue); } else if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[0])) { - float clear[4]; - /* XXX it sure would be nice if the clear color was passed to - * this function as float[4].... - */ - uint r, g, b, a; - switch (ps->format) { - case PIPE_FORMAT_R8G8B8A8_UNORM: - r = (clearValue >> 24) & 0xff; - g = (clearValue >> 16) & 0xff; - g = (clearValue >> 8) & 0xff; - a = (clearValue ) & 0xff; - break; - case PIPE_FORMAT_A8R8G8B8_UNORM: - r = (clearValue >> 16) & 0xff; - g = (clearValue >> 8) & 0xff; - b = (clearValue ) & 0xff; - a = (clearValue >> 24) & 0xff; - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - r = (clearValue >> 8) & 0xff; - g = (clearValue >> 16) & 0xff; - b = (clearValue >> 24) & 0xff; - a = (clearValue ) & 0xff; - break; - default: - assert(0); - } - - clear[0] = r / 255.0; - clear[1] = g / 255.0; - clear[2] = b / 255.0; - clear[3] = a / 255.0; - - sp_tile_cache_clear(softpipe->cbuf_cache[0], clear); + sp_tile_cache_clear(softpipe->cbuf_cache[0], clearValue); } +#if !TILE_CLEAR_OPTIMIZATION pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); - +#endif #if 0 sp_clear_tile_cache(ps, clearValue); |