summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-07 15:44:58 -0700
committerBrian <[email protected]>2007-12-07 15:44:58 -0700
commitc69c7a6054ad038f9da85c1e0d0af39094ae443e (patch)
treefcd2bc1f9b695d3bd4b760072bceb67a4ed23c99 /src/mesa
parent57df347bb8a119e1d00fe808e30a0623e0ae8563 (diff)
Convert the clearValue back to floats for sp_tile_cache_clear()
It might be nice if sp->clear() took the color/value as floats...
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index a4276362b99..2b24ea63ab7 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -57,10 +57,38 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
}
else if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[0])) {
float clear[4];
- clear[0] = 0.2f; /* XXX hack */
- clear[1] = 0.2f; /* XXX hack */
- clear[2] = 0.2f; /* XXX hack */
- clear[3] = 0.2f; /* XXX hack */
+ /* 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_U_R8_G8_B8_A8:
+ r = (clearValue >> 24) & 0xff;
+ g = (clearValue >> 16) & 0xff;
+ g = (clearValue >> 8) & 0xff;
+ a = (clearValue ) & 0xff;
+ break;
+ case PIPE_FORMAT_U_A8_R8_G8_B8:
+ r = (clearValue >> 16) & 0xff;
+ g = (clearValue >> 8) & 0xff;
+ b = (clearValue ) & 0xff;
+ a = (clearValue >> 24) & 0xff;
+ break;
+ case PIPE_FORMAT_U_B8_G8_R8_A8:
+ 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);
}