[Mesa-dev] [PATCH 2/3] mesa: Like EXT_texture_compression_dxt1, advertise ANGLE_texture_compression_dxt in all APIs
Ian Romanick
idr at freedesktop.org
Mon Jan 21 08:53:34 PST 2013
From: Ian Romanick <ian.d.romanick at intel.com>
This is technically outside the ANGLE spec, but it seems unlikely to
cause any harm.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/extensions.c | 4 ++--
src/mesa/main/glformats.c | 4 +---
src/mesa/main/texformat.c | 14 ++++++--------
src/mesa/main/teximage.c | 15 ++-------------
4 files changed, 11 insertions(+), 26 deletions(-)
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 375978e..5d01ac8 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -202,8 +202,8 @@ static const struct extension extension_table[] = {
{ "GL_EXT_texture3D", o(EXT_texture3D), GLL, 1996 },
{ "GL_EXT_texture_array", o(EXT_texture_array), GL, 2006 },
{ "GL_EXT_texture_compression_dxt1", o(ANGLE_texture_compression_dxt), GL | ES1 | ES2, 2004 },
- { "GL_ANGLE_texture_compression_dxt3", o(ANGLE_texture_compression_dxt), ES2, 2011 },
- { "GL_ANGLE_texture_compression_dxt5", o(ANGLE_texture_compression_dxt), ES2, 2011 },
+ { "GL_ANGLE_texture_compression_dxt3", o(ANGLE_texture_compression_dxt), GL | ES1 | ES2, 2011 },
+ { "GL_ANGLE_texture_compression_dxt5", o(ANGLE_texture_compression_dxt), GL | ES1 | ES2, 2011 },
{ "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), GL, 2006 },
{ "GL_EXT_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 },
{ "GL_EXT_texture_compression_s3tc", o(EXT_texture_compression_s3tc), GL, 2000 },
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index fc8bc2e..81e16a3 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -867,13 +867,11 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
switch (format) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return ctx->Extensions.EXT_texture_compression_s3tc;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
return (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.EXT_texture_compression_s3tc) ||
- (ctx->API == API_OPENGLES2 &&
- ctx->Extensions.ANGLE_texture_compression_dxt);
+ ctx->Extensions.ANGLE_texture_compression_dxt;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_RGBA_S3TC:
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index b0ff6ec..2a785ac 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -308,9 +308,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
}
}
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- (ctx->API == API_OPENGLES2 &&
- ctx->Extensions.ANGLE_texture_compression_dxt)) {
+ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_compression_s3tc
+ || ctx->Extensions.ANGLE_texture_compression_dxt) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
@@ -608,21 +607,20 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.ANGLE_texture_compression_dxt)
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT1);
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc ||
- (ctx->API == API_OPENGLES2 &&
- ctx->Extensions.ANGLE_texture_compression_dxt))
+ ctx->Extensions.ANGLE_texture_compression_dxt)
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc ||
- (ctx->API == API_OPENGLES2 &&
- ctx->Extensions.ANGLE_texture_compression_dxt))
+ ctx->Extensions.ANGLE_texture_compression_dxt)
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 0ce22cf..1708d66 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -190,7 +190,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
}
- if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_compression_s3tc
+ || ctx->Extensions.ANGLE_texture_compression_dxt) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
return GL_RGB;
@@ -203,18 +204,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
}
- /* GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE && GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE */
- if (ctx->API == API_OPENGLES2 &&
- ctx->Extensions.ANGLE_texture_compression_dxt) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return GL_RGBA;
- default:
- ; /* fallthrough */
- }
- }
-
if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.ANGLE_texture_compression_dxt) {
switch (internalFormat) {
--
1.7.11.7
More information about the mesa-dev
mailing list