mesa: Remove EXT_texture_env_combine extension enable flag
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 31 Aug 2011 00:24:13 +0000 (17:24 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Sep 2011 17:40:51 +0000 (10:40 -0700)
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 <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_extensions.c
src/mesa/drivers/dri/nouveau/nouveau_context.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r600/r600_context.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/main/attrib.c
src/mesa/main/extensions.c
src/mesa/main/mtypes.h
src/mesa/main/texenv.c
src/mesa/state_tracker/st_extensions.c

index 909b3bb36deaa7f921c8f938cb256b94455e4af5..114750822af0e87f7ef1f833080afa7a9e35239c 100644 (file)
@@ -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;
index fe1b4961131d74a5cfe223b1b3d42255ec1dddaa..adf91bac316ef78e8a21499b9ae2f9a856e23742 100644 (file)
@@ -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;
index 16cd33367327b25cd50488639b623cd7e26a99ae..34ad83fa7ff9cfd04b5b03908c70c485f7d6ae6c 100644 (file)
@@ -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;
index 13815d4f0ab66d00fffacdd5ae8391149cf62bee..c2d9a4c3f1b0964b09e591d40eff349f0fe54f7f 100644 (file)
@@ -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;
index 06339c33336e307d25538c63426c85dd9d736b64..05f9836f02324262dfa5e5402b58eff71e930537 100644 (file)
@@ -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;
index c9aa2a20602b2c77fa30669cbf9cac4000b74896..d8ec331a3877517e4e35e357036aa54679c2399b 100644 (file)
@@ -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;
index 2f391c5a810e19779f516eb6833ea353eb54d5ea..94ced42045e10283ca30bfe58ad411e86c60b292 100644 (file)
@@ -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++) {
index d3ec064cc9783e1fffd3e8e6c37677cdd996d696..7d1956e7c34fd06136d18b61ccdc5f0427640701 100644 (file)
@@ -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;
index a3d9c245ad2d599de203465b6859ba9ce0e6d6c8..676cc5e62b8771a155738ce392eb083ccf201c94 100644 (file)
@@ -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;
index 9d47c7bba45de90cf471ee5350dee7d864b8a0de..9848dd4c9bedaa631e6a42a02b7835da446856bf 100644 (file)
@@ -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) {
index 205c1d5d8e24545541f190b798e4e600ae77a338..39c7cc72f12540d95574d9b815fd912da3e088d6 100644 (file)
@@ -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;