aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/x11/xm_surface.c113
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c493
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.h39
3 files changed, 54 insertions, 591 deletions
diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c
index 8d2c2ca5f38..562ec76636b 100644
--- a/src/mesa/drivers/x11/xm_surface.c
+++ b/src/mesa/drivers/x11/xm_surface.c
@@ -76,108 +76,6 @@ xmesa_rb(struct softpipe_surface *sps)
#define FLIP(Y) Y = xrb->St.Base.Height - (Y) - 1;
-/**
- * quad reading/writing
- * These functions are just wrappers around the existing renderbuffer
- * functions.
- * Note that Y=0 is the top of the surface.
- */
-
-static void
-read_quad_f(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GLubyte temp[16];
- GLfloat *dst = (GLfloat *) rgba;
- GLuint i;
- GET_CURRENT_CONTEXT(ctx);
- FLIP(y);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8);
- for (i = 0; i < 16; i++) {
- dst[i] = UBYTE_TO_FLOAT(temp[i]);
- }
-}
-
-static void
-read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GLubyte temp[16];
- GLfloat *dst = (GLfloat *) rrrr;
- GLuint i, j;
- GET_CURRENT_CONTEXT(ctx);
- FLIP(y);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8);
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- dst[j * 4 + i] = UBYTE_TO_FLOAT(temp[i * 4 + j]);
- }
- }
-}
-
-static void
-write_quad_f(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GLubyte temp[16];
- const GLfloat *src = (const GLfloat *) rgba;
- GLuint i;
- GET_CURRENT_CONTEXT(ctx);
- FLIP(y);
- for (i = 0; i < 16; i++) {
- UNCLAMPED_FLOAT_TO_UBYTE(temp[i], src[i]);
- }
- xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
- xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8, NULL);
-}
-
-static void
-write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GLubyte temp[16];
- const GLfloat *src = (const GLfloat *) rrrr;
- GLuint i, j;
- GET_CURRENT_CONTEXT(ctx);
- FLIP(y);
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + i], src[i * 4 + j]);
- }
- }
- xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
- xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8, NULL);
-}
-
-static void
-read_quad_ub(struct softpipe_surface *sps, GLint x, GLint y,
- GLubyte (*rgba)[NUM_CHANNELS])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GET_CURRENT_CONTEXT(ctx);
- FLIP(y);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, rgba + 2);
-}
-
-static void
-write_quad_ub(struct softpipe_surface *sps, GLint x, GLint y,
- GLubyte (*rgba)[NUM_CHANNELS])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GET_CURRENT_CONTEXT(ctx);
- FLIP(y);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, rgba + 2);
-}
-
-
static void
get_tile(struct pipe_surface *ps,
GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p)
@@ -243,21 +141,10 @@ xmesa_new_color_surface(struct pipe_context *pipe, GLuint pipeFormat)
switch (pipeFormat) {
case PIPE_FORMAT_U_A8_R8_G8_B8:
- xms->surface.read_quad_f_swz = read_quad_f;
- xms->surface.read_quad_f = read_quad_f;
- xms->surface.read_quad_f_swz = read_quad_f_swz;
- xms->surface.read_quad_ub = read_quad_ub;
- xms->surface.write_quad_f = write_quad_f;
- xms->surface.write_quad_f_swz = write_quad_f_swz;
- xms->surface.write_quad_ub = write_quad_ub;
xms->surface.surface.get_tile = get_tile;
xms->surface.surface.put_tile = put_tile;
break;
case PIPE_FORMAT_S8_Z24:
- /*
- xms->surface.read_quad_z = 1;
- xms->surface.write_quad_z = 1;
- */
break;
default:
abort();
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index fb8c8d08265..40f045800f2 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -34,12 +34,6 @@
/**
* Softpipe surface functions.
- * Basically, create surface of a particular type, then plug in default
- * read/write_quad and get/put_tile() functions.
- * Note that these quad funcs assume the buffer/region is in a linear
- * layout with Y=0=top.
- * If we had swizzled/AOS buffers the read/write quad functions could be
- * simplified a lot....
*/
@@ -76,56 +70,6 @@
/*** PIPE_FORMAT_U_A8_R8_G8_B8 ***/
static void
-a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- const unsigned *src
- = ((const unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8);
-#if 0
- assert(x < (int) sps->surface.width - 1);
- assert(y < (int) sps->surface.height - 1);
-#endif
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- const unsigned p = src[j];
- rrrr[0][i * 2 + j] = UBYTE_TO_FLOAT((p >> 16) & 0xff); /*R*/
- rrrr[1][i * 2 + j] = UBYTE_TO_FLOAT((p >> 8) & 0xff); /*G*/
- rrrr[2][i * 2 + j] = UBYTE_TO_FLOAT((p ) & 0xff); /*B*/
- rrrr[3][i * 2 + j] = UBYTE_TO_FLOAT((p >> 24) & 0xff); /*A*/
- }
- src += sps->surface.region->pitch;
- }
-}
-
-static void
-a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- unsigned *dst
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- ubyte r, g, b, a;
- UNCLAMPED_FLOAT_TO_UBYTE(r, rrrr[0][i * 2 + j]); /*R*/
- UNCLAMPED_FLOAT_TO_UBYTE(g, rrrr[1][i * 2 + j]); /*G*/
- UNCLAMPED_FLOAT_TO_UBYTE(b, rrrr[2][i * 2 + j]); /*B*/
- UNCLAMPED_FLOAT_TO_UBYTE(a, rrrr[3][i * 2 + j]); /*A*/
- dst[j] = (a << 24) | (r << 16) | (g << 8) | b;
- }
- dst += sps->surface.region->pitch;
- }
-}
-
-static void
a8r8g8b8_get_tile(struct pipe_surface *ps,
unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
@@ -217,42 +161,6 @@ a1r5g5b5_get_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_U_Z16 ***/
-static void
-z16_read_quad_z(struct softpipe_surface *sps,
- int x, int y, unsigned zzzz[QUAD_SIZE])
-{
- const ushort *src
- = ((const ushort *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_U_Z16);
-
- /* converting ushort to unsigned: */
- zzzz[0] = src[0];
- zzzz[1] = src[1];
- src += sps->surface.region->pitch;
- zzzz[2] = src[0];
- zzzz[3] = src[1];
-}
-
-static void
-z16_write_quad_z(struct softpipe_surface *sps,
- int x, int y, const unsigned zzzz[QUAD_SIZE])
-{
- ushort *dst
- = ((ushort *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_U_Z16);
-
- /* converting unsigned to ushort: */
- dst[0] = zzzz[0];
- dst[1] = zzzz[1];
- dst += sps->surface.region->pitch;
- dst[0] = zzzz[2];
- dst[1] = zzzz[3];
-}
-
/**
* Return as floats in [0,1].
*/
@@ -287,51 +195,6 @@ z16_get_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_U_L8 ***/
static void
-l8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- const ubyte *src
- = ((const ubyte *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_L8);
- assert(x < (int) sps->surface.width - 1);
- assert(y < (int) sps->surface.height - 1);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- rrrr[0][i * 2 + j] =
- rrrr[1][i * 2 + j] =
- rrrr[2][i * 2 + j] = UBYTE_TO_FLOAT(src[j]);
- rrrr[3][i * 2 + j] = 1.0F;
- }
- src += sps->surface.region->pitch;
- }
-}
-
-static void
-l8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- ubyte *dst
- = ((ubyte *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_L8);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- ubyte r;
- UNCLAMPED_FLOAT_TO_UBYTE(r, rrrr[0][i * 2 + j]); /*R*/
- dst[j] = r;
- }
- dst += sps->surface.region->pitch;
- }
-}
-
-static void
l8_get_tile(struct pipe_surface *ps,
unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
@@ -363,51 +226,6 @@ l8_get_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_U_A8 ***/
static void
-a8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- const ubyte *src
- = ((const ubyte *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_A8);
- assert(x < (int) sps->surface.width - 1);
- assert(y < (int) sps->surface.height - 1);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- rrrr[0][i * 2 + j] =
- rrrr[1][i * 2 + j] =
- rrrr[2][i * 2 + j] = 0.0F;
- rrrr[3][i * 2 + j] = UBYTE_TO_FLOAT(src[j]);
- }
- src += sps->surface.region->pitch;
- }
-}
-
-static void
-a8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- ubyte *dst
- = ((ubyte *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_A8);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- ubyte r;
- UNCLAMPED_FLOAT_TO_UBYTE(r, rrrr[3][i * 2 + j]); /*A*/
- dst[j] = r;
- }
- dst += sps->surface.region->pitch;
- }
-}
-
-static void
a8_get_tile(struct pipe_surface *ps,
unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
@@ -508,51 +326,6 @@ r16g16b16a16_put_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_U_I8 ***/
static void
-i8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- const ubyte *src
- = ((const ubyte *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_I8);
- assert(x < (int) sps->surface.width - 1);
- assert(y < (int) sps->surface.height - 1);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- rrrr[0][i * 2 + j] =
- rrrr[1][i * 2 + j] =
- rrrr[2][i * 2 + j] =
- rrrr[3][i * 2 + j] = UBYTE_TO_FLOAT(src[j]);
- }
- src += sps->surface.region->pitch;
- }
-}
-
-static void
-i8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- ubyte *dst
- = ((ubyte *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_I8);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- ubyte r;
- UNCLAMPED_FLOAT_TO_UBYTE(r, rrrr[0][i * 2 + j]); /*R*/
- dst[j] = r;
- }
- dst += sps->surface.region->pitch;
- }
-}
-
-static void
i8_get_tile(struct pipe_surface *ps,
unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
@@ -584,53 +357,6 @@ i8_get_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_U_A8_L8 ***/
static void
-a8_l8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- const ushort *src
- = ((const ushort *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_A8_L8);
- assert(x < (int) sps->surface.width - 1);
- assert(y < (int) sps->surface.height - 1);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- const ushort p = src[j];
- rrrr[0][i * 2 + j] =
- rrrr[1][i * 2 + j] =
- rrrr[2][i * 2 + j] = UBYTE_TO_FLOAT(p >> 8);
- rrrr[3][i * 2 + j] = UBYTE_TO_FLOAT(p & 0xff);
- }
- src += sps->surface.region->pitch;
- }
-}
-
-static void
-a8_l8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
- float (*rrrr)[QUAD_SIZE])
-{
- ushort *dst
- = ((ushort *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
- unsigned i, j;
-
- assert(sps->surface.format == PIPE_FORMAT_U_A8_L8);
-
- for (i = 0; i < 2; i++) { /* loop over pixel row */
- for (j = 0; j < 2; j++) { /* loop over pixel column */
- ubyte l, a;
- UNCLAMPED_FLOAT_TO_UBYTE(l, rrrr[0][i * 2 + j]); /*R*/
- UNCLAMPED_FLOAT_TO_UBYTE(a, rrrr[3][i * 2 + j]); /*A*/
- dst[j] = (l << 8) | a;
- }
- dst += sps->surface.region->pitch;
- }
-}
-
-static void
a8_l8_get_tile(struct pipe_surface *ps,
unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
@@ -664,40 +390,6 @@ a8_l8_get_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_U_Z32 ***/
-static void
-z32_read_quad_z(struct softpipe_surface *sps,
- int x, int y, unsigned zzzz[QUAD_SIZE])
-{
- const unsigned *src
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_U_Z32);
-
- zzzz[0] = src[0];
- zzzz[1] = src[1];
- src += sps->surface.region->pitch;
- zzzz[2] = src[0];
- zzzz[3] = src[1];
-}
-
-static void
-z32_write_quad_z(struct softpipe_surface *sps,
- int x, int y, const unsigned zzzz[QUAD_SIZE])
-{
- unsigned *dst
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_U_Z32);
-
- dst[0] = zzzz[0];
- dst[1] = zzzz[1];
- dst += sps->surface.region->pitch;
- dst[0] = zzzz[2];
- dst[1] = zzzz[3];
-}
-
/**
* Return as floats in [0,1].
*/
@@ -729,80 +421,6 @@ z32_get_tile(struct pipe_surface *ps,
/*** PIPE_FORMAT_S8_Z24 ***/
-static void
-s8z24_read_quad_z(struct softpipe_surface *sps,
- int x, int y, unsigned zzzz[QUAD_SIZE])
-{
- static const unsigned mask = 0x00ffffff;
- const unsigned *src
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
-
- /* extract lower three bytes */
- zzzz[0] = src[0] & mask;
- zzzz[1] = src[1] & mask;
- src += sps->surface.region->pitch;
- zzzz[2] = src[0] & mask;
- zzzz[3] = src[1] & mask;
-}
-
-static void
-s8z24_write_quad_z(struct softpipe_surface *sps,
- int x, int y, const unsigned zzzz[QUAD_SIZE])
-{
- static const unsigned mask = 0xff000000;
- unsigned *dst
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
- assert(zzzz[0] <= 0xffffff);
-
- dst[0] = (dst[0] & mask) | zzzz[0];
- dst[1] = (dst[1] & mask) | zzzz[1];
- dst += sps->surface.region->pitch;
- dst[0] = (dst[0] & mask) | zzzz[2];
- dst[1] = (dst[1] & mask) | zzzz[3];
-}
-
-static void
-s8z24_read_quad_stencil(struct softpipe_surface *sps,
- int x, int y, ubyte ssss[QUAD_SIZE])
-{
- const unsigned *src
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
-
- ssss[0] = src[0] >> 24;
- ssss[1] = src[1] >> 24;
- src += sps->surface.region->pitch;
- ssss[2] = src[0] >> 24;
- ssss[3] = src[1] >> 24;
-}
-
-static void
-s8z24_write_quad_stencil(struct softpipe_surface *sps,
- int x, int y, const ubyte ssss[QUAD_SIZE])
-{
- static const unsigned mask = 0x00ffffff;
- unsigned *dst
- = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
-
- dst[0] = (dst[0] & mask) | (ssss[0] << 24);
- dst[1] = (dst[1] & mask) | (ssss[1] << 24);
- dst += sps->surface.region->pitch;
- dst[0] = (dst[0] & mask) | (ssss[2] << 24);
- dst[1] = (dst[1] & mask) | (ssss[3] << 24);
-}
-
-
/**
* Return Z component as float in [0,1]. Stencil part ignored.
*/
@@ -832,43 +450,6 @@ s8z24_get_tile(struct pipe_surface *ps,
}
-/*** PIPE_FORMAT_U_S8 ***/
-
-static void
-s8_read_quad_stencil(struct softpipe_surface *sps,
- int x, int y, ubyte ssss[QUAD_SIZE])
-{
- const ubyte *src
- = sps->surface.region->map + sps->surface.offset
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_U_S8);
-
- ssss[0] = src[0];
- ssss[1] = src[1];
- src += sps->surface.region->pitch;
- ssss[2] = src[0];
- ssss[3] = src[1];
-}
-
-static void
-s8_write_quad_stencil(struct softpipe_surface *sps,
- int x, int y, const ubyte ssss[QUAD_SIZE])
-{
- ubyte *dst
- = sps->surface.region->map + sps->surface.offset
- + y * sps->surface.region->pitch + x;
-
- assert(sps->surface.format == PIPE_FORMAT_U_S8);
-
- dst[0] = ssss[0];
- dst[1] = ssss[1];
- dst += sps->surface.region->pitch;
- dst[0] = ssss[2];
- dst[1] = ssss[3];
-}
-
-
/**
* Get raw tile, any 32-bit pixel format.
*/
@@ -979,6 +560,57 @@ put_tile_raw16(struct pipe_surface *ps,
}
+/**
+ * Get raw tile, any 16-bit pixel format.
+ */
+static void
+get_tile_raw8(struct pipe_surface *ps,
+ uint x, uint y, uint w, uint h, void *p)
+{
+ const ubyte *src
+ = ((const ubyte *) (ps->region->map + ps->offset))
+ + y * ps->region->pitch + x;
+ ubyte *pDest = (ubyte *) p;
+ uint i;
+ uint w0 = w;
+
+ assert(ps->format == PIPE_FORMAT_U_Z16);
+
+ CLIP_TILE;
+
+ for (i = 0; i < h; i++) {
+ memcpy(pDest, src, w * sizeof(ubyte));
+ src += ps->region->pitch;
+ pDest += w0;
+ }
+}
+
+/**
+ * Put raw tile, any 16-bit pixel format.
+ */
+static void
+put_tile_raw8(struct pipe_surface *ps,
+ uint x, uint y, uint w, uint h, const void *p)
+{
+ ubyte *dst
+ = ((ubyte *) (ps->region->map + ps->offset))
+ + y * ps->region->pitch + x;
+ const ubyte *pSrc = (const ubyte *) p;
+ unsigned i;
+ unsigned w0 = w;
+
+ assert(ps->format == PIPE_FORMAT_U_Z16);
+
+ CLIP_TILE;
+
+ for (i = 0; i < h; i++) {
+ memcpy(dst, pSrc, w * sizeof(ubyte));
+ dst += ps->region->pitch;
+ pSrc += w0;
+ }
+}
+
+
/**
@@ -991,8 +623,6 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
switch (sps->surface.format) {
case PIPE_FORMAT_U_A8_R8_G8_B8:
- sps->read_quad_f_swz = a8r8g8b8_read_quad_f_swz;
- sps->write_quad_f_swz = a8r8g8b8_write_quad_f_swz;
sps->surface.get_tile = a8r8g8b8_get_tile;
sps->surface.put_tile = a8r8g8b8_put_tile;
break;
@@ -1000,23 +630,15 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
sps->surface.get_tile = a1r5g5b5_get_tile;
break;
case PIPE_FORMAT_U_L8:
- sps->read_quad_f_swz = l8_read_quad_f_swz;
- sps->write_quad_f_swz = l8_write_quad_f_swz;
sps->surface.get_tile = l8_get_tile;
break;
case PIPE_FORMAT_U_A8:
- sps->read_quad_f_swz = a8_read_quad_f_swz;
- sps->write_quad_f_swz = a8_write_quad_f_swz;
sps->surface.get_tile = a8_get_tile;
break;
case PIPE_FORMAT_U_I8:
- sps->read_quad_f_swz = i8_read_quad_f_swz;
- sps->write_quad_f_swz = i8_write_quad_f_swz;
sps->surface.get_tile = i8_get_tile;
break;
case PIPE_FORMAT_U_A8_L8:
- sps->read_quad_f_swz = a8_l8_read_quad_f_swz;
- sps->write_quad_f_swz = a8_l8_write_quad_f_swz;
sps->surface.get_tile = a8_l8_get_tile;
break;
@@ -1026,32 +648,23 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
break;
case PIPE_FORMAT_U_Z16:
- sps->read_quad_z = z16_read_quad_z;
- sps->write_quad_z = z16_write_quad_z;
sps->surface.get_tile = z16_get_tile;
sps->surface.get_tile_raw = get_tile_raw16;
sps->surface.put_tile_raw = put_tile_raw16;
break;
case PIPE_FORMAT_U_Z32:
- sps->read_quad_z = z32_read_quad_z;
- sps->write_quad_z = z32_write_quad_z;
sps->surface.get_tile = z32_get_tile;
sps->surface.get_tile_raw = get_tile_raw32;
sps->surface.put_tile_raw = put_tile_raw32;
break;
case PIPE_FORMAT_S8_Z24:
- sps->read_quad_z = s8z24_read_quad_z;
- 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;
sps->surface.get_tile_raw = get_tile_raw32;
sps->surface.put_tile_raw = put_tile_raw32;
break;
-
case PIPE_FORMAT_U_S8:
- sps->read_quad_stencil = s8_read_quad_stencil;
- sps->write_quad_stencil = s8_write_quad_stencil;
+ sps->surface.get_tile_raw = get_tile_raw8;
+ sps->surface.put_tile_raw = put_tile_raw8;
break;
default:
assert(0);
diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/mesa/pipe/softpipe/sp_surface.h
index 522f7612ab9..06c0a01aee5 100644
--- a/src/mesa/pipe/softpipe/sp_surface.h
+++ b/src/mesa/pipe/softpipe/sp_surface.h
@@ -46,44 +46,7 @@ struct softpipe_tile_cache;
struct softpipe_surface {
struct pipe_surface surface;
- /**
- * Functions for read/writing surface data
- */
- void (*read_quad_f)( struct softpipe_surface *,
- int x, int y,
- float (*rgba)[NUM_CHANNELS] );
-
- void (*read_quad_f_swz)( struct softpipe_surface *,
- int x, int y,
- float (*rrrr)[QUAD_SIZE] );
-
- void (*read_quad_ub)( struct softpipe_surface *,
- int x, int y,
- ubyte (*rgba)[NUM_CHANNELS] );
-
-
- void (*write_quad_f)( struct softpipe_surface *,
- int x, int y,
- float (*rgba)[NUM_CHANNELS] );
-
- void (*write_quad_f_swz)( struct softpipe_surface *,
- int x, int y,
- float (*rrrr)[QUAD_SIZE] );
-
-
- void (*write_quad_ub)( struct softpipe_surface *,
- int x, int y,
- ubyte (*rgba)[NUM_CHANNELS] );
-
- void (*read_quad_z)(struct softpipe_surface *,
- int x, int y, unsigned zzzz[QUAD_SIZE]);
- void (*write_quad_z)(struct softpipe_surface *,
- int x, int y, const unsigned zzzz[QUAD_SIZE]);
-
- void (*read_quad_stencil)(struct softpipe_surface *,
- int x, int y, ubyte ssss[QUAD_SIZE]);
- void (*write_quad_stencil)(struct softpipe_surface *,
- int x, int y, const ubyte ssss[QUAD_SIZE]);
+ /* no softpipe-specific extras now */
};