mesa: expose EXT_texture_compression_rgtc on GLES
authorMarek Olšák <marek.olsak@amd.com>
Mon, 6 Aug 2018 02:50:54 +0000 (22:50 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 4 Dec 2018 20:33:29 +0000 (15:33 -0500)
The spec was modified to support GLES. Tested by piglit.

v2: rebase

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
docs/relnotes/19.0.0.html
src/mesa/main/extensions_table.h
src/mesa/main/glformats.c
src/mesa/main/texcompress.c

index 1629e0ba52e100d85dc6c6f990654d6d250cfbd7..4a61420be1acda585551f73592c615682fb823fd 100644 (file)
@@ -40,6 +40,7 @@ TBD.
 
 <ul>
 <li>GL_EXT_shader_implicit_conversions on all drivers (ES extension).</li>
+<li>GL_EXT_texture_compression_rgtc on all GL 3.0 drivers (ES extension).</li>
 <li>GL_EXT_texture_view on drivers supporting texture views (ES extension).</li>
 <li>GL_OES_texture_view on drivers supporting texture views (ES extension).</li>
 </ul>
index 8d6d56c640d8bf724d165d3e95077c887287d4bf..a229f3af2b2e24b7601354deb9cb381e0bd2e182 100644 (file)
@@ -278,7 +278,7 @@ EXT(EXT_texture_border_clamp                , ARB_texture_border_clamp
 EXT(EXT_texture_buffer                      , OES_texture_buffer                     ,  x ,  x ,  x ,  31, 2014)
 EXT(EXT_texture_compression_dxt1            , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2004)
 EXT(EXT_texture_compression_latc            , EXT_texture_compression_latc           , GLL,  x ,  x ,  x , 2006)
-EXT(EXT_texture_compression_rgtc            , ARB_texture_compression_rgtc           , GLL, GLC,  x ,  , 2004)
+EXT(EXT_texture_compression_rgtc            , ARB_texture_compression_rgtc           , GLL, GLC,  x ,  30, 2004)
 EXT(EXT_texture_compression_s3tc            , EXT_texture_compression_s3tc           , GLL, GLC,  x , ES2, 2000)
 EXT(EXT_texture_cube_map                    , ARB_texture_cube_map                   , GLL,  x ,  x ,  x , 2001)
 EXT(EXT_texture_cube_map_array              , OES_texture_cube_map_array             ,  x ,  x ,  x ,  31, 2014)
index ea73068d025793ce20fabec72c9905a05465afd3..a63ccc0e5baa94e1af7ab1e5dd9cacd0e5145645 100644 (file)
@@ -1379,7 +1379,8 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
    case MESA_FORMAT_LAYOUT_FXT1:
       return _mesa_has_3DFX_texture_compression_FXT1(ctx);
    case MESA_FORMAT_LAYOUT_RGTC:
-      return _mesa_has_ARB_texture_compression_rgtc(ctx);
+      return _mesa_has_ARB_texture_compression_rgtc(ctx) ||
+             _mesa_has_EXT_texture_compression_rgtc(ctx);
    case MESA_FORMAT_LAYOUT_LATC:
       return _mesa_has_EXT_texture_compression_latc(ctx);
    case MESA_FORMAT_LAYOUT_ETC1:
@@ -3126,12 +3127,16 @@ _mesa_gles_error_check_format_and_type(const struct gl_context *ctx,
          return GL_INVALID_OPERATION;
       switch (type) {
       case GL_UNSIGNED_BYTE:
-         if (internalFormat != GL_RG8)
+         if (internalFormat != GL_RG8 &&
+             (!_mesa_has_EXT_texture_compression_rgtc(ctx) ||
+              internalFormat != GL_COMPRESSED_RED_GREEN_RGTC2_EXT))
             return GL_INVALID_OPERATION;
          break;
 
       case GL_BYTE:
-         if (internalFormat != GL_RG8_SNORM)
+         if (internalFormat != GL_RG8_SNORM &&
+             (!_mesa_has_EXT_texture_compression_rgtc(ctx) ||
+              internalFormat != GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT))
             return GL_INVALID_OPERATION;
          break;
 
@@ -3229,12 +3234,16 @@ _mesa_gles_error_check_format_and_type(const struct gl_context *ctx,
       case GL_UNSIGNED_BYTE:
          if (internalFormat == GL_R8 ||
              ((internalFormat == GL_SR8_EXT) &&
-              _mesa_has_EXT_texture_sRGB_R8(ctx)))
+              _mesa_has_EXT_texture_sRGB_R8(ctx)) ||
+             (internalFormat == GL_COMPRESSED_RED_RGTC1_EXT &&
+              _mesa_has_EXT_texture_compression_rgtc(ctx)))
             break;
          return GL_INVALID_OPERATION;
 
       case GL_BYTE:
-         if (internalFormat != GL_R8_SNORM)
+         if (internalFormat != GL_R8_SNORM &&
+             (!_mesa_has_EXT_texture_compression_rgtc(ctx) ||
+              internalFormat != GL_COMPRESSED_SIGNED_RED_RGTC1_EXT))
             return GL_INVALID_OPERATION;
          break;
 
index 1c128e42c2a98929ffdd93a3997758bbc09431db..dcdb81ec111110063977e529745d3d595e9b28fa 100644 (file)
@@ -327,6 +327,15 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
       formats[n++] = GL_ETC1_RGB8_OES;
    }
 
+   /* Required by EXT_texture_compression_rgtc in GLES. */
+   if (_mesa_is_gles3(ctx) &&
+       _mesa_has_EXT_texture_compression_rgtc(ctx)) {
+      formats[n++] = GL_COMPRESSED_RED_RGTC1_EXT;
+      formats[n++] = GL_COMPRESSED_SIGNED_RED_RGTC1_EXT;
+      formats[n++] = GL_COMPRESSED_RED_GREEN_RGTC2_EXT;
+      formats[n++] = GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
+   }
+
    if (ctx->API == API_OPENGLES) {
       formats[n++] = GL_PALETTE4_RGB8_OES;
       formats[n++] = GL_PALETTE4_RGBA8_OES;