Commit a021881c authored by Ian Romanick's avatar Ian Romanick

mesa: Use a single flag for the S3TC extensions that don't require on-line compression

Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Acked-by: default avatarLee Salzman <lsalzman@gmail.com>
parent 8059c2ea
...@@ -180,7 +180,6 @@ intelInitExtensions(struct gl_context *ctx) ...@@ -180,7 +180,6 @@ intelInitExtensions(struct gl_context *ctx)
if (intel->ctx.Mesa_DXTn) { if (intel->ctx.Mesa_DXTn) {
ctx->Extensions.ANGLE_texture_compression_dxt = true; ctx->Extensions.ANGLE_texture_compression_dxt = true;
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.S3_s3tc = true;
} }
else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) { else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
......
...@@ -451,7 +451,7 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua ...@@ -451,7 +451,7 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua
ctx->Extensions.NV_texture_rectangle = true; ctx->Extensions.NV_texture_rectangle = true;
if (ctx->Mesa_DXTn) { if (ctx->Mesa_DXTn) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.S3_s3tc = true; ctx->Extensions.ANGLE_texture_compression_dxt = true;
} }
/* GL constants. */ /* GL constants. */
......
...@@ -462,7 +462,7 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua ...@@ -462,7 +462,7 @@ nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visua
ctx->Extensions.NV_texture_rectangle = true; ctx->Extensions.NV_texture_rectangle = true;
if (ctx->Mesa_DXTn) { if (ctx->Mesa_DXTn) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.S3_s3tc = true; ctx->Extensions.ANGLE_texture_compression_dxt = true;
} }
/* GL constants. */ /* GL constants. */
......
...@@ -409,10 +409,11 @@ GLboolean r200CreateContext( gl_api api, ...@@ -409,10 +409,11 @@ GLboolean r200CreateContext( gl_api api,
} }
if (rmesa->radeon.glCtx.Mesa_DXTn) { if (rmesa->radeon.glCtx.Mesa_DXTn) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.S3_s3tc = true; ctx->Extensions.ANGLE_texture_compression_dxt = true;
} }
else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) { else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.ANGLE_texture_compression_dxt = true;
} }
ctx->Extensions.ARB_texture_cube_map = true; ctx->Extensions.ARB_texture_cube_map = true;
......
...@@ -361,10 +361,11 @@ r100CreateContext( gl_api api, ...@@ -361,10 +361,11 @@ r100CreateContext( gl_api api,
if (rmesa->radeon.glCtx.Mesa_DXTn) { if (rmesa->radeon.glCtx.Mesa_DXTn) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.S3_s3tc = true; ctx->Extensions.ANGLE_texture_compression_dxt = true;
} }
else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) { else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
ctx->Extensions.EXT_texture_compression_s3tc = true; ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.ANGLE_texture_compression_dxt = true;
} }
ctx->Extensions.NV_texture_rectangle = true; ctx->Extensions.NV_texture_rectangle = true;
......
...@@ -929,7 +929,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) ...@@ -929,7 +929,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
_mesa_enable_2_1_extensions(mesaCtx); _mesa_enable_2_1_extensions(mesaCtx);
if (mesaCtx->Mesa_DXTn) { if (mesaCtx->Mesa_DXTn) {
_mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc");
_mesa_enable_extension(mesaCtx, "GL_S3_s3tc"); _mesa_enable_extension(mesaCtx, "GL_ANGLE_texture_compression_dxt");
} }
_mesa_enable_extension(mesaCtx, "GL_3DFX_texture_compression_FXT1"); _mesa_enable_extension(mesaCtx, "GL_3DFX_texture_compression_FXT1");
#if ENABLE_EXT_timer_query #if ENABLE_EXT_timer_query
......
...@@ -201,7 +201,7 @@ static const struct extension extension_table[] = { ...@@ -201,7 +201,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_subtexture", o(dummy_true), GLL, 1995 }, { "GL_EXT_subtexture", o(dummy_true), GLL, 1995 },
{ "GL_EXT_texture3D", o(EXT_texture3D), GLL, 1996 }, { "GL_EXT_texture3D", o(EXT_texture3D), GLL, 1996 },
{ "GL_EXT_texture_array", o(EXT_texture_array), GL, 2006 }, { "GL_EXT_texture_array", o(EXT_texture_array), GL, 2006 },
{ "GL_EXT_texture_compression_dxt1", o(EXT_texture_compression_s3tc), GL | ES1 | ES2, 2004 }, { "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_dxt3", o(ANGLE_texture_compression_dxt), ES2, 2011 },
{ "GL_ANGLE_texture_compression_dxt5", o(ANGLE_texture_compression_dxt), ES2, 2011 }, { "GL_ANGLE_texture_compression_dxt5", o(ANGLE_texture_compression_dxt), ES2, 2011 },
{ "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), GL, 2006 }, { "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), GL, 2006 },
...@@ -321,7 +321,7 @@ static const struct extension extension_table[] = { ...@@ -321,7 +321,7 @@ static const struct extension extension_table[] = {
{ "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 }, { "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 },
{ "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GLL, 1999 }, { "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GLL, 1999 },
{ "GL_NV_texture_rectangle", o(NV_texture_rectangle), GLL, 2000 }, { "GL_NV_texture_rectangle", o(NV_texture_rectangle), GLL, 2000 },
{ "GL_S3_s3tc", o(S3_s3tc), GL, 1999 }, { "GL_S3_s3tc", o(ANGLE_texture_compression_dxt), GL, 1999 },
{ "GL_SGIS_generate_mipmap", o(dummy_true), GLL, 1997 }, { "GL_SGIS_generate_mipmap", o(dummy_true), GLL, 1997 },
{ "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 1997 }, { "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 1997 },
{ "GL_SGIS_texture_edge_clamp", o(dummy_true), GLL, 1997 }, { "GL_SGIS_texture_edge_clamp", o(dummy_true), GLL, 1997 },
......
...@@ -878,7 +878,8 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) ...@@ -878,7 +878,8 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
case GL_RGB4_S3TC: case GL_RGB4_S3TC:
case GL_RGBA_S3TC: case GL_RGBA_S3TC:
case GL_RGBA4_S3TC: case GL_RGBA4_S3TC:
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.S3_s3tc; return _mesa_is_desktop_gl(ctx) &&
ctx->Extensions.ANGLE_texture_compression_dxt;
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
......
...@@ -3130,7 +3130,6 @@ struct gl_extensions ...@@ -3130,7 +3130,6 @@ struct gl_extensions
GLboolean NV_texture_env_combine4; GLboolean NV_texture_env_combine4;
GLboolean NV_texture_rectangle; GLboolean NV_texture_rectangle;
GLboolean TDFX_texture_compression_FXT1; GLboolean TDFX_texture_compression_FXT1;
GLboolean S3_s3tc;
GLboolean OES_EGL_image; GLboolean OES_EGL_image;
GLboolean OES_draw_texture; GLboolean OES_draw_texture;
GLboolean OES_depth_texture_cube_map; GLboolean OES_depth_texture_cube_map;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "formats.h" #include "formats.h"
#include "mfeatures.h" #include "mfeatures.h"
#include "mtypes.h" #include "mtypes.h"
#include "context.h"
#include "texcompress.h" #include "texcompress.h"
#include "texcompress_fxt1.h" #include "texcompress_fxt1.h"
#include "texcompress_rgtc.h" #include "texcompress_rgtc.h"
...@@ -264,7 +265,8 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats) ...@@ -264,7 +265,8 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
n += 3; n += 3;
} }
} }
if (ctx->Extensions.S3_s3tc) { if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.ANGLE_texture_compression_dxt) {
if (formats) { if (formats) {
formats[n++] = GL_RGB_S3TC; formats[n++] = GL_RGB_S3TC;
formats[n++] = GL_RGB4_S3TC; formats[n++] = GL_RGB4_S3TC;
......
...@@ -251,7 +251,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, ...@@ -251,7 +251,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
*/ */
if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) { if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
if (ctx->Extensions.EXT_texture_compression_s3tc || if (ctx->Extensions.EXT_texture_compression_s3tc ||
ctx->Extensions.S3_s3tc) ctx->Extensions.ANGLE_texture_compression_dxt)
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
if (ctx->Extensions.TDFX_texture_compression_FXT1) if (ctx->Extensions.TDFX_texture_compression_FXT1)
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
...@@ -264,7 +264,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, ...@@ -264,7 +264,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
/* We don't use texture compression for 1D and 1D array textures. */ /* We don't use texture compression for 1D and 1D array textures. */
if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) { if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
if (ctx->Extensions.EXT_texture_compression_s3tc || if (ctx->Extensions.EXT_texture_compression_s3tc ||
ctx->Extensions.S3_s3tc) ctx->Extensions.ANGLE_texture_compression_dxt)
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
if (ctx->Extensions.TDFX_texture_compression_FXT1) if (ctx->Extensions.TDFX_texture_compression_FXT1)
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
...@@ -329,7 +329,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, ...@@ -329,7 +329,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
} }
} }
if (ctx->Extensions.S3_s3tc) { if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.ANGLE_texture_compression_dxt) {
switch (internalFormat) { switch (internalFormat) {
case GL_RGB_S3TC: case GL_RGB_S3TC:
case GL_RGB4_S3TC: case GL_RGB4_S3TC:
......
...@@ -215,7 +215,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) ...@@ -215,7 +215,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
} }
} }
if (ctx->Extensions.S3_s3tc) { if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.ANGLE_texture_compression_dxt) {
switch (internalFormat) { switch (internalFormat) {
case GL_RGB_S3TC: case GL_RGB_S3TC:
case GL_RGB4_S3TC: case GL_RGB4_S3TC:
......
...@@ -454,7 +454,7 @@ void st_init_extensions(struct st_context *st) ...@@ -454,7 +454,7 @@ void st_init_extensions(struct st_context *st)
PIPE_FORMAT_LATC2_SNORM } }, PIPE_FORMAT_LATC2_SNORM } },
{ { o(EXT_texture_compression_s3tc), { { o(EXT_texture_compression_s3tc),
o(S3_s3tc) }, o(ANGLE_texture_compression_dxt) },
{ PIPE_FORMAT_DXT1_RGB, { PIPE_FORMAT_DXT1_RGB,
PIPE_FORMAT_DXT1_RGBA, PIPE_FORMAT_DXT1_RGBA,
PIPE_FORMAT_DXT3_RGBA, PIPE_FORMAT_DXT3_RGBA,
...@@ -611,7 +611,7 @@ void st_init_extensions(struct st_context *st) ...@@ -611,7 +611,7 @@ void st_init_extensions(struct st_context *st)
if (!ctx->Mesa_DXTn && !st_get_s3tc_override()) { if (!ctx->Mesa_DXTn && !st_get_s3tc_override()) {
ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE; ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE;
ctx->Extensions.S3_s3tc = GL_FALSE; ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE;
} }
if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
......
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