summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-11-29 12:49:36 +0800
committerChia-I Wu <[email protected]>2011-12-02 08:43:46 +0800
commitcde6c91fd52ab52a2989ab402239d9d10cedf16f (patch)
treead184705ac09f0245b300d02972a6785fb2941d9
parent5c31eb78e5fa4c4cfcc82df3c9a2c34fcd4b402c (diff)
st/mesa: add support for GL_OES_compressed_ETC1_RGB8_texture
Have st/mesa recognize MESA_FORMAT_ETC1_RGB8 then we are good to advertise the extension. Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_extensions.c8
-rw-r--r--src/mesa/state_tracker/st_format.c12
2 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index cef2088c015..37fb3e7fd7a 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -475,6 +475,14 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE;
}
+ if (ctx->API != API_OPENGL) {
+ if (screen->is_format_supported(screen, PIPE_FORMAT_ETC1_RGB8,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW)) {
+ ctx->Extensions.OES_compressed_ETC1_RGB8_texture = GL_TRUE;
+ }
+ }
+
if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SNORM,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW)) {
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index bc414f442e4..4b34acfc4fa 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -420,6 +420,9 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
case MESA_FORMAT_SIGNED_LA_LATC2:
return PIPE_FORMAT_LATC2_SNORM;
+ case MESA_FORMAT_ETC1_RGB8:
+ return PIPE_FORMAT_ETC1_RGB8;
+
/* signed normalized formats */
case MESA_FORMAT_SIGNED_R8:
return PIPE_FORMAT_R8_SNORM;
@@ -745,6 +748,9 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_LATC2_SNORM:
return MESA_FORMAT_SIGNED_LA_LATC2;
+ case PIPE_FORMAT_ETC1_RGB8:
+ return MESA_FORMAT_ETC1_RGB8;
+
/* signed normalized formats */
case PIPE_FORMAT_R8_SNORM:
return MESA_FORMAT_SIGNED_R8;
@@ -1189,6 +1195,12 @@ static const struct format_mapping format_map[] = {
{ PIPE_FORMAT_LATC2_SNORM, 0 }
},
+ /* ETC1 */
+ {
+ { GL_ETC1_RGB8_OES, 0 },
+ { PIPE_FORMAT_ETC1_RGB8, 0 }
+ },
+
/* signed/unsigned integer formats.
*/
{