diff options
author | Brian Paul <[email protected]> | 2012-12-08 15:19:44 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-12-14 06:33:08 -0700 |
commit | b29f2d5ff54c5031e5b0f0ae9f89acb4eb38b219 (patch) | |
tree | cca1301e76e47c380dc526ce759106dff2cdd948 /src/mesa/main | |
parent | 7dc36a50de516d95fc6edc58cf1ab5cd7129e95a (diff) |
mesa: remove old swrast-based compressed texel fetch code
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/texcompress_etc.c | 244 | ||||
-rw-r--r-- | src/mesa/main/texcompress_etc.h | 46 | ||||
-rw-r--r-- | src/mesa/main/texcompress_fxt1.c | 32 | ||||
-rw-r--r-- | src/mesa/main/texcompress_fxt1.h | 8 | ||||
-rw-r--r-- | src/mesa/main/texcompress_rgtc.c | 132 | ||||
-rw-r--r-- | src/mesa/main/texcompress_rgtc.h | 34 | ||||
-rw-r--r-- | src/mesa/main/texcompress_s3tc.c | 165 | ||||
-rw-r--r-- | src/mesa/main/texcompress_s3tc.h | 32 |
8 files changed, 1 insertions, 692 deletions
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c index c8bf6eab44f..57c42c41f2c 100644 --- a/src/mesa/main/texcompress_etc.c +++ b/src/mesa/main/texcompress_etc.c @@ -43,9 +43,9 @@ #include "texcompress_etc.h" #include "texstore.h" #include "macros.h" -#include "swrast/s_context.h" #include "format_unpack.h" + struct etc2_block { int distance; uint64_t pixel_indices[2]; @@ -113,25 +113,6 @@ _mesa_texstore_etc1_rgb8(TEXSTORE_PARAMS) return GL_FALSE; } -void -_mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc1_block block; - GLubyte dst[3]; - const GLubyte *src; - - src = (const GLubyte *) texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc1_parse_block(&block, src); - etc1_fetch_texel(&block, i % 4, j % 4, dst); - - texel[RCOMP] = UBYTE_TO_FLOAT(dst[0]); - texel[GCOMP] = UBYTE_TO_FLOAT(dst[1]); - texel[BCOMP] = UBYTE_TO_FLOAT(dst[2]); - texel[ACOMP] = 1.0f; -} /** * Decode texture data in format `MESA_FORMAT_ETC1_RGB8` to @@ -1166,229 +1147,6 @@ _mesa_texstore_etc2_srgb8_punchthrough_alpha1(TEXSTORE_PARAMS) return GL_FALSE; } -void -_mesa_fetch_texel_2d_f_etc2_rgb8(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc2_block block; - uint8_t dst[3]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc2_rgb8_parse_block(&block, src, - false /* punchthrough_alpha */); - etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst, - false /* punchthrough_alpha */); - - texel[RCOMP] = UBYTE_TO_FLOAT(dst[0]); - texel[GCOMP] = UBYTE_TO_FLOAT(dst[1]); - texel[BCOMP] = UBYTE_TO_FLOAT(dst[2]); - texel[ACOMP] = 1.0f; -} - -void -_mesa_fetch_texel_2d_f_etc2_srgb8(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc2_block block; - uint8_t dst[3]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc2_rgb8_parse_block(&block, src, - false /* punchthrough_alpha */); - etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst, - false /* punchthrough_alpha */); - - texel[RCOMP] = _mesa_nonlinear_to_linear(dst[0]); - texel[GCOMP] = _mesa_nonlinear_to_linear(dst[1]); - texel[BCOMP] = _mesa_nonlinear_to_linear(dst[2]); - texel[ACOMP] = 1.0f; -} - -void -_mesa_fetch_texel_2d_f_etc2_rgba8_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc2_block block; - uint8_t dst[4]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 16; - - etc2_rgba8_parse_block(&block, src); - etc2_rgba8_fetch_texel(&block, i % 4, j % 4, dst); - - texel[RCOMP] = UBYTE_TO_FLOAT(dst[0]); - texel[GCOMP] = UBYTE_TO_FLOAT(dst[1]); - texel[BCOMP] = UBYTE_TO_FLOAT(dst[2]); - texel[ACOMP] = UBYTE_TO_FLOAT(dst[3]); -} - -void -_mesa_fetch_texel_2d_f_etc2_srgb8_alpha8_eac(const struct - swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel) -{ - struct etc2_block block; - uint8_t dst[4]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 16; - - etc2_rgba8_parse_block(&block, src); - etc2_rgba8_fetch_texel(&block, i % 4, j % 4, dst); - - texel[RCOMP] = _mesa_nonlinear_to_linear(dst[0]); - texel[GCOMP] = _mesa_nonlinear_to_linear(dst[1]); - texel[BCOMP] = _mesa_nonlinear_to_linear(dst[2]); - texel[ACOMP] = UBYTE_TO_FLOAT(dst[3]); -} - -void -_mesa_fetch_texel_2d_f_etc2_r11_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc2_block block; - GLushort dst; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc2_r11_parse_block(&block, src); - etc2_r11_fetch_texel(&block, i % 4, j % 4, (uint8_t *)&dst); - - texel[RCOMP] = USHORT_TO_FLOAT(dst); - texel[GCOMP] = 0.0f; - texel[BCOMP] = 0.0f; - texel[ACOMP] = 1.0f; -} - -void -_mesa_fetch_texel_2d_f_etc2_rg11_eac(const struct - swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel) -{ - struct etc2_block block; - GLushort dst[2]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 16; - - /* red component */ - etc2_r11_parse_block(&block, src); - etc2_r11_fetch_texel(&block, i % 4, j % 4, (uint8_t *)dst); - - /* green component */ - etc2_r11_parse_block(&block, src + 8); - etc2_r11_fetch_texel(&block, i % 4, j % 4, (uint8_t *)(dst + 1)); - - texel[RCOMP] = USHORT_TO_FLOAT(dst[0]); - texel[GCOMP] = USHORT_TO_FLOAT(dst[1]); - texel[BCOMP] = 0.0f; - texel[ACOMP] = 1.0f; -} - -void -_mesa_fetch_texel_2d_f_etc2_signed_r11_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc2_block block; - GLushort dst; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc2_r11_parse_block(&block, src); - etc2_signed_r11_fetch_texel(&block, i % 4, j % 4, (uint8_t *)&dst); - - texel[RCOMP] = SHORT_TO_FLOAT(dst); - texel[GCOMP] = 0.0f; - texel[BCOMP] = 0.0f; - texel[ACOMP] = 1.0f; -} - -void -_mesa_fetch_texel_2d_f_etc2_signed_rg11_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - struct etc2_block block; - GLushort dst[2]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 16; - - /* red component */ - etc2_r11_parse_block(&block, src); - etc2_signed_r11_fetch_texel(&block, i % 4, j % 4, (uint8_t *)dst); - - /* green component */ - etc2_r11_parse_block(&block, src + 8); - etc2_signed_r11_fetch_texel(&block, i % 4, j % 4, (uint8_t *)(dst + 1)); - - texel[RCOMP] = SHORT_TO_FLOAT(dst[0]); - texel[GCOMP] = SHORT_TO_FLOAT(dst[1]); - texel[BCOMP] = 0.0f; - texel[ACOMP] = 1.0f; -} - -void -_mesa_fetch_texel_2d_f_etc2_rgb8_punchthrough_alpha1( - const struct swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel) -{ - struct etc2_block block; - uint8_t dst[4]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc2_rgb8_parse_block(&block, src, - true /* punchthrough alpha */); - etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst, - true /* punchthrough alpha */); - texel[RCOMP] = UBYTE_TO_FLOAT(dst[0]); - texel[GCOMP] = UBYTE_TO_FLOAT(dst[1]); - texel[BCOMP] = UBYTE_TO_FLOAT(dst[2]); - texel[ACOMP] = UBYTE_TO_FLOAT(dst[3]); -} - -void -_mesa_fetch_texel_2d_f_etc2_srgb8_punchthrough_alpha1( - const struct swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel) -{ - struct etc2_block block; - uint8_t dst[4]; - const uint8_t *src; - - src = texImage->Map + - (((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8; - - etc2_rgb8_parse_block(&block, src, - true /* punchthrough alpha */); - etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst, - true /* punchthrough alpha */); - texel[RCOMP] = _mesa_nonlinear_to_linear(dst[0]); - texel[GCOMP] = _mesa_nonlinear_to_linear(dst[1]); - texel[BCOMP] = _mesa_nonlinear_to_linear(dst[2]); - texel[ACOMP] = UBYTE_TO_FLOAT(dst[3]); -} /** * Decode texture data in any one of following formats: diff --git a/src/mesa/main/texcompress_etc.h b/src/mesa/main/texcompress_etc.h index 09d62de81bc..503d0388ac6 100644 --- a/src/mesa/main/texcompress_etc.h +++ b/src/mesa/main/texcompress_etc.h @@ -31,8 +31,6 @@ #include "texstore.h" -struct swrast_texture_image; - GLboolean _mesa_texstore_etc1_rgb8(TEXSTORE_PARAMS); @@ -67,50 +65,6 @@ GLboolean _mesa_texstore_etc2_srgb8_punchthrough_alpha1(TEXSTORE_PARAMS); void -_mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_rgb8(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_srgb8(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -void -_mesa_fetch_texel_2d_f_etc2_rgba8_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_srgb8_alpha8_eac(const struct - swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_r11_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_rg11_eac(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_signed_r11_eac(const struct - swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_signed_rg11_eac(const struct - swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_rgb8_punchthrough_alpha1( - const struct swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel); -void -_mesa_fetch_texel_2d_f_etc2_srgb8_punchthrough_alpha1( - const struct swrast_texture_image *texImage, - GLint i, GLint j, - GLint k, GLfloat *texel); -void _mesa_etc1_unpack_rgba8888(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 6a0f8560532..f7254f92e29 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -39,7 +39,6 @@ #include "texcompress.h" #include "texcompress_fxt1.h" #include "texstore.h" -#include "swrast/s_context.h" static void @@ -151,37 +150,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) } -void -_mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - (void) k; - fxt1_decode_1(texImage->Map, texImage->RowStride, i, j, rgba); - texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); - texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); - texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - - -void -_mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - (void) k; - fxt1_decode_1(texImage->Map, texImage->RowStride, i, j, rgba); - texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); - texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); - texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); - texel[ACOMP] = 1.0F; -} - - - /***************************************************************************\ * FXT1 encoder * diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h index f60f19675d2..5949df90f0e 100644 --- a/src/mesa/main/texcompress_fxt1.h +++ b/src/mesa/main/texcompress_fxt1.h @@ -29,7 +29,6 @@ #include "mfeatures.h" #include "texstore.h" -struct swrast_texture_image; extern GLboolean _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS); @@ -37,13 +36,6 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS); -extern void -_mesa_fetch_texel_2d_f_rgba_fxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_2d_f_rgb_fxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); compressed_fetch_func _mesa_get_fxt_fetch_func(gl_format format); diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index de71f5da04b..fa9172aa282 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -43,7 +43,6 @@ #include "texcompress.h" #include "texcompress_rgtc.h" #include "texstore.h" -#include "swrast/s_context.h" #define RGTC_DEBUG 0 @@ -291,137 +290,6 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) return GL_TRUE; } -void -_mesa_fetch_texel_red_rgtc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLubyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 1); - texel[RCOMP] = UBYTE_TO_FLOAT(red); - texel[GCOMP] = 0.0; - texel[BCOMP] = 0.0; - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_signed_red_rgtc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLbyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 1); - texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); - texel[GCOMP] = 0.0; - texel[BCOMP] = 0.0; - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_rg_rgtc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLubyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 2); - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset + 8, - i, j, &green, 2); - texel[RCOMP] = UBYTE_TO_FLOAT(red); - texel[GCOMP] = UBYTE_TO_FLOAT(green); - texel[BCOMP] = 0.0; - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_signed_rg_rgtc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLbyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 2); - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset + 8, - i, j, &green, 2); - texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); - texel[GCOMP] = BYTE_TO_FLOAT_TEX(green); - texel[BCOMP] = 0.0; - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_l_latc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLubyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_FLOAT(red); - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_signed_l_latc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLbyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = BYTE_TO_FLOAT_TEX(red); - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_la_latc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLubyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 2); - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset + 8, - i, j, &green, 2); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_FLOAT(red); - texel[ACOMP] = UBYTE_TO_FLOAT(green); -} - -void -_mesa_fetch_texel_signed_la_latc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLbyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 2); - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset + 8, - i, j, &green, 2); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = BYTE_TO_FLOAT_TEX(red); - texel[ACOMP] = BYTE_TO_FLOAT_TEX(green); -} #define TAG(x) unsigned_##x diff --git a/src/mesa/main/texcompress_rgtc.h b/src/mesa/main/texcompress_rgtc.h index daa92d8839f..9e1cce43840 100644 --- a/src/mesa/main/texcompress_rgtc.h +++ b/src/mesa/main/texcompress_rgtc.h @@ -28,7 +28,6 @@ #include "mfeatures.h" #include "texstore.h" -struct swrast_texture_image; extern GLboolean _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS); @@ -42,39 +41,6 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS); -extern void -_mesa_fetch_texel_red_rgtc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_signed_red_rgtc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_rg_rgtc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_signed_rg_rgtc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_l_latc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_signed_l_latc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_la_latc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_signed_la_latc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - - extern compressed_fetch_func _mesa_get_compressed_rgtc_func(gl_format format); diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 9595c849b53..23a5a086816 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -44,7 +44,6 @@ #include "texcompress.h" #include "texcompress_s3tc.h" #include "texstore.h" -#include "swrast/s_context.h" #include "format_unpack.h" @@ -332,170 +331,6 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) } -static void -fetch_texel_2d_rgb_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLubyte *texel) -{ - if (fetch_ext_rgb_dxt1) { - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - fetch_ext_rgb_dxt1(texImage->RowStride, - texImage->Map + sliceOffset, i, j, texel); - } - else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1"); -} - - -void -_mesa_fetch_texel_rgb_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba); - texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); - texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); - texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - - -static void -fetch_texel_2d_rgba_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLubyte *texel) -{ - if (fetch_ext_rgba_dxt1) { - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - fetch_ext_rgba_dxt1(texImage->RowStride, - texImage->Map + sliceOffset, i, j, texel); - } - else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n"); -} - - -void -_mesa_fetch_texel_rgba_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba); - texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); - texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); - texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - - -static void -fetch_texel_2d_rgba_dxt3(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLubyte *texel) -{ - if (fetch_ext_rgba_dxt3) { - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - fetch_ext_rgba_dxt3(texImage->RowStride, - texImage->Map + sliceOffset, i, j, texel); - } - else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n"); -} - - -void -_mesa_fetch_texel_rgba_dxt3(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba); - texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); - texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); - texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - - -static void -fetch_texel_2d_rgba_dxt5(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLubyte *texel) -{ - if (fetch_ext_rgba_dxt5) { - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - fetch_ext_rgba_dxt5(texImage->RowStride, - texImage->Map + sliceOffset, i, j, texel); - } - else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n"); -} - - -void -_mesa_fetch_texel_rgba_dxt5(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba); - texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]); - texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]); - texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - -void -_mesa_fetch_texel_srgb_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba); - texel[RCOMP] = _mesa_nonlinear_to_linear(rgba[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(rgba[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - -void -_mesa_fetch_texel_srgba_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba); - texel[RCOMP] = _mesa_nonlinear_to_linear(rgba[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(rgba[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - -void -_mesa_fetch_texel_srgba_dxt3(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba); - texel[RCOMP] = _mesa_nonlinear_to_linear(rgba[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(rgba[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - -void -_mesa_fetch_texel_srgba_dxt5(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - /* just sample as GLubyte and convert to float here */ - GLubyte rgba[4]; - fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba); - texel[RCOMP] = _mesa_nonlinear_to_linear(rgba[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(rgba[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(rgba[BCOMP]); - texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]); -} - - /** Report problem with dxt texture decompression, once */ static void problem(const char *func) diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h index 5758e8365c1..d9ef6899250 100644 --- a/src/mesa/main/texcompress_s3tc.h +++ b/src/mesa/main/texcompress_s3tc.h @@ -32,7 +32,6 @@ #include "texcompress.h" struct gl_context; -struct swrast_texture_image; extern GLboolean _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS); @@ -46,37 +45,6 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS); -extern void -_mesa_fetch_texel_rgb_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_rgba_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_rgba_dxt3(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_rgba_dxt5(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_srgb_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_srgba_dxt1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_srgba_dxt3(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); - -extern void -_mesa_fetch_texel_srgba_dxt5(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel); extern void _mesa_init_texture_s3tc(struct gl_context *ctx); |