X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexstate.h;h=c0b73b14e828ccbeb8d5bd765a46194c3faf5fdd;hb=a96e946d25d4518d1c73c5d9d0f3d147f42bc416;hp=2514d104b62fce2f0b62e71ee8bc44206036b25e;hpb=77aabd8be237b68921d2e7c69fd1a0be3d36de01;p=mesa.git diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 2514d104b62..c0b73b14e82 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -32,7 +32,6 @@ #define TEXSTATE_H -#include "compiler.h" #include "enums.h" #include "macros.h" #include "mtypes.h" @@ -41,8 +40,7 @@ static inline struct gl_texture_unit * _mesa_get_tex_unit(struct gl_context *ctx, GLuint unit) { - ASSERT(unit >= 0); - ASSERT(unit < Elements(ctx->Texture.Unit)); + assert(unit < ARRAY_SIZE(ctx->Texture.Unit)); return &(ctx->Texture.Unit[unit]); } @@ -56,6 +54,24 @@ _mesa_get_current_tex_unit(struct gl_context *ctx) return _mesa_get_tex_unit(ctx, ctx->Texture.CurrentUnit); } + +/** + * Return pointer to current fixed-func texture unit. + * This the texture unit set by glActiveTexture(), not glClientActiveTexture(). + * \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) +{ + unsigned unit = ctx->Texture.CurrentUnit; + + if (unit >= ARRAY_SIZE(ctx->Texture.FixedFuncUnit)) + return NULL; + + return &ctx->Texture.FixedFuncUnit[unit]; +} + + static inline GLuint _mesa_max_tex_unit(struct gl_context *ctx) { @@ -64,24 +80,6 @@ _mesa_max_tex_unit(struct gl_context *ctx) ctx->Const.MaxTextureCoordUnits); } -static inline struct gl_texture_unit * -_mesa_get_tex_unit_err(struct gl_context *ctx, GLuint unit, const char *func) -{ - if (unit < _mesa_max_tex_unit(ctx)) - return _mesa_get_tex_unit(ctx, unit); - - /* Note: This error is a precedent set by glBindTextures. From the GL 4.5 - * specification (30.10.2014) Section 8.1 ("Texture Objects"): - * - * "An INVALID_OPERATION error is generated if first + count is greater - * than the number of texture image units supported by the - * implementation." - */ - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unit=%s)", func, - _mesa_lookup_enum_by_nr(GL_TEXTURE0+unit)); - return NULL; -} - extern void _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst ); @@ -96,6 +94,9 @@ _mesa_print_texunit_state( struct gl_context *ctx, GLuint unit ); */ /*@{*/ +extern void GLAPIENTRY +_mesa_ActiveTexture_no_error( GLenum target ); + extern void GLAPIENTRY _mesa_ActiveTexture( GLenum target ); @@ -110,8 +111,11 @@ _mesa_ClientActiveTexture( GLenum target ); */ /*@{*/ -extern void -_mesa_update_texture( struct gl_context *ctx, GLuint new_state ); +extern void +_mesa_update_texture_matrices(struct gl_context *ctx); + +extern void +_mesa_update_texture_state(struct gl_context *ctx); extern GLboolean _mesa_init_texture( struct gl_context *ctx );