summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_region.c
diff options
context:
space:
mode:
authorBrian <brian@i915.localnet.net>2007-08-01 12:58:38 -0600
committerBrian <brian@i915.localnet.net>2007-08-01 12:58:38 -0600
commitfb206809ba2a131fd9034e10a00592f2d0d81fce (patch)
tree16f5f207e20fdb15e69d6bdca9b078fb425cbe04 /src/mesa/pipe/softpipe/sp_region.c
parente99b673cb062a2fead92d1d7d373926d148ade71 (diff)
Checkpoint: glClear changes - working, bug very rough.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_region.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 04ae5e94f9..4d8b35d3e7 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -92,6 +92,59 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
}
+
+static GLubyte *
+get_pointer(struct pipe_region *dst, GLuint x, GLuint y)
+{
+ return dst->map + (y * dst->pitch + x) * dst->cpp;
+}
+
+
+static void
+sp_region_fill(struct pipe_context *pipe,
+ struct pipe_region *dst,
+ GLuint dst_offset,
+ GLuint dstx, GLuint dsty,
+ GLuint width, GLuint height, GLuint value)
+{
+ GLuint i, j;
+ switch (dst->cpp) {
+ case 1:
+ {
+ GLubyte *row = get_pointer(dst, dstx, dsty);
+ for (i = 0; i < height; i++) {
+ memset(row, value, width);
+ row += dst->pitch;
+ }
+ }
+ break;
+ case 2:
+ {
+ GLushort *row = (GLushort *) get_pointer(dst, dstx, dsty);
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++)
+ row[j] = value;
+ row += dst->pitch;
+ }
+ }
+ break;
+ case 4:
+ {
+ GLuint *row = (GLuint *) get_pointer(dst, dstx, dsty);
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++)
+ row[j] = value;
+ row += dst->pitch;
+ }
+ }
+ break;
+ default:
+ assert(0);
+
+ }
+}
+
+
void
sp_init_region_functions(struct softpipe_context *sp)
{
@@ -101,5 +154,7 @@ sp_init_region_functions(struct softpipe_context *sp)
sp->pipe.region_map = sp_region_map;
sp->pipe.region_unmap = sp_region_unmap;
+ sp->pipe.region_fill = sp_region_fill;
+
/* XXX lots of other region functions needed... */
}