[Mesa-dev] [PATCH 09/27] intel: Enable support for GL_COMPRESSED_SRGB_ETC2 textures

Anuj Phogat anuj.phogat at gmail.com
Fri Oct 19 16:28:44 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   |    3 ++-
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h   |    4 ++--
 src/mesa/main/texcompress_etc.c                  |    1 +
 4 files changed, 6 insertions(+), 3 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 d3af2ce..6c6a52e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -562,6 +562,7 @@ brw_init_surface_formats(struct brw_context *brw)
     * during glCompressedTexImage2D(). See intel_mipmap_tree::wraps_etc2.
     */
    ctx->TextureFormatSupported[MESA_FORMAT_ETC2_RGB8] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_ETC2_SRGB8] = 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 7ab147c..87a685e 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -209,7 +209,8 @@ intel_miptree_create(struct intel_context *intel,
       wraps_etc1 = true;
    }
 
-   if (format == MESA_FORMAT_ETC2_RGB8) {
+   if (format == MESA_FORMAT_ETC2_RGB8 ||
+       format == MESA_FORMAT_ETC2_SRGB8) {
       etc2_format = format;
       format = MESA_FORMAT_RGBX8888_REV;
       wraps_etc2 = true;
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 095d45b..e5ab000 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -357,8 +357,8 @@ struct intel_mipmap_tree
     * \brief The miptree contains RGBX data that was originally ETC1/ETC2 data.
     *
     * On hardware that lacks support for ETC1 textures, we do the following
-    * on calls to glCompressedTexImage2D() with format GL_ETC1_RGB8_OES or
-    * GL_COMPRESSED_RGB_ETC2:
+    * on calls to glCompressedTexImage2D() with format GL_ETC1_RGB8_OES,
+    * GL_COMPRESSED_RGB_ETC2 or GL_COMPRESSED_SRGB_ETC2:
     *   1. Create a miptree whose format is MESA_FORMAT_RGBX8888_REV with
     *      the wraps_etc1 / wraps_etc2 flag set.
     *   2. Translate the ETC1 / ETC2 data into RGBX.
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index 6589c8d..b217b6a 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -26,6 +26,7 @@
  * GL_OES_compressed_ETC1_RGB8_texture support.
  * Supported ETC2 texture formats are:
  * GL_COMPRESSED_RGB8_ETC2
+ * GL_COMPRESSED_SRGB8_ETC2
  */
 
 
-- 
1.7.7.6



More information about the mesa-dev mailing list