[Mesa-dev] [PATCH 1/6] mesa: inline _mesa_update_texture
Edward O'Callaghan
funfunctor at folklore1984.net
Fri Mar 24 00:07:04 UTC 2017
This series is,
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>
On 03/24/2017 10:42 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/mesa/main/state.c | 7 +++++--
> src/mesa/main/texstate.c | 22 ++++------------------
> src/mesa/main/texstate.h | 7 +++++--
> 3 files changed, 14 insertions(+), 22 deletions(-)
>
> diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> index 5cb58a4..71265a5 100644
> --- a/src/mesa/main/state.c
> +++ b/src/mesa/main/state.c
> @@ -399,22 +399,25 @@ _mesa_update_state_locked( struct gl_context *ctx )
> /*
> * Now update derived state info
> */
>
> if (new_state & prog_flags)
> update_program_enables( ctx );
>
> if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
> _mesa_update_modelview_project( ctx, new_state );
>
> - if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
> - _mesa_update_texture( ctx, new_state );
> + if (new_state & _NEW_TEXTURE_MATRIX)
> + _mesa_update_texture_matrices(ctx);
> +
> + if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
> + _mesa_update_texture_state(ctx);
>
> if (new_state & _NEW_POLYGON)
> update_frontbit( ctx );
>
> if (new_state & _NEW_BUFFERS)
> _mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
>
> if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
> _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
>
> diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
> index be73fc3..70e014c 100644
> --- a/src/mesa/main/texstate.c
> +++ b/src/mesa/main/texstate.c
> @@ -348,22 +348,22 @@ _mesa_ClientActiveTexture(GLenum texture)
>
>
> /**
> * \note This routine refers to derived texture attribute values to
> * compute the ENABLE_TEXMAT flags, but is only called on
> * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
> * flags are updated by _mesa_update_textures(), below.
> *
> * \param ctx GL context.
> */
> -static void
> -update_texture_matrices( struct gl_context *ctx )
> +void
> +_mesa_update_texture_matrices(struct gl_context *ctx)
> {
> GLuint u;
>
> ctx->Texture._TexMatEnabled = 0x0;
>
> for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
> assert(u < ARRAY_SIZE(ctx->TextureMatrixStack));
> if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) {
> _math_matrix_analyse( ctx->TextureMatrixStack[u].Top );
>
> @@ -684,22 +684,22 @@ update_ff_texture_state(struct gl_context *ctx,
> }
>
> /**
> * \note This routine refers to derived texture matrix values to
> * compute the ENABLE_TEXMAT flags, but is only called on
> * _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
> * flags are updated by _mesa_update_texture_matrices, above.
> *
> * \param ctx GL context.
> */
> -static void
> -update_texture_state( struct gl_context *ctx )
> +void
> +_mesa_update_texture_state(struct gl_context *ctx)
> {
> struct gl_program *prog[MESA_SHADER_STAGES];
> int i;
> int old_max_unit = ctx->Texture._MaxEnabledTexImageUnit;
> BITSET_DECLARE(enabled_texture_units, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
>
> for (i = 0; i < MESA_SHADER_STAGES; i++) {
> if (ctx->_Shader->CurrentProgram[i]) {
> prog[i] = ctx->_Shader->CurrentProgram[i];
> } else {
> @@ -740,34 +740,20 @@ update_texture_state( struct gl_context *ctx )
> }
> for (i = ctx->Texture._MaxEnabledTexImageUnit + 1; i <= old_max_unit; i++) {
> _mesa_reference_texobj(&ctx->Texture.Unit[i]._Current, NULL);
> }
>
> if (!prog[MESA_SHADER_FRAGMENT] || !prog[MESA_SHADER_VERTEX])
> update_texgen(ctx);
> }
>
>
> -/**
> - * Update texture-related derived state.
> - */
> -void
> -_mesa_update_texture( struct gl_context *ctx, GLuint new_state )
> -{
> - if (new_state & _NEW_TEXTURE_MATRIX)
> - update_texture_matrices( ctx );
> -
> - if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM))
> - update_texture_state( ctx );
> -}
> -
> -
> /**********************************************************************/
> /***** Initialization *****/
> /**********************************************************************/
>
> /**
> * Allocate the proxy textures for the given context.
> *
> * \param ctx the context to allocate proxies for.
> *
> * \return GL_TRUE on success, or GL_FALSE on failure
> diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h
> index 52fe602..cb329b0 100644
> --- a/src/mesa/main/texstate.h
> +++ b/src/mesa/main/texstate.h
> @@ -84,22 +84,25 @@ extern void GLAPIENTRY
> _mesa_ClientActiveTexture( GLenum target );
>
> /*@}*/
>
>
> /**
> * \name Initialization, state maintenance
> */
> /*@{*/
>
> -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 );
>
> extern void
> _mesa_free_texture_data( struct gl_context *ctx );
>
> extern void
> _mesa_update_default_objects_texture(struct gl_context *ctx);
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170324/c7559a27/attachment-0001.sig>
More information about the mesa-dev
mailing list