diff options
author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2019-04-29 19:23:36 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-08-06 17:02:52 -0400 |
commit | 58030d2b3ded667585f4f5e7bc459008f7ba7e8f (patch) | |
tree | f3dde92d24711e041a97a2d60dc72d2ee01bed67 /src/mesa | |
parent | b4c54894bba085966c52cb515bd72927e4ec4939 (diff) |
mesa: replace _mesa_get_current_fixedfunc_tex_unit with _mesa_get_fixedfunc_tex_unit
The new function implements the same feature but doesn't depend
on ctx->Texture.CurrentUnit.
This change allows to use it from indexed functions.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/enable.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texenv.c | 6 | ||||
-rw-r--r-- | src/mesa/main/texgen.c | 8 | ||||
-rw-r--r-- | src/mesa/main/texstate.h | 4 |
4 files changed, 10 insertions, 12 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 418fc75c724..8c3a9a789a9 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -247,7 +247,7 @@ static GLboolean enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit) { struct gl_fixedfunc_texture_unit *texUnit = - _mesa_get_current_fixedfunc_tex_unit(ctx); + _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); if (!texUnit) return GL_FALSE; @@ -1401,7 +1401,7 @@ static GLboolean is_texture_enabled(struct gl_context *ctx, GLbitfield bit) { const struct gl_fixedfunc_texture_unit *const texUnit = - _mesa_get_current_fixedfunc_tex_unit(ctx); + _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); if (!texUnit) return GL_FALSE; diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index a69c8dd7435..95b44004c32 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -408,7 +408,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (target == GL_TEXTURE_ENV) { struct gl_fixedfunc_texture_unit *texUnit = - _mesa_get_current_fixedfunc_tex_unit(ctx); + _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); /* 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 @@ -670,7 +670,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) if (target == GL_TEXTURE_ENV) { struct gl_fixedfunc_texture_unit *texUnit = - _mesa_get_current_fixedfunc_tex_unit(ctx); + _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); /* 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 @@ -747,7 +747,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) if (target == GL_TEXTURE_ENV) { struct gl_fixedfunc_texture_unit *texUnit = - _mesa_get_current_fixedfunc_tex_unit(ctx); + _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); /* 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 diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 4eb2f60464a..96d0228d8ca 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -85,7 +85,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) return; } - texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + texUnit = _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -297,7 +297,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) return; } - texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + texUnit = _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -334,7 +334,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) return; } - texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + texUnit = _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -379,7 +379,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) return; } - texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); + texUnit = _mesa_get_fixedfunc_tex_unit(ctx, ctx->Texture.CurrentUnit); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index c0b73b14e82..f2e55f1a4af 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -61,10 +61,8 @@ _mesa_get_current_tex_unit(struct gl_context *ctx) * \return NULL if the current unit is not a fixed-func texture unit */ static inline struct gl_fixedfunc_texture_unit * -_mesa_get_current_fixedfunc_tex_unit(struct gl_context *ctx) +_mesa_get_fixedfunc_tex_unit(struct gl_context *ctx, GLuint unit) { - unsigned unit = ctx->Texture.CurrentUnit; - if (unit >= ARRAY_SIZE(ctx->Texture.FixedFuncUnit)) return NULL; |