summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_clear.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-08-02 13:59:31 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2007-08-02 13:59:31 +0100
commit4f442d9ef5db42867c99a7288b4114a0340f73e6 (patch)
tree10f6dbab05ad7ed5d88b565273263f8f74e23354 /src/mesa/pipe/softpipe/sp_clear.c
parent1ecc648398a51f734ef1e3b729595f41cedf29f9 (diff)
Reroute some clear functionality.
Still require the intelClear() call to flush batchbuffers. That will be removed later...
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_clear.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c70
1 files changed, 21 insertions, 49 deletions
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index a133b48891..09cc643003 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -60,53 +60,20 @@ color_value(GLuint format, const GLfloat color[4])
}
}
-static GLuint
-color_mask(GLuint format, GLuint pipeMask)
-{
- GLuint mask = 0x0;
- switch (format) {
- case PIPE_FORMAT_U_R8_G8_B8_A8:
- if (pipeMask & PIPE_MASK_R) mask |= 0xff000000;
- if (pipeMask & PIPE_MASK_G) mask |= 0x00ff0000;
- if (pipeMask & PIPE_MASK_B) mask |= 0x0000ff00;
- if (pipeMask & PIPE_MASK_A) mask |= 0x000000ff;
- break;
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- if (pipeMask & PIPE_MASK_R) mask |= 0x00ff0000;
- if (pipeMask & PIPE_MASK_G) mask |= 0x0000ff00;
- if (pipeMask & PIPE_MASK_B) mask |= 0x000000ff;
- if (pipeMask & PIPE_MASK_A) mask |= 0xff000000;
- break;
- case PIPE_FORMAT_U_R5_G6_B5:
- if (pipeMask & PIPE_MASK_R) mask |= 0xf800;
- if (pipeMask & PIPE_MASK_G) mask |= 0x07e0;
- if (pipeMask & PIPE_MASK_B) mask |= 0x001f;
- if (pipeMask & PIPE_MASK_A) mask |= 0;
- break;
- default:
- return 0;
- }
- return mask;
-}
-
-/**
- * XXX This should probaby be renamed to something like pipe_clear_with_blits()
- * and moved into a device-independent pipe file.
- */
void
softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
GLboolean stencil, GLboolean accum)
{
- const struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct softpipe_context *softpipe = softpipe_context(pipe);
GLint x, y, w, h;
- softpipe_update_derived(softpipe);
+ softpipe_update_derived(softpipe); /* not needed?? */
- x = softpipe->cliprect.minx;
- y = softpipe->cliprect.miny;
- w = softpipe->cliprect.maxx - x;
- h = softpipe->cliprect.maxy - y;
+ x = 0;
+ y = 0;
+ w = softpipe->framebuffer.cbufs[0]->width;
+ h = softpipe->framebuffer.cbufs[0]->height;
if (color) {
GLuint i;
@@ -114,8 +81,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
GLuint clearVal = color_value(ps->format,
softpipe->clear_color.color);
- GLuint mask = color_mask(ps->format, softpipe->blend.colormask);
- pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
+ pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0);
}
}
@@ -124,10 +90,13 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
/* clear Z and stencil together */
struct pipe_surface *ps = softpipe->framebuffer.zbuf;
if (ps->format == PIPE_FORMAT_S8_Z24) {
- GLuint mask = (softpipe->stencil.write_mask[0] << 8) | 0xffffff;
+ GLuint mask = (softpipe->stencil.write_mask[0] << 8) | 0xffffff;
GLuint clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff);
+
+ assert (mask == ~0);
+
clearVal |= (softpipe->stencil.clear_value << 24);
- pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
+ pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0);
}
else {
/* XXX Z24_S8 format? */
@@ -138,33 +107,36 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
/* separate Z and stencil */
if (depth) {
struct pipe_surface *ps = softpipe->framebuffer.zbuf;
- GLuint mask, clearVal;
+ GLuint clearVal;
switch (ps->format) {
case PIPE_FORMAT_U_Z16:
clearVal = (GLuint) (softpipe->depth_test.clear * 65535.0);
- mask = 0xffff;
break;
case PIPE_FORMAT_U_Z32:
clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffffff);
- mask = 0xffffffff;
break;
case PIPE_FORMAT_S8_Z24:
clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff);
- mask = 0xffffff;
break;
default:
assert(0);
}
- pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
+ pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0);
}
if (stencil) {
struct pipe_surface *ps = softpipe->framebuffer.sbuf;
GLuint clearVal = softpipe->stencil.clear_value;
+
+ /* If this is not ~0, we shouldn't get here - clear should be
+ * done with geometry instead.
+ */
GLuint mask = softpipe->stencil.write_mask[0];
+ assert((mask & 0xff) == 0xff);
+
switch (ps->format) {
case PIPE_FORMAT_S8_Z24:
clearVal = clearVal << 24;
@@ -187,7 +159,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
*/
struct pipe_surface *ps = softpipe->framebuffer.abuf;
GLuint clearVal = 0x0; /* XXX FIX */
- GLuint mask = !0;
+ GLuint mask = ~0;
assert(ps);
pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask);
}