X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexenv.c;h=1aadd7fde5835e593be62e57683b1fba199d0361;hb=5314afa27aa8d9260ed0b0a42a6d6050313953da;hp=194bcbea9831ccc463411221edf9bc8eeeb5f158;hpb=652901e95b4ed406293d0e1fabee857c054119b1;p=mesa.git diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 194bcbea983..1aadd7fde58 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -18,9 +17,10 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /** @@ -32,9 +32,11 @@ #include "main/glheader.h" #include "main/context.h" +#include "main/blend.h" #include "main/enums.h" #include "main/macros.h" #include "main/mtypes.h" +#include "main/state.h" #include "main/texenv.h" #include "main/texstate.h" @@ -59,19 +61,14 @@ set_env_mode(struct gl_context *ctx, case GL_BLEND: case GL_DECAL: case GL_REPLACE: + case GL_ADD: + case GL_COMBINE: legal = GL_TRUE; break; case GL_REPLACE_EXT: mode = GL_REPLACE; /* GL_REPLACE_EXT != GL_REPLACE */ legal = GL_TRUE; break; - case GL_ADD: - legal = ctx->Extensions.EXT_texture_env_add; - break; - case GL_COMBINE: - legal = (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine); - break; case GL_COMBINE4_NV: legal = ctx->Extensions.NV_texture_env_combine4; break; @@ -94,15 +91,14 @@ set_env_color(struct gl_context *ctx, struct gl_texture_unit *texUnit, const GLfloat *color) { - GLfloat tmp[4]; - tmp[0] = CLAMP(color[0], 0.0F, 1.0F); - tmp[1] = CLAMP(color[1], 0.0F, 1.0F); - tmp[2] = CLAMP(color[2], 0.0F, 1.0F); - tmp[3] = CLAMP(color[3], 0.0F, 1.0F); - if (TEST_EQ_4V(tmp, texUnit->EnvColor)) + if (TEST_EQ_4V(color, texUnit->EnvColorUnclamped)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EnvColor, tmp); + COPY_4FV(texUnit->EnvColorUnclamped, color); + texUnit->EnvColor[0] = CLAMP(color[0], 0.0F, 1.0F); + texUnit->EnvColor[1] = CLAMP(color[1], 0.0F, 1.0F); + texUnit->EnvColor[2] = CLAMP(color[2], 0.0F, 1.0F); + texUnit->EnvColor[3] = CLAMP(color[3], 0.0F, 1.0F); } @@ -114,12 +110,6 @@ set_combiner_mode(struct gl_context *ctx, { GLboolean legal; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - switch (mode) { case GL_REPLACE: case GL_MODULATE: @@ -133,7 +123,8 @@ set_combiner_mode(struct gl_context *ctx, break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: - legal = (ctx->Extensions.EXT_texture_env_dot3 && + legal = (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.EXT_texture_env_dot3 && pname == GL_COMBINE_RGB); break; case GL_DOT3_RGB: @@ -144,10 +135,12 @@ set_combiner_mode(struct gl_context *ctx, case GL_MODULATE_ADD_ATI: case GL_MODULATE_SIGNED_ADD_ATI: case GL_MODULATE_SUBTRACT_ATI: - legal = ctx->Extensions.ATI_texture_env_combine3; + legal = (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ATI_texture_env_combine3); break; case GL_BUMP_ENVMAP_ATI: - legal = (ctx->Extensions.ATI_envmap_bumpmap && + legal = (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ATI_envmap_bumpmap && pname == GL_COMBINE_RGB); break; default: @@ -189,12 +182,6 @@ set_combiner_source(struct gl_context *ctx, GLuint term; GLboolean alpha, legal; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - /* * Translate pname to (term, alpha). * @@ -220,7 +207,8 @@ set_combiner_source(struct gl_context *ctx, return; } - if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) { + if ((term == 3) && (ctx->API != API_OPENGL_COMPAT + || !ctx->Extensions.NV_texture_env_combine4)) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } @@ -249,11 +237,13 @@ set_combiner_source(struct gl_context *ctx, param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits); break; case GL_ZERO: - legal = (ctx->Extensions.ATI_texture_env_combine3 || - ctx->Extensions.NV_texture_env_combine4); + legal = (ctx->API == API_OPENGL_COMPAT && + (ctx->Extensions.ATI_texture_env_combine3 || + ctx->Extensions.NV_texture_env_combine4)); break; case GL_ONE: - legal = ctx->Extensions.ATI_texture_env_combine3; + legal = (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ATI_texture_env_combine3); break; default: legal = GL_FALSE; @@ -282,12 +272,6 @@ set_combiner_operand(struct gl_context *ctx, GLuint term; GLboolean alpha, legal; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - /* The enums were given sequential values for a reason. */ switch (pname) { @@ -310,7 +294,8 @@ set_combiner_operand(struct gl_context *ctx, return; } - if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) { + if ((term == 3) && (ctx->API != API_OPENGL_COMPAT + || !ctx->Extensions.NV_texture_env_combine4)) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } @@ -324,8 +309,8 @@ set_combiner_operand(struct gl_context *ctx, case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: /* The color input can only be used with GL_OPERAND[01]_RGB in the EXT - * version. In the ARB and NV versions they can be used for any RGB - * operand. + * version. In the ARB and NV versions and OpenGL ES 1.x they can be + * used for any RGB operand. */ legal = !alpha && ((term < 2) || ctx->Extensions.ARB_texture_env_combine @@ -334,7 +319,7 @@ set_combiner_operand(struct gl_context *ctx, case GL_ONE_MINUS_SRC_ALPHA: /* GL_ONE_MINUS_SRC_ALPHA can only be used with * GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV - * versions it can be used for any operand. + * versions and OpenGL ES 1.x it can be used for any operand. */ legal = (term < 2) || ctx->Extensions.ARB_texture_env_combine || ctx->Extensions.NV_texture_env_combine4; @@ -367,12 +352,6 @@ set_combiner_scale(struct gl_context *ctx, { GLuint shift; - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - if (scale == 1.0F) { shift = 0; } @@ -411,13 +390,13 @@ set_combiner_scale(struct gl_context *ctx, void GLAPIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) { + const GLint iparam0 = (GLint) param[0]; + struct gl_texture_unit *texUnit; GLuint maxUnit; GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit; - ASSERT_OUTSIDE_BEGIN_END(ctx); maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) - ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; + ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits; if (ctx->Texture.CurrentUnit >= maxUnit) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)"); return; @@ -428,14 +407,14 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (target == GL_TEXTURE_ENV) { switch (pname) { case GL_TEXTURE_ENV_MODE: - set_env_mode(ctx, texUnit, (GLenum) (GLint) param[0]); + set_env_mode(ctx, texUnit, (GLenum) iparam0); break; case GL_TEXTURE_ENV_COLOR: set_env_color(ctx, texUnit, param); break; case GL_COMBINE_RGB: case GL_COMBINE_ALPHA: - set_combiner_mode(ctx, texUnit, pname, (GLenum) (GLint) param[0]); + set_combiner_mode(ctx, texUnit, pname, (GLenum) iparam0); break; case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: @@ -445,7 +424,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: case GL_SOURCE3_ALPHA_NV: - set_combiner_source(ctx, texUnit, pname, (GLenum) (GLint) param[0]); + set_combiner_source(ctx, texUnit, pname, (GLenum) iparam0); break; case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: @@ -455,30 +434,30 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: case GL_OPERAND3_ALPHA_NV: - set_combiner_operand(ctx, texUnit, pname, (GLenum) (GLint) param[0]); + set_combiner_operand(ctx, texUnit, pname, (GLenum) iparam0); break; case GL_RGB_SCALE: case GL_ALPHA_SCALE: set_combiner_scale(ctx, texUnit, pname, param[0]); break; case GL_BUMP_TARGET_ATI: - if (!ctx->Extensions.ATI_envmap_bumpmap) { + if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname ); return; } - if (((GLenum) (GLint) param[0] < GL_TEXTURE0) || - ((GLenum) (GLint) param[0] > GL_TEXTURE31)) { + if ((iparam0 < GL_TEXTURE0) || + (iparam0 > GL_TEXTURE31)) { /* spec doesn't say this but it seems logical */ - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param=0x%x)", (GLenum) (GLint) param[0]); + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param=0x%x)", iparam0); return; } - if (!((1 << ((GLenum) (GLint) param[0] - GL_TEXTURE0)) & ctx->Const.SupportedBumpUnits)) { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", (GLenum) (GLint) param[0]); + if (!((1 << (iparam0 - GL_TEXTURE0)) & ctx->Const.SupportedBumpUnits)) { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", iparam0); return; } else { FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->BumpTarget = (GLenum) (GLint) param[0]; + texUnit->BumpTarget = iparam0; } break; default: @@ -487,11 +466,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } } 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(target=0x%x)", target ); - return; - } if (pname == GL_TEXTURE_LOD_BIAS_EXT) { if (texUnit->LodBias == param[0]) return; @@ -511,19 +485,18 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } if (pname == GL_COORD_REPLACE_NV) { - const GLenum value = (GLenum) param[0]; - if (value == GL_TRUE || value == GL_FALSE) { + if (iparam0 == GL_TRUE || iparam0 == 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; + const GLboolean state = (GLboolean) iparam0; 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=0x%x)", value); + _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", iparam0); return; } } @@ -533,7 +506,8 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } } else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); + _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(target=%s)", + _mesa_lookup_enum_by_nr(target)); return; } @@ -542,7 +516,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) _mesa_lookup_enum_by_nr(target), _mesa_lookup_enum_by_nr(pname), *param, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); + _mesa_lookup_enum_by_nr((GLenum) iparam0)); /* Tell device driver about the new texture environment */ if (ctx->Driver.TexEnv) { @@ -604,37 +578,17 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, return texUnit->EnvMode; break; case GL_COMBINE_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return texUnit->Combine.ModeRGB; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return texUnit->Combine.ModeRGB; case GL_COMBINE_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return texUnit->Combine.ModeA; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return texUnit->Combine.ModeA; 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 unsigned rgb_idx = pname - GL_SOURCE0_RGB; - return texUnit->Combine.SourceRGB[rgb_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_SOURCE2_RGB: { + const unsigned rgb_idx = pname - GL_SOURCE0_RGB; + return texUnit->Combine.SourceRGB[rgb_idx]; + } case GL_SOURCE3_RGB_NV: - if (ctx->Extensions.NV_texture_env_combine4) { + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.SourceRGB[3]; } else { @@ -643,18 +597,12 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; 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 unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; - return texUnit->Combine.SourceA[alpha_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_SOURCE2_ALPHA: { + const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; + return texUnit->Combine.SourceA[alpha_idx]; + } case GL_SOURCE3_ALPHA_NV: - if (ctx->Extensions.NV_texture_env_combine4) { + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.SourceA[3]; } else { @@ -663,18 +611,12 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_rgb = pname - GL_OPERAND0_RGB; - return texUnit->Combine.OperandRGB[op_rgb]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_OPERAND2_RGB: { + const unsigned op_rgb = pname - GL_OPERAND0_RGB; + return texUnit->Combine.OperandRGB[op_rgb]; + } case GL_OPERAND3_RGB_NV: - if (ctx->Extensions.NV_texture_env_combine4) { + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.OperandRGB[3]; } else { @@ -683,18 +625,12 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; - return texUnit->Combine.OperandA[op_alpha]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + case GL_OPERAND2_ALPHA: { + const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; + return texUnit->Combine.OperandA[op_alpha]; + } case GL_OPERAND3_ALPHA_NV: - if (ctx->Extensions.NV_texture_env_combine4) { + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) { return texUnit->Combine.OperandA[3]; } else { @@ -702,26 +638,12 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, } break; case GL_RGB_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return 1 << texUnit->Combine.ScaleShiftRGB; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return 1 << texUnit->Combine.ScaleShiftRGB; case GL_ALPHA_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - return 1 << texUnit->Combine.ScaleShiftA; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; + return 1 << texUnit->Combine.ScaleShiftA; case GL_BUMP_TARGET_ATI: /* spec doesn't say so, but I think this should be queryable */ - if (ctx->Extensions.ATI_envmap_bumpmap) { + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_envmap_bumpmap) { return texUnit->BumpTarget; } else { @@ -730,7 +652,8 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit, break; default: - ; + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + break; } return -1; /* error */ @@ -744,10 +667,9 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) GLuint maxUnit; const struct gl_texture_unit *texUnit; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) - ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; + ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits; if (ctx->Texture.CurrentUnit >= maxUnit) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)"); return; @@ -757,7 +679,12 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) if (target == GL_TEXTURE_ENV) { if (pname == GL_TEXTURE_ENV_COLOR) { - COPY_4FV( params, texUnit->EnvColor ); + if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP)) + _mesa_update_state(ctx); + if (_mesa_get_clamp_fragment_color(ctx)) + COPY_4FV( params, texUnit->EnvColor ); + else + COPY_4FV( params, texUnit->EnvColorUnclamped ); } else { GLint val = get_texenvi(ctx, texUnit, pname); @@ -767,11 +694,6 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) } } 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; } @@ -808,10 +730,9 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) GLuint maxUnit; const struct gl_texture_unit *texUnit; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) - ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; + ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits; if (ctx->Texture.CurrentUnit >= maxUnit) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)"); return; @@ -834,11 +755,6 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } } 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; } @@ -878,7 +794,6 @@ _mesa_TexBumpParameterivATI( GLenum pname, const GLint *param ) { GLfloat p[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { /* This isn't an "official" error case, but let's tell the user @@ -908,7 +823,6 @@ _mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param ) { struct gl_texture_unit *texUnit; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterfvATI"); @@ -941,7 +855,6 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) const struct gl_texture_unit *texUnit; GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterivATI"); @@ -966,7 +879,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) } else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) { GLint count = 0; - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { count++; } @@ -974,7 +887,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) *param = count; } else if (pname == GL_BUMP_TEX_UNITS_ATI) { - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { *param++ = i + GL_TEXTURE0; } @@ -993,7 +906,6 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) const struct gl_texture_unit *texUnit; GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterfvATI"); @@ -1016,7 +928,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) } else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) { GLint count = 0; - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { count++; } @@ -1024,7 +936,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) *param = (GLfloat) count; } else if (pname == GL_BUMP_TEX_UNITS_ATI) { - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { *param++ = (GLfloat) (i + GL_TEXTURE0); }