/** Set an RGB or A combiner mode/function */
-static void
+static bool
set_combiner_mode(struct gl_context *ctx,
struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLenum mode)
if (!legal) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
+ return false;
}
switch (pname) {
case GL_COMBINE_RGB:
if (texUnit->Combine.ModeRGB == mode)
- return;
+ return true;
FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ModeRGB = mode;
break;
case GL_COMBINE_ALPHA:
if (texUnit->Combine.ModeA == mode)
- return;
+ return true;
FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ModeA = mode;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return false;
}
+
+ return true;
}
/** Set an RGB or A combiner source term */
-static void
+static bool
set_combiner_source(struct gl_context *ctx,
struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLenum param)
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
+ return false;
}
if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
|| !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
+ return false;
}
assert(term < MAX_COMBINER_TERMS);
if (!legal) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", param);
- return;
+ return false;
}
FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.SourceA[term] = param;
else
texUnit->Combine.SourceRGB[term] = param;
+
+ return true;
}
/** Set an RGB or A combiner operand term */
-static void
+static bool
set_combiner_operand(struct gl_context *ctx,
struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLenum param)
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
+ return false;
}
if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
|| !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
+ return false;
}
assert(term < MAX_COMBINER_TERMS);
if (!legal) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", param);
- return;
+ return false;
}
FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.OperandA[term] = param;
else
texUnit->Combine.OperandRGB[term] = param;
+
+ return true;
}
-static void
+static bool
set_combiner_scale(struct gl_context *ctx,
struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLfloat scale)
else {
_mesa_error( ctx, GL_INVALID_VALUE,
"glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
- return;
+ return false;
}
switch (pname) {
case GL_RGB_SCALE:
if (texUnit->Combine.ScaleShiftRGB == shift)
- return;
+ return true;
FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ScaleShiftRGB = shift;
break;
case GL_ALPHA_SCALE:
if (texUnit->Combine.ScaleShiftA == shift)
- return;
+ return true;
FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ScaleShiftA = shift;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return false;
}
+
+ return true;
}
break;
case GL_COMBINE_RGB:
case GL_COMBINE_ALPHA:
- set_combiner_mode(ctx, texUnit, pname, (GLenum) iparam0);
+ if (!set_combiner_mode(ctx, texUnit, pname, (GLenum) iparam0))
+ return;
break;
case GL_SOURCE0_RGB:
case GL_SOURCE1_RGB:
case GL_SOURCE1_ALPHA:
case GL_SOURCE2_ALPHA:
case GL_SOURCE3_ALPHA_NV:
- set_combiner_source(ctx, texUnit, pname, (GLenum) iparam0);
+ if (!set_combiner_source(ctx, texUnit, pname, (GLenum) iparam0))
+ return;
break;
case GL_OPERAND0_RGB:
case GL_OPERAND1_RGB:
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
case GL_OPERAND3_ALPHA_NV:
- set_combiner_operand(ctx, texUnit, pname, (GLenum) iparam0);
+ if (!set_combiner_operand(ctx, texUnit, pname, (GLenum) iparam0))
+ return;
break;
case GL_RGB_SCALE:
case GL_ALPHA_SCALE:
- set_combiner_scale(ctx, texUnit, pname, param[0]);
+ if (!set_combiner_scale(ctx, texUnit, pname, param[0]))
+ return;
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );