aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texcompress_fxt1.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-12-17 12:16:30 +0100
committermarha <marha@users.sourceforge.net>2012-12-17 12:16:30 +0100
commitb3f7d4f6ce0d42d826f384223144936ba6797a10 (patch)
tree2f329beffff890b402625bff8547e243071c47bd /mesalib/src/mesa/main/texcompress_fxt1.c
parentc648afe73ef43a15094508d2dd439e05738735bf (diff)
parent840c8745518b92303d40f6834e9c616587242231 (diff)
downloadvcxsrv-b3f7d4f6ce0d42d826f384223144936ba6797a10.tar.gz
vcxsrv-b3f7d4f6ce0d42d826f384223144936ba6797a10.tar.bz2
vcxsrv-b3f7d4f6ce0d42d826f384223144936ba6797a10.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libXft pixman mesa git update 17 dec 2012 Conflicts: mesalib/src/mesa/drivers/dri/swrast/swrast.c
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;
+ }
+}