-/* $Id: texstate.c,v 1.59 2001/11/06 15:53:00 brianp Exp $ */
+/* $Id: texstate.c,v 1.76 2002/06/17 23:36:31 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
+void
+_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
+{
+ GLuint i;
+
+ ASSERT(src);
+ ASSERT(dst);
+
+ dst->Texture.CurrentUnit = src->Texture.CurrentUnit;
+ dst->Texture._GenFlags = src->Texture._GenFlags;
+ dst->Texture._TexGenEnabled = src->Texture._TexGenEnabled;
+ dst->Texture._TexMatEnabled = src->Texture._TexMatEnabled;
+ dst->Texture.SharedPalette = src->Texture.SharedPalette;
+
+ /* per-unit state */
+ for (i = 0; i < src->Const.MaxTextureUnits; i++) {
+ dst->Texture.Unit[i].Enabled = src->Texture.Unit[i].Enabled;
+ dst->Texture.Unit[i].EnvMode = src->Texture.Unit[i].EnvMode;
+ COPY_4V(dst->Texture.Unit[i].EnvColor, src->Texture.Unit[i].EnvColor);
+ dst->Texture.Unit[i].TexGenEnabled = src->Texture.Unit[i].TexGenEnabled;
+ dst->Texture.Unit[i].GenModeS = src->Texture.Unit[i].GenModeS;
+ dst->Texture.Unit[i].GenModeT = src->Texture.Unit[i].GenModeT;
+ dst->Texture.Unit[i].GenModeR = src->Texture.Unit[i].GenModeR;
+ dst->Texture.Unit[i].GenModeQ = src->Texture.Unit[i].GenModeQ;
+ dst->Texture.Unit[i]._GenBitS = src->Texture.Unit[i]._GenBitS;
+ dst->Texture.Unit[i]._GenBitT = src->Texture.Unit[i]._GenBitT;
+ dst->Texture.Unit[i]._GenBitR = src->Texture.Unit[i]._GenBitR;
+ dst->Texture.Unit[i]._GenBitQ = src->Texture.Unit[i]._GenBitQ;
+ dst->Texture.Unit[i]._GenFlags = src->Texture.Unit[i]._GenFlags;
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneS, src->Texture.Unit[i].ObjectPlaneS);
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneT, src->Texture.Unit[i].ObjectPlaneT);
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneR, src->Texture.Unit[i].ObjectPlaneR);
+ COPY_4V(dst->Texture.Unit[i].ObjectPlaneQ, src->Texture.Unit[i].ObjectPlaneQ);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneS, src->Texture.Unit[i].EyePlaneS);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneT, src->Texture.Unit[i].EyePlaneT);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneR, src->Texture.Unit[i].EyePlaneR);
+ COPY_4V(dst->Texture.Unit[i].EyePlaneQ, src->Texture.Unit[i].EyePlaneQ);
+ dst->Texture.Unit[i].LodBias = src->Texture.Unit[i].LodBias;
+
+ /* GL_EXT_texture_env_combine */
+ dst->Texture.Unit[i].CombineModeRGB = src->Texture.Unit[i].CombineModeRGB;
+ dst->Texture.Unit[i].CombineModeA = src->Texture.Unit[i].CombineModeA;
+ COPY_3V(dst->Texture.Unit[i].CombineSourceRGB, src->Texture.Unit[i].CombineSourceRGB);
+ COPY_3V(dst->Texture.Unit[i].CombineSourceA, src->Texture.Unit[i].CombineSourceA);
+ COPY_3V(dst->Texture.Unit[i].CombineOperandRGB, src->Texture.Unit[i].CombineOperandRGB);
+ COPY_3V(dst->Texture.Unit[i].CombineOperandA, src->Texture.Unit[i].CombineOperandA);
+ dst->Texture.Unit[i].CombineScaleShiftRGB = src->Texture.Unit[i].CombineScaleShiftRGB;
+ dst->Texture.Unit[i].CombineScaleShiftA = src->Texture.Unit[i].CombineScaleShiftA;
+
+ /* texture object state */
+ _mesa_copy_texture_object(dst->Texture.Unit[i].Current1D,
+ src->Texture.Unit[i].Current1D);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].Current2D,
+ src->Texture.Unit[i].Current2D);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].Current3D,
+ src->Texture.Unit[i].Current3D);
+ _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap,
+ src->Texture.Unit[i].CurrentCubeMap);
+ }
+}
+
+
/**********************************************************************/
/* Texture Environment */
/**********************************************************************/
_mesa_error(ctx, errCode, s); \
}
- if (target==GL_TEXTURE_ENV) {
+ if (target == GL_TEXTURE_ENV) {
switch (pname) {
- case GL_TEXTURE_ENV_MODE: {
- GLenum mode = (GLenum) (GLint) *param;
-
- switch (mode) {
- case GL_ADD:
- if (!ctx->Extensions.EXT_texture_env_add) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- case GL_COMBINE_EXT:
- if (!ctx->Extensions.EXT_texture_env_combine &&
- !ctx->Extensions.ARB_texture_env_combine) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- case GL_MODULATE:
- case GL_BLEND:
- case GL_DECAL:
- case GL_REPLACE:
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
-
- if (texUnit->EnvMode == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->EnvMode = mode;
- break;
- }
- case GL_TEXTURE_ENV_COLOR: {
- GLfloat tmp[4];
- tmp[0] = CLAMP( param[0], 0.0F, 1.0F );
- tmp[1] = CLAMP( param[1], 0.0F, 1.0F );
- tmp[2] = CLAMP( param[2], 0.0F, 1.0F );
- tmp[3] = CLAMP( param[3], 0.0F, 1.0F );
- if (TEST_EQ_4V(tmp, texUnit->EnvColor))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EnvColor, tmp);
- break;
- }
+ case GL_TEXTURE_ENV_MODE:
+ {
+ const GLenum mode = (GLenum) (GLint) *param;
+ if (mode == GL_MODULATE ||
+ mode == GL_BLEND ||
+ mode == GL_DECAL ||
+ mode == GL_REPLACE ||
+ (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) ||
+ (mode == GL_COMBINE_EXT &&
+ (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine))) {
+ /* legal */
+ if (texUnit->EnvMode == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->EnvMode = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ }
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ {
+ GLfloat tmp[4];
+ tmp[0] = CLAMP( param[0], 0.0F, 1.0F );
+ tmp[1] = CLAMP( param[1], 0.0F, 1.0F );
+ tmp[2] = CLAMP( param[2], 0.0F, 1.0F );
+ tmp[3] = CLAMP( param[3], 0.0F, 1.0F );
+ if (TEST_EQ_4V(tmp, texUnit->EnvColor))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EnvColor, tmp);
+ }
+ break;
case GL_COMBINE_RGB_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
return;
}
break;
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ if (!ctx->Extensions.EXT_texture_env_dot3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
case GL_DOT3_RGB_ARB:
case GL_DOT3_RGBA_ARB:
- if (!ctx->Extensions.EXT_texture_env_dot3 &&
- !ctx->Extensions.ARB_texture_env_dot3) {
+ if (!ctx->Extensions.ARB_texture_env_dot3) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum mode = (GLenum) (GLint) *param;
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED_EXT:
- case GL_INTERPOLATE_EXT:
- /* OK */
- break;
- case GL_SUBTRACT_ARB:
- if (!ctx->Extensions.ARB_texture_env_combine) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ if (mode == GL_REPLACE ||
+ mode == GL_MODULATE ||
+ mode == GL_ADD ||
+ mode == GL_ADD_SIGNED_EXT ||
+ mode == GL_INTERPOLATE_EXT ||
+ (mode == GL_SUBTRACT_ARB &&
+ ctx->Extensions.ARB_texture_env_combine)) {
+ /* legal */
+ if (texUnit->CombineModeA == mode)
return;
- }
- break;
- default:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->CombineModeA = mode;
+ }
+ else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
- if (texUnit->CombineModeA == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->CombineModeA = mode;
}
else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
case GL_SOURCE2_RGB_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
- GLenum source = (GLenum) (GLint) *param;
- GLuint s = pname - GL_SOURCE0_RGB_EXT;
- switch (source) {
- case GL_TEXTURE:
- case GL_CONSTANT_EXT:
- case GL_PRIMARY_COLOR_EXT:
- case GL_PREVIOUS_EXT:
- if (texUnit->CombineSourceRGB[s] == source)
- return;
+ const GLenum source = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_SOURCE0_RGB_EXT;
+ if (source == GL_TEXTURE ||
+ source == GL_CONSTANT_EXT ||
+ source == GL_PRIMARY_COLOR_EXT ||
+ source == GL_PREVIOUS_EXT ||
+ (ctx->Extensions.ARB_texture_env_crossbar &&
+ source >= GL_TEXTURE0_ARB &&
+ source < GL_TEXTURE0_ARB + ctx->Const.MaxTextureUnits)) {
+ /* legal */
+ if (texUnit->CombineSourceRGB[s] == source)
+ return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->CombineSourceRGB[s] = source;
- break;
- default:
+ }
+ else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
return;
}
case GL_SOURCE2_ALPHA_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
- GLenum source = (GLenum) (GLint) *param;
- GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
- switch (source) {
- case GL_TEXTURE:
- case GL_CONSTANT_EXT:
- case GL_PRIMARY_COLOR_EXT:
- case GL_PREVIOUS_EXT:
- if (texUnit->CombineSourceA[s] == source) return;
+ const GLenum source = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
+ if (source == GL_TEXTURE ||
+ source == GL_CONSTANT_EXT ||
+ source == GL_PRIMARY_COLOR_EXT ||
+ source == GL_PREVIOUS_EXT ||
+ (ctx->Extensions.ARB_texture_env_crossbar &&
+ source >= GL_TEXTURE0_ARB &&
+ source < GL_TEXTURE0_ARB + ctx->Const.MaxTextureUnits)) {
+ /* legal */
+ if (texUnit->CombineSourceA[s] == source)
+ return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->CombineSourceA[s] = source;
- break;
- default:
+ }
+ else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
return;
}
case GL_OPERAND1_RGB_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
- GLenum operand = (GLenum) (GLint) *param;
- GLuint s = pname - GL_OPERAND0_RGB_EXT;
+ const GLenum operand = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_OPERAND0_RGB_EXT;
switch (operand) {
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
case GL_OPERAND1_ALPHA_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
- GLenum operand = (GLenum) (GLint) *param;
+ const GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
case GL_OPERAND2_RGB_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
- GLenum operand = (GLenum) (GLint) *param;
+ const GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_COLOR: /* ARB combine only */
case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */
case GL_OPERAND2_ALPHA_EXT:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
- GLenum operand = (GLenum) (GLint) *param;
+ const GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
return;
}
}
- else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
+ 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(param)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
return;
}
- switch (pname) {
- case GL_TEXTURE_LOD_BIAS_EXT:
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
if (texUnit->LodBias == param[0])
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->LodBias = CLAMP(param[0], -ctx->Const.MaxTextureLodBias,
ctx->Const.MaxTextureLodBias);
- break;
- default:
+ }
+ else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
}
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ const GLenum value = (GLenum) param[0];
+ if (value == GL_TRUE || value == GL_FALSE) {
+ /* It's kind of weird to set point state via glTexEnv,
+ * but that's what the spec calls for.
+ */
+ const GLboolean state = (GLboolean) value;
+ if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
+ }
+ }
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" );
return;
}
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n",
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(pname),
- *param,
- _mesa_lookup_enum_by_nr((GLenum) (GLint) *param));
+ _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n",
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(pname),
+ *param,
+ _mesa_lookup_enum_by_nr((GLenum) (GLint) *param));
/* Tell device driver about the new texture environment */
if (ctx->Driver.TexEnv) {
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
{
GLfloat p[4];
- p[0] = INT_TO_FLOAT( param[0] );
- p[1] = INT_TO_FLOAT( param[1] );
- p[2] = INT_TO_FLOAT( param[2] );
- p[3] = INT_TO_FLOAT( param[3] );
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ p[0] = INT_TO_FLOAT( param[0] );
+ p[1] = INT_TO_FLOAT( param[1] );
+ p[2] = INT_TO_FLOAT( param[2] );
+ p[3] = INT_TO_FLOAT( param[3] );
+ }
+ else {
+ p[0] = (GLint) param[0];
+ p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */
+ }
_mesa_TexEnvfv( target, pname, p );
}
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (target!=GL_TEXTURE_ENV) {
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_FLOAT(texUnit->EnvMode);
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ COPY_4FV( params, texUnit->EnvColor );
+ break;
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineSourceA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->CombineOperandA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftRGB == 0)
+ *params = 1.0;
+ else if (texUnit->CombineScaleShiftRGB == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftA == 0)
+ *params = 1.0;
+ else if (texUnit->CombineScaleShiftA == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ }
+ }
+ 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;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
return;
}
+}
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- *params = ENUM_TO_FLOAT(texUnit->EnvMode);
- break;
- case GL_TEXTURE_ENV_COLOR:
- COPY_4FV( params, texUnit->EnvColor );
- break;
- case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineSourceA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->CombineOperandA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftRGB == 0)
- *params = 1.0;
- else if (texUnit->CombineScaleShiftRGB == 1)
- *params = 2.0;
- else
- *params = 4.0;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftA == 0)
- *params = 1.0;
- else if (texUnit->CombineScaleShiftA == 1)
- *params = 2.0;
- else
- *params = 4.0;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+
+void
+_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = (GLint) texUnit->EnvMode;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
+ params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
+ params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
+ params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
+ break;
+ case GL_COMBINE_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineSourceA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandRGB[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandRGB[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_RGB_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandRGB[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandA[0];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND1_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandA[1];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND2_ALPHA_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->CombineOperandA[2];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE_EXT:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftRGB == 0)
+ *params = 1;
+ else if (texUnit->CombineScaleShiftRGB == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->CombineScaleShiftA == 0)
+ *params = 1;
+ else if (texUnit->CombineScaleShiftA == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ }
}
-}
-
-
-void
-_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (target != GL_TEXTURE_ENV) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
+ 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;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
}
-
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- *params = (GLint) texUnit->EnvMode;
- break;
- case GL_TEXTURE_ENV_COLOR:
- params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
- params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
- params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
- params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
- break;
- case GL_COMBINE_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineSourceA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND0_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandRGB[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND1_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandRGB[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND2_RGB_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandRGB[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandA[0];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND1_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandA[1];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND2_ALPHA_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->CombineOperandA[2];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_RGB_SCALE_EXT:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftRGB == 0)
- *params = 1;
- else if (texUnit->CombineScaleShiftRGB == 1)
- *params = 2;
- else
- *params = 4;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->CombineScaleShiftA == 0)
- *params = 1;
- else if (texUnit->CombineScaleShiftA == 1)
- *params = 2;
- else
- *params = 4;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- return;
- }
- break;
- default:
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
}
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "texPARAM %s %s %d...\n",
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(pname),
- eparam);
+ _mesa_debug(ctx, "texPARAM %s %s %d...\n",
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(pname),
+ eparam);
switch (target) {
texObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->Extensions.ARB_texture_cube_map) {
- texObj = texUnit->CurrentCubeMap;
- break;
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->CurrentCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
}
- /* fallthrough */
+ texObj = texUnit->CurrentRect;
+ break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
if (texObj->MinFilter == eparam)
return;
- if (eparam==GL_NEAREST || eparam==GL_LINEAR
- || eparam==GL_NEAREST_MIPMAP_NEAREST
- || eparam==GL_LINEAR_MIPMAP_NEAREST
- || eparam==GL_NEAREST_MIPMAP_LINEAR
- || eparam==GL_LINEAR_MIPMAP_LINEAR) {
+ if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinFilter = eparam;
+ }
+ else if ((eparam==GL_NEAREST_MIPMAP_NEAREST ||
+ eparam==GL_LINEAR_MIPMAP_NEAREST ||
+ eparam==GL_NEAREST_MIPMAP_LINEAR ||
+ eparam==GL_LINEAR_MIPMAP_LINEAR) &&
+ texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MinFilter = eparam;
}
else {
return;
if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MagFilter = eparam;
}
else {
case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == eparam)
return;
- if (eparam==GL_CLAMP ||
- eparam==GL_REPEAT ||
- eparam==GL_CLAMP_TO_EDGE ||
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
- ctx->Extensions.ARB_texture_border_clamp) ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_mirrored_repeat)) {
+ ctx->Extensions.ARB_texture_border_clamp)) {
+ /* any texture target */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapS = eparam;
+ }
+ else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT_ARB &&
+ ctx->Extensions.ARB_texture_mirrored_repeat))) {
+ /* non-rectangle texture */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapS = eparam;
}
else {
case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == eparam)
return;
- if (eparam==GL_CLAMP ||
- eparam==GL_REPEAT ||
- eparam==GL_CLAMP_TO_EDGE ||
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
- ctx->Extensions.ARB_texture_border_clamp) ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_mirrored_repeat)) {
+ ctx->Extensions.ARB_texture_border_clamp)) {
+ /* any texture target */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapT = eparam;
+ }
+ else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT_ARB &&
+ ctx->Extensions.ARB_texture_mirrored_repeat))) {
+ /* non-rectangle texture */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapT = eparam;
}
else {
case GL_TEXTURE_WRAP_R_EXT:
if (texObj->WrapR == eparam)
return;
- if (eparam==GL_CLAMP ||
- eparam==GL_REPEAT ||
- eparam==GL_CLAMP_TO_EDGE ||
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
- ctx->Extensions.ARB_texture_border_clamp) ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_mirrored_repeat)) {
+ ctx->Extensions.ARB_texture_border_clamp)) {
+ /* any texture target */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapR = eparam;
+ }
+ else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT_ARB &&
+ ctx->Extensions.ARB_texture_mirrored_repeat))) {
+ /* non-rectangle texture */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapR = eparam;
}
else {
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
}
break;
- case GL_TEXTURE_BORDER_COLOR:
+#if 0 /* someday */
+ case GL_TEXTUER_BORDER_VALUES_NV:
+ /* don't clamp */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4V(texObj->BorderValues, params);
UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], params[0]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], params[1]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[2], params[2]);
UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], params[3]);
break;
+#endif
+ case GL_TEXTURE_BORDER_COLOR:
+ /* clamp */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->BorderValues[0] = CLAMP(params[0], 0.0F, 1.0F);
+ texObj->BorderValues[1] = CLAMP(params[1], 0.0F, 1.0F);
+ texObj->BorderValues[2] = CLAMP(params[2], 0.0F, 1.0F);
+ texObj->BorderValues[3] = CLAMP(params[3], 0.0F, 1.0F);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], texObj->BorderValues[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], texObj->BorderValues[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[2], texObj->BorderValues[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], texObj->BorderValues[3]);
+ break;
case GL_TEXTURE_MIN_LOD:
+ if (texObj->MinLod == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MinLod = params[0];
break;
case GL_TEXTURE_MAX_LOD:
+ if (texObj->MaxLod == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MaxLod = params[0];
break;
case GL_TEXTURE_BASE_LEVEL:
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
+ if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->BaseLevel = (GLint) params[0];
break;
case GL_TEXTURE_MAX_LEVEL:
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MaxLevel = (GLint) params[0];
break;
case GL_TEXTURE_PRIORITY:
/* (keithh@netcomuk.co.uk) */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MaxAnisotropy = params[0];
}
else {
break;
case GL_TEXTURE_COMPARE_SGIX:
if (ctx->Extensions.SGIX_shadow) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE;
}
else {
GLenum op = (GLenum) params[0];
if (op == GL_TEXTURE_LEQUAL_R_SGIX ||
op == GL_TEXTURE_GEQUAL_R_SGIX) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->CompareOperator = op;
}
else {
return;
}
break;
- case GL_SHADOW_AMBIENT_SGIX:
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
if (ctx->Extensions.SGIX_shadow_ambient) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
UNCLAMPED_FLOAT_TO_CHAN(texObj->ShadowAmbient, params[0]);
}
else {
return;
}
break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ const GLenum mode = (GLenum) params[0];
+ if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareMode = mode;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ const GLenum func = (GLenum) params[0];
+ if (func == GL_LEQUAL || func == GL_GEQUAL) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFunc = func;
+ }
+ else if (ctx->Extensions.EXT_shadow_funcs &&
+ (func == GL_EQUAL ||
+ func == GL_NOTEQUAL ||
+ func == GL_LESS ||
+ func == GL_GREATER ||
+ func == GL_ALWAYS ||
+ func == GL_NEVER)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFunc = func;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)");
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ const GLenum result = (GLenum) params[0];
+ if (result == GL_LUMINANCE || result == GL_INTENSITY
+ || result == GL_ALPHA) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->DepthMode = result;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)");
+ return;
+ }
+ break;
+
default:
{
char s[100];
return;
}
- ctx->NewState |= _NEW_TEXTURE;
texObj->Complete = GL_FALSE;
if (ctx->Driver.TexParameter) {
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle ? 2 : 0;
default:
_mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()");
return 0;
GLint maxLevels;
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ /* this will catch bad target values */
dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
if (dimensions == 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
case GL_PROXY_TEXTURE_3D:
maxLevels = ctx->Const.Max3DTextureLevels;
break;
- default:
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ maxLevels = 1;
+ break;
+ default:
+ _mesa_problem(ctx, "bad target in _mesa_GetTexLevelParameter");
+ return;
}
if (level < 0 || level >= maxLevels) {
isProxy = (target == GL_PROXY_TEXTURE_1D) ||
(target == GL_PROXY_TEXTURE_2D) ||
(target == GL_PROXY_TEXTURE_3D) ||
- (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
+ (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) ||
+ (target == GL_PROXY_TEXTURE_RECTANGLE_NV);
switch (pname) {
case GL_TEXTURE_WIDTH:
case GL_TEXTURE_WRAP_R_EXT:
*params = ENUM_TO_FLOAT(obj->WrapR);
return;
+#if 0 /* someday */
+ case GL_TEXTURE_BORDER_VALUES_NV:
+ /* unclamped */
+ params[0] = obj->BorderValues[0];
+ params[1] = obj->BorderValues[1];
+ params[2] = obj->BorderValues[2];
+ params[3] = obj->BorderValues[3];
+ return;
+#endif
case GL_TEXTURE_BORDER_COLOR:
+ /* clamped */
params[0] = obj->BorderColor[0] / CHAN_MAXF;
params[1] = obj->BorderColor[1] / CHAN_MAXF;
params[2] = obj->BorderColor[2] / CHAN_MAXF;
case GL_TEXTURE_MAX_LEVEL:
*params = (GLfloat) obj->MaxLevel;
return;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ *params = obj->MaxAnisotropy;
+ return;
+ }
+ break;
case GL_TEXTURE_COMPARE_SGIX:
if (ctx->Extensions.SGIX_shadow) {
*params = (GLfloat) obj->CompareFlag;
return;
}
break;
- case GL_SHADOW_AMBIENT_SGIX:
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
if (ctx->Extensions.SGIX_shadow_ambient) {
*params = CHAN_TO_FLOAT(obj->ShadowAmbient);
return;
return;
}
break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLfloat) obj->CompareMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLfloat) obj->CompareFunc;
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ *params = (GLfloat) obj->DepthMode;
+ return;
+ }
+ break;
default:
; /* silence warnings */
}
case GL_TEXTURE_WRAP_R_EXT:
*params = (GLint) obj->WrapR;
return;
+#if 0 /* someday */
+ case GL_TEXTURE_BORDER_VALUES_NV:
+ /* unclamped */
+ params[0] = FLOAT_TO_INT(obj->BorderValues[0]);
+ params[1] = FLOAT_TO_INT(obj->BorderValues[1]);
+ params[2] = FLOAT_TO_INT(obj->BorderValues[2]);
+ params[3] = FLOAT_TO_INT(obj->BorderValues[3]);
+ return;
+#endif
case GL_TEXTURE_BORDER_COLOR:
+ /* clamped */
{
- GLfloat color[4];
- color[0] = obj->BorderColor[0] / CHAN_MAXF;
- color[1] = obj->BorderColor[1] / CHAN_MAXF;
- color[2] = obj->BorderColor[2] / CHAN_MAXF;
- color[3] = obj->BorderColor[3] / CHAN_MAXF;
- params[0] = FLOAT_TO_INT( color[0] );
- params[1] = FLOAT_TO_INT( color[1] );
- params[2] = FLOAT_TO_INT( color[2] );
- params[3] = FLOAT_TO_INT( color[3] );
+ GLfloat b[4];
+ b[0] = CLAMP(obj->BorderValues[0], 0.0F, 1.0F);
+ b[1] = CLAMP(obj->BorderValues[1], 0.0F, 1.0F);
+ b[2] = CLAMP(obj->BorderValues[2], 0.0F, 1.0F);
+ b[3] = CLAMP(obj->BorderValues[3], 0.0F, 1.0F);
+ params[0] = FLOAT_TO_INT(b[0]);
+ params[1] = FLOAT_TO_INT(b[1]);
+ params[2] = FLOAT_TO_INT(b[2]);
+ params[3] = FLOAT_TO_INT(b[3]);
}
return;
case GL_TEXTURE_RESIDENT:
case GL_TEXTURE_MAX_LEVEL:
*params = obj->MaxLevel;
return;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ *params = (GLint) obj->MaxAnisotropy;
+ return;
+ }
+ break;
case GL_TEXTURE_COMPARE_SGIX:
if (ctx->Extensions.SGIX_shadow) {
*params = (GLint) obj->CompareFlag;
return;
}
break;
- case GL_SHADOW_AMBIENT_SGIX:
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
if (ctx->Extensions.SGIX_shadow_ambient) {
- /* XXX range? */
- *params = (GLint) CHAN_TO_FLOAT(obj->ShadowAmbient);
+ GLfloat a = CHAN_TO_FLOAT(obj->ShadowAmbient);
+ *params = (GLint) FLOAT_TO_INT(a);
return;
}
break;
return;
}
break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLint) obj->CompareMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLint) obj->CompareFunc;
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ *params = (GLint) obj->DepthMode;
+ return;
+ }
+ break;
default:
; /* silence warnings */
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "texGEN %s %s %x...\n",
- _mesa_lookup_enum_by_nr(coord),
- _mesa_lookup_enum_by_nr(pname),
- *(int *)params);
+ _mesa_debug(ctx, "texGEN %s %s %x...\n",
+ _mesa_lookup_enum_by_nr(coord),
+ _mesa_lookup_enum_by_nr(pname),
+ *(int *)params);
switch (coord) {
case GL_S:
GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
- if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
- _math_matrix_analyse( &ctx->ModelView );
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
}
- _mesa_transform_vector( tmp, params, ctx->ModelView.inv );
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
else if (pname==GL_EYE_PLANE) {
GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
- if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
- _math_matrix_analyse( &ctx->ModelView );
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
}
- _mesa_transform_vector( tmp, params, ctx->ModelView.inv );
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
else if (pname==GL_EYE_PLANE) {
GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
- if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
- _math_matrix_analyse( &ctx->ModelView );
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
}
- _mesa_transform_vector( tmp, params, ctx->ModelView.inv );
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
else if (pname==GL_EYE_PLANE) {
GLfloat tmp[4];
/* Transform plane equation by the inverse modelview matrix */
- if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
- _math_matrix_analyse( &ctx->ModelView );
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
}
- _mesa_transform_vector( tmp, params, ctx->ModelView.inv );
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glActiveTexture %s\n",
- _mesa_lookup_enum_by_nr(target));
+ _mesa_debug(ctx, "glActiveTexture %s\n",
+ _mesa_lookup_enum_by_nr(target));
if (texUnit > ctx->Const.MaxTextureUnits) {
_mesa_error(ctx, GL_INVALID_ENUM, "glActiveTextureARB(target)");