summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe/sp_clear.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-06-20 09:41:41 -0600
committerBrian <[email protected]>2007-06-20 09:41:41 -0600
commit837f2c18c477f0695150b69b69a3a921b08943ec (patch)
tree5011c142da13673ded864ab8c56b979fecaa63ef /src/mesa/pipe/softpipe/sp_clear.c
parent73f96c51052bf5233191d852ef463462306bf1d5 (diff)
implement softpipe clearing (untested)
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_clear.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index c7fbca42290..536f0d39243 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -31,16 +31,40 @@
#include "sp_clear.h"
+#include "sp_context.h"
+#include "sp_surface.h"
+#include "colormac.h"
void
softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth,
GLboolean stencil, GLboolean accum)
{
- /* validate state (scissor)? */
+ struct softpipe_context *softpipe = softpipe_context(pipe);
if (color) {
+ GLuint i;
+ const GLint x = softpipe->scissor.minx;
+ const GLint y = softpipe->scissor.miny;
+ const GLint w = softpipe->scissor.maxx - x;
+ const GLint h = softpipe->scissor.maxy - y;
+ GLubyte clr[4];
+
+ UNCLAMPED_FLOAT_TO_UBYTE(clr[0], softpipe->clear_color.color[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clr[1], softpipe->clear_color.color[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clr[2], softpipe->clear_color.color[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clr[3], softpipe->clear_color.color[3]);
+
+ for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
+ struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
+ struct softpipe_surface *sps = softpipe_surface(ps);
+ GLint j;
+ for (j = 0; j < h; j++) {
+ sps->write_mono_row_ub(sps, w, x, y + j, clr);
+ }
+ }
}
+
if (depth) {
}