-/* $Id: texstate.c,v 1.42 2001/03/30 21:14:30 brianp Exp $ */
+/* $Id: texstate.c,v 1.43 2001/04/16 21:06:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
+#define ERROR(errCode, msg, value) \
+ { \
+ char s[100]; \
+ sprintf(s, msg, _mesa_lookup_enum_by_nr(value)); \
+ _mesa_error(ctx, errCode, s); \
+ }
+
if (target==GL_TEXTURE_ENV) {
switch (pname) {
case GL_TEXTURE_ENV_MODE: {
switch (mode) {
case GL_ADD:
if (!ctx->Extensions.EXT_texture_env_add) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
break;
case GL_COMBINE_EXT:
if (!ctx->Extensions.EXT_texture_env_combine) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
break;
case GL_REPLACE:
break;
default:
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
case GL_DOT3_RGB_ARB:
case GL_DOT3_RGBA_ARB:
if (!ctx->Extensions.EXT_texture_env_dot3) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
if (texUnit->CombineModeRGB == mode)
texUnit->CombineModeRGB = mode;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
+ break;
case GL_COMBINE_ALPHA_EXT:
if (ctx->Extensions.EXT_texture_env_combine) {
GLenum mode = (GLenum) (GLint) *param;
texUnit->CombineModeA = mode;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
texUnit->CombineSourceRGB[s] = source;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
texUnit->CombineSourceA[s] = source;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
texUnit->CombineOperandRGB[s] = operand;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->CombineOperandRGB[2] = operand;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
texUnit->CombineOperandA[2] = operand;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
return;
}
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
newshift = 2;
}
else {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
return;
}
if (texUnit->CombineScaleShiftRGB == newshift)
texUnit->CombineScaleShiftRGB = newshift;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
newshift = 2;
}
else {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" );
return;
}
if (texUnit->CombineScaleShiftA == newshift)
texUnit->CombineScaleShiftA = newshift;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
break;
texUnit->LodBias = param[0];
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
}