diff options
author | Marek Olšák <[email protected]> | 2018-08-05 22:50:54 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-12-04 15:33:29 -0500 |
commit | 34f07ddebbba50a154ca09a81704b0fd0bfa5524 (patch) | |
tree | fbad93762791c46f48994b17e0eea1841b4e486a /src/mesa | |
parent | 91af56e3835bbc17f5b110ac472724cd0986503c (diff) |
mesa: expose EXT_texture_compression_rgtc on GLES
The spec was modified to support GLES. Tested by piglit.
v2: rebase
Reviewed-by: Ilia Mirkin <[email protected]> (v1)
Reviewed-by: Erik Faye-Lund <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/extensions_table.h | 2 | ||||
-rw-r--r-- | src/mesa/main/glformats.c | 19 | ||||
-rw-r--r-- | src/mesa/main/texcompress.c | 9 |
3 files changed, 24 insertions, 6 deletions
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; |