diff options
author | Eric Anholt <[email protected]> | 2013-04-19 11:44:53 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-04-30 10:40:43 -0700 |
commit | 0c883e46d871797cd1141498850d51cde6e54b76 (patch) | |
tree | 54019d9f77240229e7da69de95be45eb47de4984 /src/mesa/main | |
parent | e7ecc11311d142a8ac919627011372a265224bcd (diff) |
swrast: Replace ImageOffsets with an ImageSlices pointer.
This is a step toward allowing drivers to use their normal mapping paths,
instead of requiring that all slice mappings come from an aligned offset
from the first slice's map.
This incidentally fixes missing slice handling in FXT1 swrast.
v2: Use slice height helper function.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/texcompress.c | 2 | ||||
-rw-r--r-- | src/mesa/main/texcompress.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texcompress_etc.c | 51 | ||||
-rw-r--r-- | src/mesa/main/texcompress_fxt1.c | 8 | ||||
-rw-r--r-- | src/mesa/main/texcompress_rgtc.c | 70 | ||||
-rw-r--r-- | src/mesa/main/texcompress_s3tc.c | 56 |
6 files changed, 78 insertions, 112 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 94ea0311f7d..2391868a417 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -588,7 +588,7 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height, for (j = 0; j < height; j++) { for (i = 0; i < width; i++) { - fetch(src, NULL, stride, i, j, 0, dest); + fetch(src, stride, i, j, dest); dest += 4; } } diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 03e537ba13b..c27fc26c90f 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -51,9 +51,8 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, /** A function to fetch one texel from a compressed texture */ typedef void (*compressed_fetch_func)(const GLubyte *map, - const GLuint imageOffsets[], GLint rowStride, - GLint i, GLint j, GLint k, + GLint i, GLint j, GLfloat *texel); extern compressed_fetch_func diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c index 442f844a5a7..a06d29f19aa 100644 --- a/src/mesa/main/texcompress_etc.c +++ b/src/mesa/main/texcompress_etc.c @@ -1222,8 +1222,8 @@ _mesa_unpack_etc2_format(uint8_t *dst_row, static void -fetch_etc1_rgb8(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, +fetch_etc1_rgb8(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc1_block block; @@ -1243,9 +1243,8 @@ fetch_etc1_rgb8(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_etc2_rgb8(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_rgb8(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[3]; @@ -1265,9 +1264,8 @@ fetch_etc2_rgb8(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_srgb8(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_srgb8(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[3]; @@ -1287,9 +1285,8 @@ fetch_etc2_srgb8(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_rgba8_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_rgba8_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[4]; @@ -1307,9 +1304,8 @@ fetch_etc2_rgba8_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_srgb8_alpha8_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_srgb8_alpha8_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[4]; @@ -1327,9 +1323,8 @@ fetch_etc2_srgb8_alpha8_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_r11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_r11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst; @@ -1347,9 +1342,8 @@ fetch_etc2_r11_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_rg11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst[2]; @@ -1372,9 +1366,8 @@ fetch_etc2_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_signed_r11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_signed_r11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst; @@ -1392,9 +1385,8 @@ fetch_etc2_signed_r11_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_signed_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_signed_rg11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst[2]; @@ -1418,8 +1410,7 @@ fetch_etc2_signed_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], static void fetch_etc2_rgb8_punchthrough_alpha1(const GLubyte *map, - const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; @@ -1440,10 +1431,8 @@ fetch_etc2_rgb8_punchthrough_alpha1(const GLubyte *map, static void fetch_etc2_srgb8_punchthrough_alpha1(const GLubyte *map, - const GLuint imageOffsets[], GLint rowStride, - GLint i, GLint j, GLint k, - GLfloat *texel) + GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[4]; diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 92a10a351e4..93bd19a9a99 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -1616,8 +1616,8 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */ static void -fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgb_fxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte rgba[4]; fxt1_decode_1(map, rowStride, i, j, rgba); @@ -1629,8 +1629,8 @@ fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_rgba_fxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_fxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte rgba[4]; fxt1_decode_1(map, rowStride, i, j, rgba); diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index a7006614367..7afd8ffa7a6 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -318,12 +318,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) static void -fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_red_rgtc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); + unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = 0.0; texel[BCOMP] = 0.0; @@ -331,12 +330,11 @@ fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_l_latc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); + unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT(red); @@ -344,13 +342,11 @@ fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_red_rgtc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map + sliceOffset, + signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map, i, j, &red, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); texel[GCOMP] = 0.0; @@ -359,13 +355,11 @@ fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_l_latc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(rowStride, (GLbyte *) map + sliceOffset, + signed_fetch_texel_rgtc(rowStride, (GLbyte *) map, i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = @@ -374,17 +368,15 @@ fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_rg_rgtc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset, + map, i, j, &red, 2); unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset + 8, + map + 8, i, j, &green, 2); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = UBYTE_TO_FLOAT(green); @@ -393,17 +385,15 @@ fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_la_latc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset, + map, i, j, &red, 2); unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset + 8, + map + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = @@ -413,17 +403,15 @@ fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_rg_rgtc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset, + (GLbyte *) map, i, j, &red, 2); signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset + 8, + (GLbyte *) map + 8, i, j, &green, 2); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); texel[GCOMP] = BYTE_TO_FLOAT_TEX(green); @@ -433,17 +421,15 @@ fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_signed_la_latc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_la_latc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset, + (GLbyte *) map, i, j, &red, 2); signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset + 8, + (GLbyte *) map + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 02f2c7c0ce9..41ea3361308 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -345,13 +345,12 @@ problem(const char *func) static void -fetch_rgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgb_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgb_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgb_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgb_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -363,13 +362,12 @@ fetch_rgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -381,13 +379,12 @@ fetch_rgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_dxt3(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt3) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt3(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt3(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -399,13 +396,12 @@ fetch_rgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rgba_dxt5(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_dxt5(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt5) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt5(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt5(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -418,13 +414,12 @@ fetch_rgba_dxt5(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_srgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgb_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgb_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgb_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgb_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); @@ -436,13 +431,12 @@ fetch_srgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_srgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgba_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); @@ -454,13 +448,12 @@ fetch_srgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_srgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgba_dxt3(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt3) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt3(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt3(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); @@ -472,13 +465,12 @@ fetch_srgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_srgba_dxt5(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgba_dxt5(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt5) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt5(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt5(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); |