[Mesa-dev] [PATCH 1/2] nir: Add a nir->info.uses_interp_var_at_offset flag.

Kenneth Graunke kenneth at whitecape.org
Fri May 13 08:42:52 UTC 2016


It would probably make more sense to set this from nir_gather_info()
in case we manage to dead code eliminate these intrinsics.  However,
we haven't transitioned the GL driver to using that pass yet...

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/nir/glsl_to_nir.cpp | 3 +++
 src/compiler/nir/nir.h           | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp
index fb1d421..e82d98a 100644
--- a/src/compiler/nir/glsl_to_nir.cpp
+++ b/src/compiler/nir/glsl_to_nir.cpp
@@ -1276,6 +1276,9 @@ nir_visitor::visit(ir_expression *ir)
           intrin->intrinsic == nir_intrinsic_interp_var_at_sample)
          intrin->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[1]));
 
+      if (intrin->intrinsic == nir_intrinsic_interp_var_at_offset)
+         shader->info.uses_interp_var_at_offset = true;
+
       unsigned bit_size =  glsl_get_bit_size(deref->type);
       add_instr(&intrin->instr, deref->type->vector_elements, bit_size);
 
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 20927a2..d12792d 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1710,6 +1710,9 @@ typedef struct nir_shader_info {
    /* Whether or not this shader ever uses textureGather() */
    bool uses_texture_gather;
 
+   /** Whether or not this shader uses nir_intrinsic_interp_var_at_offset */
+   bool uses_interp_var_at_offset;
+
    /* Whether or not this shader uses the gl_ClipDistance output */
    bool uses_clip_distance_out;
 
-- 
2.8.2



More information about the mesa-dev mailing list