aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-10-03 13:44:53 -0600
committerBrian <[email protected]>2007-10-03 13:50:11 -0600
commite6f4af6b236fcf077cef2ea74346fa9b97106b95 (patch)
treed6b3541cd80c7f252b4c2260c00d2dda596fb225
parent76e61556e7b69b6ce11be4bd600590a049bfbbef (diff)
added s8z24_get_tile()
-rwxr-xr-xsrc/mesa/pipe/softpipe/sp_surface.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index b06f6813c0c..574b474ba3b 100755
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -695,6 +695,42 @@ s8z24_write_quad_stencil(struct softpipe_surface *sps,
}
+/**
+ * Note, the actual returned pixels are uint, not float
+ */
+static void
+s8z24_get_tile(struct pipe_surface *ps,
+ unsigned x, unsigned y, unsigned w, unsigned h, float *p)
+{
+ const uint *src
+ = ((const uint *) (ps->region->map + ps->offset))
+ + y * ps->region->pitch + x;
+ unsigned i, j;
+ unsigned w0 = w;
+
+ assert(ps->format == PIPE_FORMAT_S8_Z24);
+
+#if 0
+ assert(x + w <= ps->width);
+ assert(y + h <= ps->height);
+#else
+ /* temp clipping hack */
+ if (x + w > ps->width)
+ w = ps->width - x;
+ if (y + h > ps->height)
+ h = ps->height -y;
+#endif
+ for (i = 0; i < h; i++) {
+ uint *pRow = (uint *) p;
+ for (j = 0; j < w; j++) {
+ pRow[j] = src[j];
+ }
+ src += ps->region->pitch;
+ p += w0;
+ }
+}
+
+
/*** PIPE_FORMAT_U_S8 ***/
static void
@@ -784,6 +820,7 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
sps->write_quad_z = s8z24_write_quad_z;
sps->read_quad_stencil = s8z24_read_quad_stencil;
sps->write_quad_stencil = s8z24_write_quad_stencil;
+ sps->surface.get_tile = s8z24_get_tile;
break;
case PIPE_FORMAT_U_S8: