From bde8bd99b64876b47f9d335320eb1ad5b3be8d9d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 30 Aug 2011 17:24:13 -0700 Subject: [PATCH] mesa: Remove EXT_texture_env_combine extension enable flag All drivers remaining in Mesa support this extension. This extension is either required or optional features in desktop OpenGL, OpenGL ES 1.x, and OpenGL ES 2.x. The existing support is already partially broken in Mesa (e.g., querying GL_TEXTURE_ENV_MODE in OpenGL ES 2.x). This patch does not change the situation in any way. It looks like the only hardware supported by Mesa that cannot do ARB_texture_env_combine is pre-NV10 NVIDA chips. It appears that these chips cannot do the GL_SUBTRACT mode. Based on looking at older copies of nvOpenGLspecs.pdf found on the net, NVIDIA never supported ARB_texture_env_combine on those chips either. This extension was previously not supported on mach64, mga (G200), r128, savage, sis, and tdfx (Voodoo Banshee and Voodoo3). Signed-off-by: Ian Romanick Reviewed-by: Brian Paul Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/intel/intel_extensions.c | 1 - .../drivers/dri/nouveau/nouveau_context.c | 1 - src/mesa/drivers/dri/r200/r200_context.c | 1 - src/mesa/drivers/dri/r300/r300_context.c | 1 - src/mesa/drivers/dri/r600/r600_context.c | 1 - src/mesa/drivers/dri/radeon/radeon_context.c | 1 - src/mesa/main/attrib.c | 67 +++++----- src/mesa/main/extensions.c | 3 +- src/mesa/main/mtypes.h | 1 - src/mesa/main/texenv.c | 121 +++--------------- src/mesa/state_tracker/st_extensions.c | 1 - 11 files changed, 54 insertions(+), 145 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 909b3bb36de..114750822af 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -77,7 +77,6 @@ intelInitExtensions(struct gl_context *ctx) ctx->Extensions.EXT_secondary_color = true; ctx->Extensions.EXT_separate_shader_objects = true; ctx->Extensions.EXT_stencil_wrap = true; - ctx->Extensions.EXT_texture_env_combine = true; ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.EXT_texture_lod_bias = true; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index fe1b4961131..adf91bac316 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -127,7 +127,6 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, ctx->Extensions.EXT_packed_depth_stencil = true; ctx->Extensions.EXT_secondary_color = true; ctx->Extensions.EXT_stencil_wrap = true; - ctx->Extensions.EXT_texture_env_combine = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.EXT_texture_lod_bias = true; ctx->Extensions.NV_blend_square = true; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 16cd3336732..34ad83fa7ff 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -370,7 +370,6 @@ GLboolean r200CreateContext( gl_api api, ctx->Extensions.EXT_packed_depth_stencil = true; ctx->Extensions.EXT_secondary_color = true; ctx->Extensions.EXT_stencil_wrap = true; - ctx->Extensions.EXT_texture_env_combine = true; ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.EXT_texture_lod_bias = true; diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 13815d4f0ab..c2d9a4c3f1b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -386,7 +386,6 @@ static void r300InitGLExtensions(struct gl_context *ctx) ctx->Extensions.EXT_secondary_color = true; ctx->Extensions.EXT_shadow_funcs = true; ctx->Extensions.EXT_stencil_wrap = true; - ctx->Extensions.EXT_texture_env_combine = true; ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.EXT_texture_lod_bias = true; diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 06339c33336..05f9836f023 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -287,7 +287,6 @@ static void r600InitGLExtensions(struct gl_context *ctx) ctx->Extensions.EXT_shadow_funcs = true; ctx->Extensions.EXT_stencil_two_side = true; ctx->Extensions.EXT_stencil_wrap = true; - ctx->Extensions.EXT_texture_env_combine = true; ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.EXT_texture_lod_bias = true; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index c9aa2a20602..d8ec331a387 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -323,7 +323,6 @@ r100CreateContext( gl_api api, ctx->Extensions.EXT_packed_depth_stencil = true; ctx->Extensions.EXT_secondary_color = true; ctx->Extensions.EXT_stencil_wrap = true; - ctx->Extensions.EXT_texture_env_combine = true; ctx->Extensions.EXT_texture_env_dot3 = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.EXT_texture_lod_bias = true; diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 2f391c5a810..94ced42045e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -731,41 +731,38 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) _mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias); } - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, - unit->Combine.ModeRGB); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, - unit->Combine.ModeA); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, - unit->Combine.SourceRGB[0]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, - unit->Combine.SourceRGB[1]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, - unit->Combine.SourceRGB[2]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, - unit->Combine.SourceA[0]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, - unit->Combine.SourceA[1]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, - unit->Combine.SourceA[2]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, - unit->Combine.OperandRGB[0]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, - unit->Combine.OperandRGB[1]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, - unit->Combine.OperandRGB[2]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, - unit->Combine.OperandA[0]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, - unit->Combine.OperandA[1]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, - unit->Combine.OperandA[2]); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, - 1 << unit->Combine.ScaleShiftRGB); - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, - 1 << unit->Combine.ScaleShiftA); - } + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, + unit->Combine.ModeRGB); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, + unit->Combine.ModeA); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, + unit->Combine.SourceRGB[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, + unit->Combine.SourceRGB[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, + unit->Combine.SourceRGB[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, + unit->Combine.SourceA[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, + unit->Combine.SourceA[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, + unit->Combine.SourceA[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, + unit->Combine.OperandRGB[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, + unit->Combine.OperandRGB[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, + unit->Combine.OperandRGB[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, + unit->Combine.OperandA[0]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, + unit->Combine.OperandA[1]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, + unit->Combine.OperandA[2]); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, + 1 << unit->Combine.ScaleShiftRGB); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, + 1 << unit->Combine.ScaleShiftA); /* Restore texture object state for each target */ for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index d3ec064cc97..7d1956e7c34 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -192,7 +192,7 @@ static const struct extension extension_table[] = { { "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), GL, 2001 }, { "GL_EXT_texture_edge_clamp", o(dummy_true), GL, 1997 }, { "GL_EXT_texture_env_add", o(dummy_true), GL, 1999 }, - { "GL_EXT_texture_env_combine", o(EXT_texture_env_combine), GL, 2000 }, + { "GL_EXT_texture_env_combine", o(dummy_true), GL, 2000 }, { "GL_EXT_texture_env_dot3", o(EXT_texture_env_dot3), GL, 2000 }, { "GL_EXT_texture_filter_anisotropic", o(EXT_texture_filter_anisotropic), GL | ES1 | ES2, 1999 }, { "GL_EXT_texture_format_BGRA8888", o(dummy_true), ES1 | ES2, 2005 }, @@ -473,7 +473,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.EXT_stencil_two_side = GL_TRUE; ctx->Extensions.EXT_texture_array = GL_TRUE; ctx->Extensions.EXT_texture_compression_latc = GL_TRUE; - ctx->Extensions.EXT_texture_env_combine = GL_TRUE; ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_texture_filter_anisotropic = GL_TRUE; ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a3d9c245ad2..676cc5e62b8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2834,7 +2834,6 @@ struct gl_extensions GLboolean EXT_texture_array; GLboolean EXT_texture_compression_latc; GLboolean EXT_texture_compression_s3tc; - GLboolean EXT_texture_env_combine; GLboolean EXT_texture_env_dot3; GLboolean EXT_texture_filter_anisotropic; GLboolean EXT_texture_integer; diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 9d47c7bba45..9848dd4c9be 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -61,16 +61,13 @@ set_env_mode(struct gl_context *ctx, case GL_DECAL: case GL_REPLACE: case GL_ADD: + case GL_COMBINE: legal = GL_TRUE; break; case GL_REPLACE_EXT: mode = GL_REPLACE; /* GL_REPLACE_EXT != GL_REPLACE */ legal = GL_TRUE; break; - case GL_COMBINE: - legal = (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine); - break; case GL_COMBINE4_NV: legal = ctx->Extensions.NV_texture_env_combine4; break; @@ -112,12 +109,6 @@ set_combiner_mode(struct gl_context *ctx, { GLboolean legal; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - switch (mode) { case GL_REPLACE: case GL_MODULATE: @@ -187,12 +178,6 @@ set_combiner_source(struct gl_context *ctx, GLuint term; GLboolean alpha, legal; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - /* * Translate pname to (term, alpha). * @@ -280,12 +265,6 @@ set_combiner_operand(struct gl_context *ctx, GLuint term; GLboolean alpha, legal; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - /* The enums were given sequential values for a reason. */ switch (pname) { @@ -365,12 +344,6 @@ set_combiner_scale(struct gl_context *ctx, { GLuint shift; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - if (scale == 1.0F) { shift = 0; } @@ -603,35 +576,15 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, return texUnit->EnvMode; break; case GL_COMBINE_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return texUnit->Combine.ModeRGB; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return texUnit->Combine.ModeRGB; case GL_COMBINE_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return texUnit->Combine.ModeA; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return texUnit->Combine.ModeA; case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned rgb_idx = pname - GL_SOURCE0_RGB; - return texUnit->Combine.SourceRGB[rgb_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_SOURCE2_RGB: { + const unsigned rgb_idx = pname - GL_SOURCE0_RGB; + return texUnit->Combine.SourceRGB[rgb_idx]; + } case GL_SOURCE3_RGB_NV: if (ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.SourceRGB[3]; @@ -642,16 +595,10 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; - return texUnit->Combine.SourceA[alpha_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_SOURCE2_ALPHA: { + const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; + return texUnit->Combine.SourceA[alpha_idx]; + } case GL_SOURCE3_ALPHA_NV: if (ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.SourceA[3]; @@ -662,16 +609,10 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_rgb = pname - GL_OPERAND0_RGB; - return texUnit->Combine.OperandRGB[op_rgb]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_OPERAND2_RGB: { + const unsigned op_rgb = pname - GL_OPERAND0_RGB; + return texUnit->Combine.OperandRGB[op_rgb]; + } case GL_OPERAND3_RGB_NV: if (ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.OperandRGB[3]; @@ -682,16 +623,10 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; - return texUnit->Combine.OperandA[op_alpha]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_OPERAND2_ALPHA: { + const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; + return texUnit->Combine.OperandA[op_alpha]; + } case GL_OPERAND3_ALPHA_NV: if (ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.OperandA[3]; @@ -701,23 +636,9 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, } break; case GL_RGB_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return 1 << texUnit->Combine.ScaleShiftRGB; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return 1 << texUnit->Combine.ScaleShiftRGB; case GL_ALPHA_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return 1 << texUnit->Combine.ScaleShiftA; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return 1 << texUnit->Combine.ScaleShiftA; case GL_BUMP_TARGET_ATI: /* spec doesn't say so, but I think this should be queryable */ if (ctx->Extensions.ATI_envmap_bumpmap) { diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 205c1d5d8e2..39c7cc72f12 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -278,7 +278,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_provoking_vertex = GL_TRUE; ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_stencil_wrap = GL_TRUE; - ctx->Extensions.EXT_texture_env_combine = GL_TRUE; ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; -- 2.30.2