nir/lower-tex: make options a local var
authorRob Clark <robclark@freedesktop.org>
Tue, 19 Apr 2016 11:46:50 +0000 (07:46 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 19 Apr 2016 20:12:49 +0000 (16:12 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/compiler/nir/nir_lower_tex.c

index 4999603e59210b763ab50ef44e283209ba955f81..7740e588790af08795958e5c6b2ca196cbd3fdcc 100644 (file)
@@ -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;
       }
    }