diff options
author | marha <marha@users.sourceforge.net> | 2011-09-09 16:49:03 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-09 16:49:03 +0200 |
commit | 05cf7dd22994a1dbfd3580b00690c01c392a5797 (patch) | |
tree | ec1c29b5f8a67c54b13b44f1eb7aa700f91fef9e /mesalib/src/mesa/main/texcompress.c | |
parent | 0947b921a3223c14322f10d83e71618d1724b734 (diff) | |
parent | f9cf11136d65f20aab4fb6d5fc3ec3c59185a0b4 (diff) | |
download | vcxsrv-05cf7dd22994a1dbfd3580b00690c01c392a5797.tar.gz vcxsrv-05cf7dd22994a1dbfd3580b00690c01c392a5797.tar.bz2 vcxsrv-05cf7dd22994a1dbfd3580b00690c01c392a5797.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/include/GL/internal/dri_interface.h
mesalib/scons/gallium.py
mesalib/src/glsl/ast_to_hir.cpp
mesalib/src/glsl/glsl_parser_extras.cpp
mesalib/src/glsl/ir_variable.cpp
mesalib/src/glsl/linker.cpp
mesalib/src/mesa/SConscript
mesalib/src/mesa/drivers/common/driverfuncs.c
mesalib/src/mesa/main/compiler.h
mesalib/src/mesa/main/formats.c
mesalib/src/mesa/main/formats.h
mesalib/src/mesa/main/texcompress.c
mesalib/src/mesa/main/texgetimage.c
mesalib/src/mesa/sources.mak
Diffstat (limited to 'mesalib/src/mesa/main/texcompress.c')
-rw-r--r-- | mesalib/src/mesa/main/texcompress.c | 89 |
1 files changed, 88 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c index 532f79fd5..b821dd0c0 100644 --- a/mesalib/src/mesa/main/texcompress.c +++ b/mesalib/src/mesa/main/texcompress.c @@ -37,6 +37,9 @@ #include "mfeatures.h"
#include "mtypes.h"
#include "texcompress.h"
+#include "texcompress_fxt1.h"
+#include "texcompress_rgtc.h"
+#include "texcompress_s3tc.h"
/**
@@ -259,7 +262,6 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats) n += 4;
}
}
- return n;
#if FEATURE_ES1 || FEATURE_ES2
if (formats) {
@@ -278,6 +280,8 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats) n += 10;
}
#endif
+
+ return n;
}
@@ -437,3 +441,86 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, return (GLubyte *) image + offset;
}
+
+
+/**
+ * Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image.
+ */
+void
+_mesa_decompress_image(gl_format format, GLuint width, GLuint height,
+ const GLubyte *src, GLint srcRowStride,
+ GLfloat *dest)
+{
+ void (*fetch)(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+ struct gl_texture_image texImage; /* dummy teximage */
+ GLuint i, j;
+
+ /* setup dummy texture image info */
+ memset(&texImage, 0, sizeof(texImage));
+ texImage.Data = (void *) src;
+ texImage.RowStride = srcRowStride;
+
+ switch (format) {
+ /* DXT formats */
+ case MESA_FORMAT_RGB_DXT1:
+ fetch = _mesa_fetch_texel_2d_f_rgb_dxt1;
+ break;
+ case MESA_FORMAT_RGBA_DXT1:
+ fetch = _mesa_fetch_texel_2d_f_rgba_dxt1;
+ break;
+ case MESA_FORMAT_RGBA_DXT3:
+ fetch = _mesa_fetch_texel_2d_f_rgba_dxt3;
+ break;
+ case MESA_FORMAT_RGBA_DXT5:
+ fetch = _mesa_fetch_texel_2d_f_rgba_dxt5;
+ break;
+
+ /* FXT1 formats */
+ case MESA_FORMAT_RGB_FXT1:
+ fetch = _mesa_fetch_texel_2d_f_rgb_fxt1;
+ break;
+ case MESA_FORMAT_RGBA_FXT1:
+ fetch = _mesa_fetch_texel_2d_f_rgba_fxt1;
+ break;
+
+ /* Red/RG formats */
+ case MESA_FORMAT_RED_RGTC1:
+ fetch = _mesa_fetch_texel_2d_f_red_rgtc1;
+ break;
+ case MESA_FORMAT_SIGNED_RED_RGTC1:
+ fetch = _mesa_fetch_texel_2d_f_signed_red_rgtc1;
+ break;
+ case MESA_FORMAT_RG_RGTC2:
+ fetch = _mesa_fetch_texel_2d_f_rg_rgtc2;
+ break;
+ case MESA_FORMAT_SIGNED_RG_RGTC2:
+ fetch = _mesa_fetch_texel_2d_f_signed_rg_rgtc2;
+ break;
+
+ /* L/LA formats */
+ case MESA_FORMAT_L_LATC1:
+ fetch = _mesa_fetch_texel_2d_f_l_latc1;
+ break;
+ case MESA_FORMAT_SIGNED_L_LATC1:
+ fetch = _mesa_fetch_texel_2d_f_signed_l_latc1;
+ break;
+ case MESA_FORMAT_LA_LATC2:
+ fetch = _mesa_fetch_texel_2d_f_la_latc2;
+ break;
+ case MESA_FORMAT_SIGNED_LA_LATC2:
+ fetch = _mesa_fetch_texel_2d_f_signed_la_latc2;
+ break;
+
+ default:
+ _mesa_problem(NULL, "Unexpected format in _mesa_decompress_image()");
+ return;
+ }
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ fetch(&texImage, i, j, 0, dest);
+ dest += 4;
+ }
+ }
+}
|