From: Marek Olšák Date: Mon, 6 Aug 2018 02:50:54 +0000 (-0400) Subject: mesa: expose EXT_texture_compression_rgtc on GLES X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=34f07ddebbba50a154ca09a81704b0fd0bfa5524;p=mesa.git mesa: expose EXT_texture_compression_rgtc on GLES The spec was modified to support GLES. Tested by piglit. v2: rebase Reviewed-by: Ilia Mirkin (v1) Reviewed-by: Erik Faye-Lund --- diff --git a/docs/relnotes/19.0.0.html b/docs/relnotes/19.0.0.html index 1629e0ba52e..4a61420be1a 100644 --- a/docs/relnotes/19.0.0.html +++ b/docs/relnotes/19.0.0.html @@ -40,6 +40,7 @@ TBD.
  • GL_EXT_shader_implicit_conversions on all drivers (ES extension).
  • +
  • GL_EXT_texture_compression_rgtc on all GL 3.0 drivers (ES extension).
  • GL_EXT_texture_view on drivers supporting texture views (ES extension).
  • GL_OES_texture_view on drivers supporting texture views (ES extension).
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 8d6d56c640d..a229f3af2b2 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -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 , 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) diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index ea73068d025..a63ccc0e5ba 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -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; diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 1c128e42c2a..dcdb81ec111 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -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;