From: Brian Date: Wed, 8 Aug 2007 08:35:16 +0000 (+0100) Subject: more get_tile() work X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f62b573922dd5274c01250fa941f9b1a151e6c45;p=mesa.git more get_tile() work --- diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 87bb64af1a0..85e1fcfa38f 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -322,12 +322,37 @@ a8r8g8b8_get_tile(struct pipe_surface *ps, { const GLuint *src = ((const GLuint *) ps->region->map) + y * ps->region->pitch + x; - assert(w == 1); - assert(h == 1); - p[0] = UBYTE_TO_FLOAT((src[0] >> 16) & 0xff); - p[1] = UBYTE_TO_FLOAT((src[0] >> 8) & 0xff); - p[2] = UBYTE_TO_FLOAT((src[0] >> 0) & 0xff); - p[3] = UBYTE_TO_FLOAT((src[0] >> 24) & 0xff); + GLuint i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + p[0] = UBYTE_TO_FLOAT((src[j] >> 16) & 0xff); + p[1] = UBYTE_TO_FLOAT((src[j] >> 8) & 0xff); + p[2] = UBYTE_TO_FLOAT((src[j] >> 0) & 0xff); + p[3] = UBYTE_TO_FLOAT((src[j] >> 24) & 0xff); + p += 4; + } + src += ps->region->pitch; + } +} + + +static void +a1r5g5b5_get_tile(struct pipe_surface *ps, + GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p) +{ + const GLushort *src + = ((const GLushort *) ps->region->map) + y * ps->region->pitch + x; + GLuint i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + p[0] = ((src[j] >> 10) & 0x1f) * (1.0 / 31); + p[1] = ((src[j] >> 5) & 0x1f) * (1.0 / 31); + p[2] = ((src[j] ) & 0x1f) * (1.0 / 31); + p[3] = src[j] >> 15; + p += 4; + } + src += ps->region->pitch; + } } @@ -358,6 +383,9 @@ init_quad_funcs(struct softpipe_surface *sps) case PIPE_FORMAT_U_A8_R8_G8_B8: sps->surface.get_tile = a8r8g8b8_get_tile; break; + case PIPE_FORMAT_U_A1_R5_G5_B5: + sps->surface.get_tile = a1r5g5b5_get_tile; + break; default: /* assert(0);