[Mesa-dev] [PATCH 1/3] nir/lower-tex: make options a local var

Ian Romanick idr at freedesktop.org
Tue Apr 19 21:45:01 UTC 2016


On 04/19/2016 06:58 AM, Rob Clark wrote:
> From: Rob Clark <robclark at freedesktop.org>
> 
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
>  src/compiler/nir/nir_lower_tex.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
> index 4999603..7740e58 100644
> --- a/src/compiler/nir/nir_lower_tex.c
> +++ b/src/compiler/nir/nir_lower_tex.c
> @@ -279,6 +279,7 @@ static bool
>  nir_lower_tex_block(nir_block *block, void *void_state)
>  {
>     lower_tex_state *state = void_state;
> +   const nir_lower_tex_options *options = state->options;
                                   ^ const here too

With or without that change, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

>     nir_builder *b = &state->b;
>  
>     nir_foreach_instr_safe(block, instr) {
> @@ -286,16 +287,16 @@ nir_lower_tex_block(nir_block *block, void *void_state)
>           continue;
>  
>        nir_tex_instr *tex = nir_instr_as_tex(instr);
> -      bool lower_txp = !!(state->options->lower_txp & (1 << tex->sampler_dim));
> +      bool lower_txp = !!(options->lower_txp & (1 << tex->sampler_dim));
>  
>        /* mask of src coords to saturate (clamp): */
>        unsigned sat_mask = 0;
>  
> -      if ((1 << tex->sampler_index) & state->options->saturate_r)
> +      if ((1 << tex->sampler_index) & options->saturate_r)
>           sat_mask |= (1 << 2);    /* .z */
> -      if ((1 << tex->sampler_index) & state->options->saturate_t)
> +      if ((1 << tex->sampler_index) & options->saturate_t)
>           sat_mask |= (1 << 1);    /* .y */
> -      if ((1 << tex->sampler_index) & state->options->saturate_s)
> +      if ((1 << tex->sampler_index) & options->saturate_s)
>           sat_mask |= (1 << 0);    /* .x */
>  
>        /* If we are clamping any coords, we must lower projector first
> @@ -306,8 +307,7 @@ nir_lower_tex_block(nir_block *block, void *void_state)
>           state->progress = true;
>        }
>  
> -      if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) &&
> -          state->options->lower_rect) {
> +      if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) && options->lower_rect) {
>           lower_rect(b, tex);
>           state->progress = true;
>        }
> @@ -317,10 +317,10 @@ nir_lower_tex_block(nir_block *block, void *void_state)
>           state->progress = true;
>        }
>  
> -      if (((1 << tex->texture_index) & state->options->swizzle_result) &&
> +      if (((1 << tex->texture_index) & options->swizzle_result) &&
>            !nir_tex_instr_is_query(tex) &&
>            !(tex->is_shadow && tex->is_new_style_shadow)) {
> -         swizzle_result(b, tex, state->options->swizzles[tex->texture_index]);
> +         swizzle_result(b, tex, options->swizzles[tex->texture_index]);
>           state->progress = true;
>        }
>     }
> 



More information about the mesa-dev mailing list