}
-
-void GLAPIENTRY
-_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
+static void
+_mesa_texenvfv_indexed( struct gl_context* ctx, GLuint texunit, GLenum target,
+ GLenum pname, const GLfloat *param )
{
const GLint iparam0 = (GLint) param[0];
GLuint maxUnit;
- GET_CURRENT_CONTEXT(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)");
+ if (texunit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(texunit=%d)", texunit);
return;
}
if (target == GL_TEXTURE_ENV) {
struct gl_fixedfunc_texture_unit *texUnit =
- _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit);
+ _mesa_get_fixedfunc_tex_unit(ctx, texunit);
/* The GL spec says that we should report an error if the unit is greater
* than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
struct gl_texture_unit *texUnit =
- _mesa_get_current_tex_unit(ctx);
+ _mesa_get_tex_unit(ctx, texunit);
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
if (texUnit->LodBias == param[0])
* but that's what the spec calls for.
*/
if (iparam0 == GL_TRUE) {
- if (ctx->Point.CoordReplace & (1u << ctx->Texture.CurrentUnit))
+ if (ctx->Point.CoordReplace & (1u << texunit))
return;
- ctx->Point.CoordReplace |= (1u << ctx->Texture.CurrentUnit);
+ ctx->Point.CoordReplace |= (1u << texunit);
} else if (iparam0 == GL_FALSE) {
- if (~(ctx->Point.CoordReplace) & (1u << ctx->Texture.CurrentUnit))
+ if (~(ctx->Point.CoordReplace) & (1u << texunit))
return;
- ctx->Point.CoordReplace &= ~(1u << ctx->Texture.CurrentUnit);
+ ctx->Point.CoordReplace &= ~(1u << texunit);
} else {
_mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", iparam0);
return;
}
+void GLAPIENTRY
+_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_texenvfv_indexed(ctx, ctx->Texture.CurrentUnit, target, pname, param);
+}
+
+
void GLAPIENTRY
_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
{
}
-
-void GLAPIENTRY
-_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+static void
+_mesa_gettexenvfv_indexed( GLuint texunit, GLenum target, GLenum pname, GLfloat *params )
{
GLuint maxUnit;
GET_CURRENT_CONTEXT(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)");
+ if (texunit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(texunit=%d)", texunit);
return;
}
if (target == GL_TEXTURE_ENV) {
struct gl_fixedfunc_texture_unit *texUnit =
- _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit);
+ _mesa_get_fixedfunc_tex_unit(ctx, texunit);
/* The GL spec says that we should report an error if the unit is greater
* than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
}
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- const struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+ const struct gl_texture_unit *texUnit = _mesa_get_tex_unit(ctx, texunit);
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
*params = texUnit->LodBias;
return;
}
if (pname == GL_COORD_REPLACE_NV) {
- if (ctx->Point.CoordReplace & (1u << ctx->Texture.CurrentUnit))
+ if (ctx->Point.CoordReplace & (1u << texunit))
*params = 1.0f;
else
*params = 0.0f;
}
-void GLAPIENTRY
-_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+static void
+_mesa_gettexenviv_indexed( GLuint texunit, GLenum target,
+ GLenum pname, GLint *params )
{
GLuint maxUnit;
GET_CURRENT_CONTEXT(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)");
+ if (texunit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(texunit=%d)",
+ texunit);
return;
}
if (target == GL_TEXTURE_ENV) {
struct gl_fixedfunc_texture_unit *texUnit =
- _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit);
+ _mesa_get_fixedfunc_tex_unit(ctx, texunit);
/* The GL spec says that we should report an error if the unit is greater
* than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
}
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- const struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+ const struct gl_texture_unit *texUnit = _mesa_get_tex_unit(ctx, texunit);
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
*params = (GLint) texUnit->LodBias;
return;
}
if (pname == GL_COORD_REPLACE_NV) {
- if (ctx->Point.CoordReplace & (1u << ctx->Texture.CurrentUnit))
+ if (ctx->Point.CoordReplace & (1u << texunit))
*params = GL_TRUE;
else
*params = GL_FALSE;
}
}
+
+void GLAPIENTRY
+_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_gettexenvfv_indexed(ctx->Texture.CurrentUnit, target, pname, params);
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_gettexenviv_indexed(ctx->Texture.CurrentUnit, target, pname, params);
+}