[Mesa-dev] [PATCH 03/14] mesa: Drop _EnabledUnits.

Kenneth Graunke kenneth at whitecape.org
Wed Apr 30 13:30:13 PDT 2014


On 04/24/2014 05:50 PM, Eric Anholt wrote:
> The field wasn't really valid, since we've got more than 32 units now.  It
> turns out it was mostly just used for checking != 0, or checking for fixed
> function coordinates, though.
> ---
>  src/mesa/drivers/common/meta.c                 |  2 +-
>  src/mesa/drivers/dri/i915/intel_pixel.c        |  2 +-
>  src/mesa/drivers/dri/i915/intel_pixel_copy.c   |  2 +-
>  src/mesa/drivers/dri/i965/intel_pixel.c        |  2 +-
>  src/mesa/drivers/dri/i965/intel_pixel_copy.c   |  2 +-
>  src/mesa/drivers/dri/nouveau/nv04_state_frag.c |  2 +-
>  src/mesa/drivers/dri/nouveau/nv10_state_frag.c |  4 ++--
>  src/mesa/drivers/dri/r200/r200_state_init.c    |  4 ++--
>  src/mesa/drivers/osmesa/osmesa.c               |  4 ++--
>  src/mesa/drivers/x11/xm_line.c                 |  4 ++--
>  src/mesa/drivers/x11/xm_tri.c                  |  2 +-
>  src/mesa/main/ffvertex_prog.c                  |  2 +-
>  src/mesa/main/mtypes.h                         |  3 ---
>  src/mesa/main/texstate.c                       |  4 ----
>  src/mesa/swrast/s_context.c                    |  4 ++--
>  src/mesa/swrast/s_texture.c                    | 29 +++++++++++---------------
>  src/mesa/swrast/s_triangle.c                   |  2 +-
>  17 files changed, 31 insertions(+), 43 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index ac27abb..0f0cfc7 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -2328,7 +2328,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx,
>     if (ctx->_ImageTransferState ||
>         ctx->FragmentProgram._Enabled ||
>         ctx->Fog.Enabled ||
> -       ctx->Texture._EnabledUnits ||
> +       ctx->Texture._MaxEnabledTexImageUnit != -1 ||
>         width > tex->MaxSize ||
>         height > tex->MaxSize) {
>        _swrast_Bitmap(ctx, x, y, width, height, unpack, bitmap1);
> diff --git a/src/mesa/drivers/dri/i915/intel_pixel.c b/src/mesa/drivers/dri/i915/intel_pixel.c
> index da2f783..6f139e1 100644
> --- a/src/mesa/drivers/dri/i915/intel_pixel.c
> +++ b/src/mesa/drivers/dri/i915/intel_pixel.c
> @@ -77,7 +77,7 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one)
>        return false;
>     }
>  
> -   if (ctx->Texture._EnabledUnits) {
> +   if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
>        DBG("fallback due to texturing\n");
>        return false;
>     }
> diff --git a/src/mesa/drivers/dri/i915/intel_pixel_copy.c b/src/mesa/drivers/dri/i915/intel_pixel_copy.c
> index 6cfdc92..e7b5353 100644
> --- a/src/mesa/drivers/dri/i915/intel_pixel_copy.c
> +++ b/src/mesa/drivers/dri/i915/intel_pixel_copy.c
> @@ -117,7 +117,7 @@ do_blit_copypixels(struct gl_context * ctx,
>     }
>  
>     if (ctx->Fog.Enabled ||
> -       ctx->Texture._EnabledUnits ||
> +       ctx->Texture._MaxEnabledTexImageUnit != -1 ||
>         ctx->FragmentProgram._Enabled) {
>        perf_debug("glCopyPixels(): Unsupported fragment shader state\n");
>        return false;
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel.c b/src/mesa/drivers/dri/i965/intel_pixel.c
> index 5f57022..a6db7fa 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel.c
> @@ -77,7 +77,7 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one)
>        return false;
>     }
>  
> -   if (ctx->Texture._EnabledUnits) {
> +   if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
>        DBG("fallback due to texturing\n");
>        return false;
>     }
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c
> index 858be26..5687c28 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c
> @@ -125,7 +125,7 @@ do_blit_copypixels(struct gl_context * ctx,
>     }
>  
>     if (ctx->Fog.Enabled ||
> -       ctx->Texture._EnabledUnits ||
> +       ctx->Texture._MaxEnabledTexImageUnit != -1 ||
>         ctx->FragmentProgram._Enabled) {
>        perf_debug("glCopyPixels(): Unsupported fragment shader state\n");
>        return false;
> diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
> index 17d2781..c48a0b0 100644
> --- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
> +++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
> @@ -286,7 +286,7 @@ nv04_emit_tex_env(struct gl_context *ctx, int emit)
>  
>  	/* calculate non-multitex state */
>  	nv04->blend &= ~NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP__MASK;
> -	if (ctx->Texture._EnabledUnits)
> +	if (ctx->Texture._MaxEnabledTexImageUnit != -1)
>  		nv04->blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
>  	else
>  		nv04->blend |= get_texenv_mode(GL_MODULATE);
> diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
> index 10f067f..aa7e703 100644
> --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
> +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
> @@ -353,7 +353,7 @@ nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n)
>  		INPUT_ONE(&rc, E, 0);
>  	}
>  
> -	if (ctx->Texture._EnabledUnits) {
> +	if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
>  		INPUT_SRC(&rc, B, SPARE0, RGB);
>  		INPUT_SRC(&rc, G, SPARE0, ALPHA);
>  	} else {
> @@ -362,7 +362,7 @@ nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n)
>  	}
>  
>  	*in = rc.in;
> -	*n = log2i(ctx->Texture._EnabledUnits) + 1;
> +	*n = ctx->Texture._MaxEnabledTexImageUnit + 1;
>  }
>  
>  void
> diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
> index eb93036..d9d1a0e 100644
> --- a/src/mesa/drivers/dri/r200/r200_state_init.c
> +++ b/src/mesa/drivers/dri/r200/r200_state_init.c
> @@ -251,8 +251,8 @@ static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom )
>  CHECK( always, GL_TRUE, 0 )
>  CHECK( always_add4, GL_TRUE, 4 )
>  CHECK( never, GL_FALSE, 0 )
> -CHECK( tex_any, ctx->Texture._EnabledUnits, 0 )
> -CHECK( tf, (ctx->Texture._EnabledUnits && !ctx->ATIFragmentShader._Enabled), 0 );
> +CHECK( tex_any, ctx->Texture._MaxEnabledTexImageUnit != -1, 0 )
> +CHECK( tf, (ctx->Texture._MaxEnabledTexImageUnit != -1 && !ctx->ATIFragmentShader._Enabled), 0 );
>  CHECK( pix_zero, !ctx->ATIFragmentShader._Enabled, 0 )
>     CHECK( texenv, (rmesa->state.envneeded & (1 << (atom->idx)) && !ctx->ATIFragmentShader._Enabled), 0 )
>  CHECK( afs_pass1, (ctx->ATIFragmentShader._Enabled && (ctx->ATIFragmentShader.Current->NumPasses > 1)), 0 )
> diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
> index 347913d..6026fd5 100644
> --- a/src/mesa/drivers/osmesa/osmesa.c
> +++ b/src/mesa/drivers/osmesa/osmesa.c
> @@ -207,7 +207,7 @@ osmesa_choose_line_function( struct gl_context *ctx )
>  
>     if (ctx->RenderMode != GL_RENDER ||
>         ctx->Line.SmoothFlag ||
> -       ctx->Texture._EnabledUnits ||
> +       ctx->Texture.MaxEnabledTexImageUnit == -1 ||
>         ctx->Light.ShadeModel != GL_FLAT ||
>         ctx->Line.Width != 1.0F ||
>         ctx->Line.StippleFlag ||
> @@ -322,7 +322,7 @@ osmesa_choose_triangle_function( struct gl_context *ctx )
>     if (ctx->RenderMode != GL_RENDER ||
>         ctx->Polygon.SmoothFlag ||
>         ctx->Polygon.StippleFlag ||
> -       ctx->Texture._EnabledUnits) {
> +       ctx->Texture._MaxEnabledTexImageUnit != -1) {
>        return NULL;
>     }
>  
> diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
> index 00307c7..1349610 100644
> --- a/src/mesa/drivers/x11/xm_line.c
> +++ b/src/mesa/drivers/x11/xm_line.c
> @@ -97,7 +97,7 @@ void xmesa_choose_point( struct gl_context *ctx )
>     if (ctx->RenderMode == GL_RENDER
>         && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag
>         && swrast->_RasterMask == 0
> -       && !ctx->Texture._EnabledUnits
> +       && ctx->Texture._MaxEnabledTexImageUnit == 0

This seems wrong - I believe you want:

&& ctx->Texture._MaxEnabledTexImageUnit == -1

With that fixed, this series (1-14) is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140430/358a174d/attachment-0001.sig>


More information about the mesa-dev mailing list