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

Rob Clark robdclark at gmail.com
Tue Apr 19 13:58:24 UTC 2016


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;
    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;
       }
    }
-- 
2.5.5



More information about the mesa-dev mailing list