[Mesa-dev] [PATCH 12/27] intel: Enable support for GL_COMPRESSED_RGBA8_ETC2_EAC textures

Anuj Phogat anuj.phogat at gmail.com
Fri Oct 19 16:28:47 PDT 2012


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    1 +
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c   |   22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 6c6a52e..0914afd 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -563,6 +563,7 @@ brw_init_surface_formats(struct brw_context *brw)
     */
    ctx->TextureFormatSupported[MESA_FORMAT_ETC2_RGB8] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_ETC2_SRGB8] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_ETC2_RGBA8_EAC] = true;
 }
 
 bool
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 87a685e..ad0049e 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -204,16 +204,25 @@ intel_miptree_create(struct intel_context *intel,
    gl_format etc2_format;
    GLuint total_width, total_height;
 
-   if (format == MESA_FORMAT_ETC1_RGB8) {
-      format = MESA_FORMAT_RGBX8888_REV;
+   switch(format) {
+   case MESA_FORMAT_ETC1_RGB8:
       wraps_etc1 = true;
-   }
-
-   if (format == MESA_FORMAT_ETC2_RGB8 ||
-       format == MESA_FORMAT_ETC2_SRGB8) {
+      format = MESA_FORMAT_RGBX8888_REV;
+      break;
+   case MESA_FORMAT_ETC2_RGB8:
+   case MESA_FORMAT_ETC2_SRGB8:
       etc2_format = format;
+      wraps_etc2 = true;
       format = MESA_FORMAT_RGBX8888_REV;
+      break;
+   case MESA_FORMAT_ETC2_RGBA8_EAC:
+      etc2_format = format;
       wraps_etc2 = true;
+      format = MESA_FORMAT_RGBA8888_REV;
+      break;
+   default:
+      /* Non ETC1 / ETC2 format */
+      break;
    }
 
    base_format = _mesa_get_format_base_format(format);
@@ -1288,7 +1297,6 @@ intel_miptree_map_etc2(struct intel_context *intel,
     * see intel_mipmap_tree:wraps_etc2.
     */
    assert(mt->wraps_etc2);
-   assert(mt->format == MESA_FORMAT_RGBX8888_REV);
 
    /* intel_miptree_map_etc2() can be called from glCompressedTexImage2D
     * and CompressedTexSubImage2D. Hence the assertions below hold.
-- 
1.7.7.6



More information about the mesa-dev mailing list