summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-11-28 16:57:02 +0800
committerChia-I Wu <[email protected]>2011-12-02 08:43:46 +0800
commitd4a38e86d4b4d66cca20ee63222f940cb73fa709 (patch)
tree059bf69787804996049163ffa2ee809560bfc04a /src/mesa/main/texcompress.c
parent51f4d2725417088c75d512b69a31a26ae5cb3ef2 (diff)
mesa: add support for GL_OES_compressed_ETC1_RGB8_texture
Add support for GL_OES_compressed_ETC1_RGB8_texture to core mesa. There is no driver support yet. Unlike desktop GL compressed texture formats, GLES compressed texture formats usually can only be used with glCompressedTexImage2D. All other gl*Tex*Image* functions are updated to check for that. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/texcompress.c')
-rw-r--r--src/mesa/main/texcompress.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 0458b9b689e..5045aef06cc 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -40,6 +40,7 @@
#include "texcompress_fxt1.h"
#include "texcompress_rgtc.h"
#include "texcompress_s3tc.h"
+#include "texcompress_etc.h"
#include "swrast/s_context.h"
@@ -90,6 +91,7 @@ _mesa_gl_compressed_format_base_format(GLenum format)
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGB_FXT1_3DFX:
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ case GL_ETC1_RGB8_OES:
return GL_RGB;
case GL_COMPRESSED_RGBA:
@@ -264,6 +266,15 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
}
}
+ if (ctx->Extensions.OES_compressed_ETC1_RGB8_texture) {
+ if (formats) {
+ formats[n++] = GL_ETC1_RGB8_OES;
+ }
+ else {
+ n += 1;
+ }
+ }
+
#if FEATURE_ES1
if (ctx->API == API_OPENGLES) {
if (formats) {
@@ -341,6 +352,9 @@ _mesa_glenum_to_compressed_format(GLenum format)
case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
return MESA_FORMAT_SIGNED_LA_LATC2;
+ case GL_ETC1_RGB8_OES:
+ return MESA_FORMAT_ETC1_RGB8;
+
default:
return MESA_FORMAT_NONE;
}
@@ -406,6 +420,9 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
case MESA_FORMAT_SIGNED_LA_LATC2:
return GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT;
+ case MESA_FORMAT_ETC1_RGB8:
+ return GL_ETC1_RGB8_OES;
+
default:
_mesa_problem(ctx, "Unexpected mesa texture format in"
" _mesa_compressed_format_to_glenum()");
@@ -515,6 +532,11 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
fetch = _mesa_fetch_texel_2d_f_signed_la_latc2;
break;
+ /* ETC1 formats */
+ case MESA_FORMAT_ETC1_RGB8:
+ fetch = _mesa_fetch_texel_2d_f_etc1_rgb8;
+ break;
+
default:
_mesa_problem(NULL, "Unexpected format in _mesa_decompress_image()");
return;