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/texcompress_s3tc.c | |
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/texcompress_s3tc.c')
-rw-r--r-- | src/mesa/main/texcompress_s3tc.c | 56 |
1 files changed, 24 insertions, 32 deletions
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]); |