Commit 34f07dde authored by Marek Olšák's avatar Marek Olšák

mesa: expose EXT_texture_compression_rgtc on GLES

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 's avatarErik Faye-Lund <erik.faye-lund@collabora.com>
parent 91af56e3
......@@ -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>
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment