aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texcompress_fxt1.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/texcompress_fxt1.c')
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c
index eeed78891..f7254f92e 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.c
+++ b/mesalib/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
*
@@ -1643,3 +1611,45 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
decode_1[mode](code, t, rgba);
}
+
+
+
+
+static void
+fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[],
+ GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte rgba[4];
+ fxt1_decode_1(map, 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;
+}
+
+
+static void
+fetch_rgba_fxt1(const GLubyte *map, const GLuint imageOffsets[],
+ GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ GLubyte rgba[4];
+ fxt1_decode_1(map, 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]);
+}
+
+
+compressed_fetch_func
+_mesa_get_fxt_fetch_func(gl_format format)
+{
+ switch (format) {
+ case MESA_FORMAT_RGB_FXT1:
+ return fetch_rgb_fxt1;
+ case MESA_FORMAT_RGBA_FXT1:
+ return fetch_rgba_fxt1;
+ default:
+ return NULL;
+ }
+}