-/* $Id: texstate.c,v 1.91 2003/01/16 15:22:13 brianp Exp $ */
+/* $Id: texstate.c,v 1.92 2003/01/21 15:49:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
mode == GL_DECAL ||
mode == GL_REPLACE ||
(mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) ||
- (mode == GL_COMBINE_EXT &&
+ (mode == GL_COMBINE &&
(ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine))) {
/* legal */
COPY_4FV(texUnit->EnvColor, tmp);
}
break;
- case GL_COMBINE_RGB_EXT:
+ case GL_COMBINE_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum mode = (GLenum) (GLint) *param;
case GL_REPLACE:
case GL_MODULATE:
case GL_ADD:
- case GL_ADD_SIGNED_EXT:
- case GL_INTERPOLATE_EXT:
+ case GL_ADD_SIGNED:
+ case GL_INTERPOLATE:
/* OK */
break;
- case GL_SUBTRACT_ARB:
+ case GL_SUBTRACT:
if (!ctx->Extensions.ARB_texture_env_combine) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
return;
}
break;
- case GL_DOT3_RGB_ARB:
- case GL_DOT3_RGBA_ARB:
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
if (!ctx->Extensions.ARB_texture_env_dot3) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
break;
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ if (!ctx->Extensions.ATI_texture_env_combine3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
return;
}
break;
- case GL_COMBINE_ALPHA_EXT:
+ case GL_COMBINE_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum mode = (GLenum) (GLint) *param;
- 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;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->CombineModeA = mode;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_INTERPOLATE:
+ /* OK */
+ break;
+ case GL_SUBTRACT:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ if (!ctx->Extensions.ATI_texture_env_combine3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ default:
+ 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);
return;
}
break;
- case GL_SOURCE0_RGB_EXT:
- case GL_SOURCE1_RGB_EXT:
- case GL_SOURCE2_RGB_EXT:
+ 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 GLenum source = (GLenum) (GLint) *param;
- const GLuint s = pname - GL_SOURCE0_RGB_EXT;
+ const GLuint s = pname - GL_SOURCE0_RGB;
if (source == GL_TEXTURE ||
- source == GL_CONSTANT_EXT ||
- source == GL_PRIMARY_COLOR_EXT ||
- source == GL_PREVIOUS_EXT ||
+ source == GL_CONSTANT ||
+ source == GL_PRIMARY_COLOR ||
+ source == GL_PREVIOUS ||
(ctx->Extensions.ARB_texture_env_crossbar &&
- source >= GL_TEXTURE0_ARB &&
- source < GL_TEXTURE0_ARB + ctx->Const.MaxTextureUnits)) {
+ source >= GL_TEXTURE0 &&
+ source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
+ (ctx->Extensions.ATI_texture_env_combine3 &&
+ (source == GL_ZERO || source == GL_ONE))) {
/* legal */
if (texUnit->CombineSourceRGB[s] == source)
return;
return;
}
break;
- case GL_SOURCE0_ALPHA_EXT:
- case GL_SOURCE1_ALPHA_EXT:
- case GL_SOURCE2_ALPHA_EXT:
+ 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 GLenum source = (GLenum) (GLint) *param;
- const GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
+ const GLuint s = pname - GL_SOURCE0_ALPHA;
if (source == GL_TEXTURE ||
- source == GL_CONSTANT_EXT ||
- source == GL_PRIMARY_COLOR_EXT ||
- source == GL_PREVIOUS_EXT ||
+ source == GL_CONSTANT ||
+ source == GL_PRIMARY_COLOR ||
+ source == GL_PREVIOUS ||
(ctx->Extensions.ARB_texture_env_crossbar &&
- source >= GL_TEXTURE0_ARB &&
- source < GL_TEXTURE0_ARB + ctx->Const.MaxTextureUnits)) {
+ source >= GL_TEXTURE0 &&
+ source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
+ (ctx->Extensions.ATI_texture_env_combine3 &&
+ (source == GL_ZERO || source == GL_ONE))) {
/* legal */
if (texUnit->CombineSourceA[s] == source)
return;
return;
}
break;
- case GL_OPERAND0_RGB_EXT:
- case GL_OPERAND1_RGB_EXT:
+ case GL_OPERAND0_RGB:
+ case GL_OPERAND1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum operand = (GLenum) (GLint) *param;
- const GLuint s = pname - GL_OPERAND0_RGB_EXT;
+ const GLuint s = pname - GL_OPERAND0_RGB;
switch (operand) {
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
return;
}
break;
- case GL_OPERAND0_ALPHA_EXT:
- case GL_OPERAND1_ALPHA_EXT:
+ case GL_OPERAND0_ALPHA:
+ case GL_OPERAND1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum operand = (GLenum) (GLint) *param;
switch (operand) {
case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
- if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] ==
+ if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA] ==
operand)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand;
+ texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA] = operand;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
return;
}
break;
- case GL_OPERAND2_RGB_EXT:
+ case GL_OPERAND2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum operand = (GLenum) (GLint) *param;
return;
}
break;
- case GL_OPERAND2_ALPHA_EXT:
+ case GL_OPERAND2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
const GLenum operand = (GLenum) (GLint) *param;
return;
}
break;
- case GL_RGB_SCALE_EXT:
+ case GL_RGB_SCALE:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
GLuint newshift;
case GL_TEXTURE_ENV_COLOR:
COPY_4FV( params, texUnit->EnvColor );
break;
- case GL_COMBINE_RGB_EXT:
+ case GL_COMBINE_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineModeRGB;
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_COMBINE_ALPHA_EXT:
+ case GL_COMBINE_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineModeA;
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_SOURCE0_RGB_EXT:
+ case GL_SOURCE0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineSourceRGB[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_SOURCE1_RGB_EXT:
+ case GL_SOURCE1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineSourceRGB[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_SOURCE2_RGB_EXT:
+ case GL_SOURCE2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineSourceRGB[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_SOURCE0_ALPHA_EXT:
+ case GL_SOURCE0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineSourceA[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_SOURCE1_ALPHA_EXT:
+ case GL_SOURCE1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineSourceA[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_SOURCE2_ALPHA_EXT:
+ case GL_SOURCE2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineSourceA[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_OPERAND0_RGB_EXT:
+ case GL_OPERAND0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineOperandRGB[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_OPERAND1_RGB_EXT:
+ case GL_OPERAND1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineOperandRGB[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_OPERAND2_RGB_EXT:
+ case GL_OPERAND2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineOperandRGB[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_OPERAND0_ALPHA_EXT:
+ case GL_OPERAND0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineOperandA[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_OPERAND1_ALPHA_EXT:
+ case GL_OPERAND1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineOperandA[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_OPERAND2_ALPHA_EXT:
+ case GL_OPERAND2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLfloat) texUnit->CombineOperandA[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
}
break;
- case GL_RGB_SCALE_EXT:
+ case GL_RGB_SCALE:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
if (texUnit->CombineScaleShiftRGB == 0)
params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
break;
- case GL_COMBINE_RGB_EXT:
+ case GL_COMBINE_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineModeRGB;
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_COMBINE_ALPHA_EXT:
+ case GL_COMBINE_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineModeA;
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_SOURCE0_RGB_EXT:
+ case GL_SOURCE0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceRGB[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_SOURCE1_RGB_EXT:
+ case GL_SOURCE1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceRGB[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_SOURCE2_RGB_EXT:
+ case GL_SOURCE2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceRGB[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_SOURCE0_ALPHA_EXT:
+ case GL_SOURCE0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceA[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_SOURCE1_ALPHA_EXT:
+ case GL_SOURCE1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceA[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_SOURCE2_ALPHA_EXT:
+ case GL_SOURCE2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineSourceA[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_OPERAND0_RGB_EXT:
+ case GL_OPERAND0_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandRGB[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_OPERAND1_RGB_EXT:
+ case GL_OPERAND1_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandRGB[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_OPERAND2_RGB_EXT:
+ case GL_OPERAND2_RGB:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandRGB[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_OPERAND0_ALPHA_EXT:
+ case GL_OPERAND0_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandA[0];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_OPERAND1_ALPHA_EXT:
+ case GL_OPERAND1_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandA[1];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_OPERAND2_ALPHA_EXT:
+ case GL_OPERAND2_ALPHA:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
*params = (GLint) texUnit->CombineOperandA[2];
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
}
break;
- case GL_RGB_SCALE_EXT:
+ case GL_RGB_SCALE:
if (ctx->Extensions.EXT_texture_env_combine ||
ctx->Extensions.ARB_texture_env_combine) {
if (texUnit->CombineScaleShiftRGB == 0)
case GL_TEXTURE_2D:
texObj = texUnit->Current2D;
break;
- case GL_TEXTURE_3D_EXT:
+ case GL_TEXTURE_3D:
texObj = texUnit->Current3D;
break;
- case GL_TEXTURE_CUBE_MAP_ARB:
+ case GL_TEXTURE_CUBE_MAP:
if (!ctx->Extensions.ARB_texture_cube_map) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
if (texObj->WrapS == eparam)
return;
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
- (eparam == GL_CLAMP_TO_BORDER_ARB &&
+ (eparam == GL_CLAMP_TO_BORDER &&
ctx->Extensions.ARB_texture_border_clamp)) {
/* any texture target */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
}
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
+ (eparam == GL_MIRRORED_REPEAT &&
ctx->Extensions.ARB_texture_mirrored_repeat) ||
(eparam == GL_MIRROR_CLAMP_ATI &&
ctx->Extensions.ATI_texture_mirror_once) ||
if (texObj->WrapT == eparam)
return;
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
- (eparam == GL_CLAMP_TO_BORDER_ARB &&
+ (eparam == GL_CLAMP_TO_BORDER &&
ctx->Extensions.ARB_texture_border_clamp)) {
/* any texture target */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
}
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
+ (eparam == GL_MIRRORED_REPEAT &&
ctx->Extensions.ARB_texture_mirrored_repeat) ||
(eparam == GL_MIRROR_CLAMP_ATI &&
ctx->Extensions.ATI_texture_mirror_once) ||
return;
}
break;
- case GL_TEXTURE_WRAP_R_EXT:
+ case GL_TEXTURE_WRAP_R:
if (texObj->WrapR == eparam)
return;
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
- (eparam == GL_CLAMP_TO_BORDER_ARB &&
+ (eparam == GL_CLAMP_TO_BORDER &&
ctx->Extensions.ARB_texture_border_clamp)) {
/* any texture target */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
}
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
+ (eparam == GL_MIRRORED_REPEAT &&
ctx->Extensions.ARB_texture_mirrored_repeat) ||
(eparam == GL_MIRROR_CLAMP_ATI &&
ctx->Extensions.ATI_texture_mirror_once) ||
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
return 3;
- case GL_TEXTURE_CUBE_MAP_ARB:
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
case GL_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_3D:
maxLevels = ctx->Const.Max3DTextureLevels;
break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
case GL_TEXTURE_RECTANGLE_NV:
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) ||
(target == GL_PROXY_TEXTURE_RECTANGLE_NV);
switch (pname) {
return;
/* GL_ARB_texture_compression */
- case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB:
+ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
if (ctx->Extensions.ARB_texture_compression) {
if (img->IsCompressed && !isProxy)
*params = img->CompressedSize;
"glGetTexLevelParameter[if]v(pname)");
}
return;
- case GL_TEXTURE_COMPRESSED_ARB:
+ case GL_TEXTURE_COMPRESSED:
if (ctx->Extensions.ARB_texture_compression) {
*params = (GLint) img->IsCompressed;
}
case GL_TEXTURE_WRAP_T:
*params = ENUM_TO_FLOAT(obj->WrapT);
return;
- case GL_TEXTURE_WRAP_R_EXT:
+ case GL_TEXTURE_WRAP_R:
*params = ENUM_TO_FLOAT(obj->WrapR);
return;
case GL_TEXTURE_BORDER_COLOR:
case GL_TEXTURE_WRAP_T:
*params = (GLint) obj->WrapT;
return;
- case GL_TEXTURE_WRAP_R_EXT:
+ case GL_TEXTURE_WRAP_R:
*params = (GLint) obj->WrapR;
return;
case GL_TEXTURE_BORDER_COLOR:
_mesa_ActiveTextureARB( GLenum target )
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = target - GL_TEXTURE0_ARB;
+ GLuint texUnit = target - GL_TEXTURE0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
/* Cater for texture unit 0 is first, therefore use >= */
if (texUnit >= ctx->Const.MaxTextureUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTextureARB(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)");
return;
}
_mesa_ClientActiveTextureARB( GLenum target )
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = target - GL_TEXTURE0_ARB;
+ GLuint texUnit = target - GL_TEXTURE0;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (texUnit > ctx->Const.MaxTextureUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTextureARB(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)");
return;
}
-/* $Id: s_texture.c,v 1.75 2002/11/12 19:27:24 brianp Exp $ */
+/* $Id: s_texture.c,v 1.76 2003/01/21 15:49:19 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
* Used to compute texel locations for linear sampling.
* Input:
- * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER_ARB
+ * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER
* S = texcoord in [0,1]
* SIZE = width (or height or depth) of texture
* Output:
if (I1 >= (GLint) SIZE) \
I1 = SIZE - 1; \
} \
- else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \
+ else if (wrapMode == GL_CLAMP_TO_BORDER) { \
const GLfloat min = -1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
if (S <= min) \
I0 = IFLOOR(U); \
I1 = I0 + 1; \
} \
- else if (wrapMode == GL_MIRRORED_REPEAT_ARB) { \
+ else if (wrapMode == GL_MIRRORED_REPEAT) { \
const GLint flr = IFLOOR(S); \
if (flr & 1) \
U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \
else \
I = IFLOOR(S * SIZE); \
} \
- else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \
+ else if (wrapMode == GL_CLAMP_TO_BORDER) { \
/* s limited to [min,max] */ \
/* i limited to [-1, size] */ \
const GLfloat min = -1.0F / (2.0F * SIZE); \
else \
I = IFLOOR(S * SIZE); \
} \
- else if (wrapMode == GL_MIRRORED_REPEAT_ARB) { \
+ else if (wrapMode == GL_MIRRORED_REPEAT) { \
const GLfloat min = 1.0F / (2.0F * SIZE); \
const GLfloat max = 1.0F - min; \
const GLint flr = IFLOOR(S); \
i += img->Border;
if (i < 0 || i >= (GLint) img->Width) {
- /* Need this test for GL_CLAMP_TO_BORDER_ARB mode */
+ /* Need this test for GL_CLAMP_TO_BORDER mode */
COPY_CHAN4(rgba, tObj->_BorderChan);
}
else {
j += img->Border;
if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) {
- /* Need this test for GL_CLAMP_TO_BORDER_ARB mode */
+ /* Need this test for GL_CLAMP_TO_BORDER mode */
COPY_CHAN4(rgba, tObj->_BorderChan);
}
else {
if (i < 0 || i >= (GLint) img->Width ||
j < 0 || j >= (GLint) img->Height ||
k < 0 || k >= (GLint) img->Depth) {
- /* Need this test for GL_CLAMP_TO_BORDER_ARB mode */
+ /* Need this test for GL_CLAMP_TO_BORDER mode */
COPY_CHAN4(rgba, tObj->_BorderChan);
}
else {
ASSERT(tObj->WrapS == GL_CLAMP ||
tObj->WrapS == GL_CLAMP_TO_EDGE ||
- tObj->WrapS == GL_CLAMP_TO_BORDER_ARB);
+ tObj->WrapS == GL_CLAMP_TO_BORDER);
ASSERT(tObj->WrapT == GL_CLAMP ||
tObj->WrapT == GL_CLAMP_TO_EDGE ||
- tObj->WrapT == GL_CLAMP_TO_BORDER_ARB);
+ tObj->WrapT == GL_CLAMP_TO_BORDER);
ASSERT(img->Format != GL_COLOR_INDEX);
/* XXX move Wrap mode tests outside of loops for common cases */
ASSERT(tObj->WrapS == GL_CLAMP ||
tObj->WrapS == GL_CLAMP_TO_EDGE ||
- tObj->WrapS == GL_CLAMP_TO_BORDER_ARB);
+ tObj->WrapS == GL_CLAMP_TO_BORDER);
ASSERT(tObj->WrapT == GL_CLAMP ||
tObj->WrapT == GL_CLAMP_TO_EDGE ||
- tObj->WrapT == GL_CLAMP_TO_BORDER_ARB);
+ tObj->WrapT == GL_CLAMP_TO_BORDER);
ASSERT(img->Format != GL_COLOR_INDEX);
/* XXX lots of opportunity for optimization in this loop */
swrast->TextureSample[texUnit] = sample_nearest_3d;
}
break;
- case GL_TEXTURE_CUBE_MAP_ARB:
+ case GL_TEXTURE_CUBE_MAP:
if (needLambda) {
swrast->TextureSample[texUnit] = sample_lambda_cube;
}
/**
* Do texture application for GL_ARB/EXT_texture_env_combine.
- * Input:
- * ctx - rendering context
- * textureUnit - the texture unit to apply
- * n - number of fragments to process (span width)
- * primary_rgba - incoming fragment color array
- * texelBuffer - pointer to texel colors for all texture units
- * Input/Output:
- * rgba - incoming colors, which get modified here
+ * This function also supports GL_{EXT,ARB}_texture_env_dot3 and
+ * GL_ATI_texture_env_combine3
+ *
+ * \param ctx rendering context
+ * \param textureUnit the texture unit to apply
+ * \param n number of fragments to process (span width)
+ * \param primary_rgba incoming fragment color array
+ * \param texelBuffer pointer to texel colors for all texture units
+ *
+ * \param rgba incoming colors, which get modified here
*/
static INLINE void
texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
#if CHAN_TYPE == GL_FLOAT
const GLchan RGBmult = (GLfloat) (1 << RGBshift);
const GLchan Amult = (GLfloat) (1 << Ashift);
+ static const GLchan one[4] = { 1.0, 1.0, 1.0, 1.0 };
+ static const GLchan zero[4] = { 0.0, 0.0, 0.0, 0.0 };
#else
const GLint half = (CHAN_MAX + 1) / 2;
+ static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX };
+ static const GLchan zero[4] = { 0, 0, 0, 0 };
#endif
GLuint i, j;
+ GLuint numColorArgs;
+ GLuint numAlphaArgs;
/* GLchan ccolor[3][4]; */
DEFMNARRAY(GLchan, ccolor, 3, 3 * MAX_WIDTH, 4); /* mac 32k limitation */
/*
* Do operand setup for up to 3 operands. Loop over the terms.
*/
- for (j = 0; j < 3; j++) {
- const GLenum srcA = textureUnit->CombineSourceA[j];
+ switch (textureUnit->CombineModeRGB) {
+ case GL_REPLACE:
+ numColorArgs = 1;
+ break;
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_SUBTRACT:
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ numColorArgs = 2;
+ break;
+ case GL_INTERPOLATE:
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ numColorArgs = 3;
+ break;
+ default:
+ numColorArgs = 0;
+ ASSERT(0);
+ break;
+ }
+
+ switch (textureUnit->CombineModeA) {
+ case GL_REPLACE:
+ numAlphaArgs = 1;
+ break;
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_SUBTRACT:
+ numAlphaArgs = 2;
+ break;
+ case GL_INTERPOLATE:
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ numAlphaArgs = 3;
+ break;
+ default:
+ numAlphaArgs = 0;
+ ASSERT(0);
+ break;
+ }
+
+ for (j = 0; j < numColorArgs; j++) {
const GLenum srcRGB = textureUnit->CombineSourceRGB[j];
- switch (srcA) {
- case GL_TEXTURE:
- argA[j] = (const GLchan (*)[4])
- (texelBuffer + unit * (n * 4 * sizeof(GLchan)));
- break;
- case GL_PRIMARY_COLOR_EXT:
- argA[j] = primary_rgba;
- break;
- case GL_PREVIOUS_EXT:
- argA[j] = (const GLchan (*)[4]) rgba;
- break;
- case GL_CONSTANT_EXT:
- {
- GLchan alpha, (*c)[4] = ccolor[j];
- UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]);
- for (i = 0; i < n; i++)
- c[i][ACOMP] = alpha;
- argA[j] = (const GLchan (*)[4]) ccolor[j];
- }
- break;
- default:
- /* ARB_texture_env_crossbar source */
- {
- const GLuint srcUnit = srcA - GL_TEXTURE0_ARB;
- ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
- if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
- return;
- argA[j] = (const GLchan (*)[4])
- (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan)));
- }
- }
switch (srcRGB) {
case GL_TEXTURE:
argRGB[j] = (const GLchan (*)[4])
(texelBuffer + unit * (n * 4 * sizeof(GLchan)));
break;
- case GL_PRIMARY_COLOR_EXT:
+ case GL_PRIMARY_COLOR:
argRGB[j] = primary_rgba;
break;
- case GL_PREVIOUS_EXT:
+ case GL_PREVIOUS:
argRGB[j] = (const GLchan (*)[4]) rgba;
break;
- case GL_CONSTANT_EXT:
+ case GL_CONSTANT:
{
GLchan (*c)[4] = ccolor[j];
GLchan red, green, blue, alpha;
argRGB[j] = (const GLchan (*)[4]) ccolor[j];
}
break;
+ /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources.
+ */
+ case GL_ZERO:
+ argRGB[j] = & zero;
+ break;
+ case GL_ONE:
+ argRGB[j] = & one;
+ break;
default:
/* ARB_texture_env_crossbar source */
{
- const GLuint srcUnit = srcRGB - GL_TEXTURE0_ARB;
+ const GLuint srcUnit = srcRGB - GL_TEXTURE0;
ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
return;
}
}
}
+ }
+
+
+ for (j = 0; j < numAlphaArgs; j++) {
+ const GLenum srcA = textureUnit->CombineSourceA[j];
+
+ switch (srcA) {
+ case GL_TEXTURE:
+ argA[j] = (const GLchan (*)[4])
+ (texelBuffer + unit * (n * 4 * sizeof(GLchan)));
+ break;
+ case GL_PRIMARY_COLOR:
+ argA[j] = primary_rgba;
+ break;
+ case GL_PREVIOUS:
+ argA[j] = (const GLchan (*)[4]) rgba;
+ break;
+ case GL_CONSTANT:
+ {
+ GLchan alpha, (*c)[4] = ccolor[j];
+ UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]);
+ for (i = 0; i < n; i++)
+ c[i][ACOMP] = alpha;
+ argA[j] = (const GLchan (*)[4]) ccolor[j];
+ }
+ break;
+ /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources.
+ */
+ case GL_ZERO:
+ argA[j] = & zero;
+ break;
+ case GL_ONE:
+ argA[j] = & one;
+ break;
+ default:
+ /* ARB_texture_env_crossbar source */
+ {
+ const GLuint srcUnit = srcA - GL_TEXTURE0;
+ ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
+ if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
+ return;
+ argA[j] = (const GLchan (*)[4])
+ (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan)));
+ }
+ }
if (textureUnit->CombineOperandA[j] == GL_ONE_MINUS_SRC_ALPHA) {
const GLchan (*src)[4] = argA[j];
dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP];
}
}
-
- if (textureUnit->CombineModeRGB == GL_REPLACE &&
- textureUnit->CombineModeA == GL_REPLACE) {
- break; /* done, we need only arg0 */
- }
-
- if (j == 1 &&
- textureUnit->CombineModeRGB != GL_INTERPOLATE_EXT &&
- textureUnit->CombineModeA != GL_INTERPOLATE_EXT) {
- break; /* arg0 and arg1 are done. we don't need arg2. */
- }
}
/*
}
}
break;
- case GL_ADD_SIGNED_EXT:
+ case GL_ADD_SIGNED:
{
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
}
}
break;
- case GL_INTERPOLATE_EXT:
+ case GL_INTERPOLATE:
{
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
}
}
break;
- case GL_SUBTRACT_ARB:
+ case GL_SUBTRACT:
{
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
}
}
break;
- case GL_DOT3_RGB_ARB:
- case GL_DOT3_RGBA_ARB:
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
{
/* DO scale the result by 1 2 or 4 */
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
}
}
break;
+ case GL_MODULATE_ADD_ATI:
+ {
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
+ const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
+#if CHAN_TYPE != GL_FLOAT
+ const GLint shift = CHAN_BITS - RGBshift;
+#endif
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP]) * RGBmult;
+ rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP]) * RGBmult;
+ rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP]) * RGBmult;
+#else
+ GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP])
+ + ((GLuint) arg1[i][RCOMP] << CHAN_BITS)) >> shift;
+ GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP])
+ + ((GLuint) arg1[i][GCOMP] << CHAN_BITS)) >> shift;
+ GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP])
+ + ((GLuint) arg1[i][BCOMP] << CHAN_BITS)) >> shift;
+ rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
+ rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
+ rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
+#endif
+ }
+ }
+ break;
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ {
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
+ const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
+#if CHAN_TYPE != GL_FLOAT
+ const GLint shift = CHAN_BITS - RGBshift;
+#endif
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP] - 0.5) * RGBmult;
+ rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP] - 0.5) * RGBmult;
+ rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP] - 0.5) * RGBmult;
+#else
+ GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP])
+ + (((GLint) arg1[i][RCOMP] - half) << CHAN_BITS))
+ >> shift;
+ GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP])
+ + (((GLint) arg1[i][GCOMP] - half) << CHAN_BITS))
+ >> shift;
+ GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP])
+ + (((GLint) arg1[i][BCOMP] - half) << CHAN_BITS))
+ >> shift;
+ rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
+ rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
+ rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+#endif
+ }
+ }
+ break;
+ case GL_MODULATE_SUBTRACT_ATI:
+ {
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
+ const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
+#if CHAN_TYPE != GL_FLOAT
+ const GLint shift = CHAN_BITS - RGBshift;
+#endif
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - arg1[i][RCOMP]) * RGBmult;
+ rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - arg1[i][GCOMP]) * RGBmult;
+ rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - arg1[i][BCOMP]) * RGBmult;
+#else
+ GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP])
+ - ((GLint) arg1[i][RCOMP] << CHAN_BITS))
+ >> shift;
+ GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP])
+ - ((GLint) arg1[i][GCOMP] << CHAN_BITS))
+ >> shift;
+ GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP])
+ - ((GLint) arg1[i][BCOMP] << CHAN_BITS))
+ >> shift;
+ rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
+ rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
+ rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+#endif
+ }
+ }
+ break;
default:
_mesa_problem(ctx, "invalid combine mode");
}
}
}
break;
- case GL_ADD_SIGNED_EXT:
+ case GL_ADD_SIGNED:
{
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
}
}
break;
- case GL_INTERPOLATE_EXT:
+ case GL_INTERPOLATE:
{
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
}
}
break;
- case GL_SUBTRACT_ARB:
+ case GL_SUBTRACT:
{
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
}
}
break;
-
+ case GL_MODULATE_ADD_ATI:
+ {
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
+ const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
+#if CHAN_TYPE != GL_FLOAT
+ const GLint shift = CHAN_BITS - Ashift;
+#endif
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP]) * Amult;
+#else
+ GLuint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP])
+ + ((GLuint) arg1[i][ACOMP] << CHAN_BITS))
+ >> shift;
+ rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+#endif
+ }
+ }
+ break;
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ {
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
+ const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
+#if CHAN_TYPE != GL_FLOAT
+ const GLint shift = CHAN_BITS - Ashift;
+#endif
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP] - 0.5F) * Amult;
+#else
+ GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP])
+ + (((GLint) arg1[i][ACOMP] - half) << CHAN_BITS))
+ >> shift;
+ rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+#endif
+ }
+ }
+ break;
+ case GL_MODULATE_SUBTRACT_ATI:
+ {
+ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
+ const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
+ const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
+#if CHAN_TYPE != GL_FLOAT
+ const GLint shift = CHAN_BITS - Ashift;
+#endif
+ for (i = 0; i < n; i++) {
+#if CHAN_TYPE == GL_FLOAT
+ rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) - arg1[i][ACOMP]) * Amult;
+#else
+ GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP])
+ - ((GLint) arg1[i][ACOMP] << CHAN_BITS))
+ >> shift;
+ rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+#endif
+ }
+ }
+ break;
default:
_mesa_problem(ctx, "invalid combine mode");
}
* GL_DOT3.
*/
if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT ||
- textureUnit->CombineModeRGB == GL_DOT3_RGBA_ARB) {
+ textureUnit->CombineModeRGB == GL_DOT3_RGBA) {
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = rgba[i][RCOMP];
}
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if (texUnit->EnvMode == GL_COMBINE_EXT) {
+ if (texUnit->EnvMode == GL_COMBINE) {
/* GL_ARB/EXT_texture_env_combine */
texture_combine( ctx, unit, span->end,
(CONST GLchan (*)[4]) primary_rgba,