aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/texenv.c')
-rw-r--r--mesalib/src/mesa/main/texenv.c140
1 files changed, 22 insertions, 118 deletions
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index 1df3890d4..e5f1bd39e 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -60,19 +60,14 @@ set_env_mode(struct gl_context *ctx,
case GL_BLEND:
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_ADD:
- legal = ctx->Extensions.EXT_texture_env_add;
- 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;
@@ -114,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:
@@ -189,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).
*
@@ -282,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) {
@@ -367,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;
}
@@ -489,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;
@@ -605,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];
@@ -644,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];
@@ -664,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];
@@ -684,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];
@@ -703,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) {
@@ -774,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;
}
@@ -841,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;
}