mesa: fix some minor texstore comments
[mesa.git] / src / mesa / main / texenv.c
index 9d47c7bba45de90cf471ee5350dee7d864b8a0de..e5f1bd39ee74ddb56a5b22c192971643aeb95674 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;
    }
@@ -487,11 +460,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
       }
    }
    else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
-      /* GL_EXT_texture_lod_bias */
-      if (!ctx->Extensions.EXT_texture_lod_bias) {
-        _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
-        return;
-      }
       if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
         if (texUnit->LodBias == param[0])
            return;
@@ -603,35 +571,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 +590,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 +604,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 +618,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 +631,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) {
@@ -772,11 +688,6 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
       }
    }
    else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
-      /* GL_EXT_texture_lod_bias */
-      if (!ctx->Extensions.EXT_texture_lod_bias) {
-        _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
-        return;
-      }
       if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
          *params = texUnit->LodBias;
       }
@@ -839,11 +750,6 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
       }
    }
    else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
-      /* GL_EXT_texture_lod_bias */
-      if (!ctx->Extensions.EXT_texture_lod_bias) {
-        _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
-        return;
-      }
       if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
          *params = (GLint) texUnit->LodBias;
       }