diff options
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r-- | src/mesa/main/texstate.c | 780 |
1 files changed, 433 insertions, 347 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 67cb4022dc..fe6d9157de 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.71 2002/05/02 00:59:20 brianp Exp $ */ +/* $Id: texstate.c,v 1.72 2002/05/27 17:04:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -75,7 +75,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) _mesa_error(ctx, errCode, s); \ } - if (target==GL_TEXTURE_ENV) { + if (target == GL_TEXTURE_ENV) { switch (pname) { case GL_TEXTURE_ENV_MODE: { @@ -402,24 +402,52 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) 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; @@ -482,176 +510,205 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) 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, "glGetTexEnvfv(target)" ); - return; + 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)" ); + } } - - 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: + 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; } } @@ -663,179 +720,208 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) 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; + 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)" ); + } } - - 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_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; + } + } + 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; } } |