Mesa (master): nir: Add a nir->info.uses_interp_var_at_offset flag.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon May 16 06:53:55 UTC 2016


Module: Mesa
Branch: master
Commit: 6d65b0c6dc0ef4fad319129fea5fd7b4ad940bec
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d65b0c6dc0ef4fad319129fea5fd7b4ad940bec

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu May 12 23:53:13 2016 -0700

nir: Add a nir->info.uses_interp_var_at_offset flag.

I've added this to nir_gather_info(), but also to glsl_to_nir() as a
temporary measure, since the i965 GL driver today doesn't use
nir_gather_info() yet.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/compiler/nir/glsl_to_nir.cpp   | 3 +++
 src/compiler/nir/nir.h             | 3 +++
 src/compiler/nir/nir_gather_info.c | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp
index 8a25650..d28fe41 100644
--- a/src/compiler/nir/glsl_to_nir.cpp
+++ b/src/compiler/nir/glsl_to_nir.cpp
@@ -1277,6 +1277,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 2227910..cb9d44a 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1716,6 +1716,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;
 
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 89a6302..7900fd1 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -56,6 +56,10 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader)
       shader->info.gs.uses_end_primitive = 1;
       break;
 
+   case nir_intrinsic_interp_var_at_offset:
+      shader->info.uses_interp_var_at_offset = 1;
+      break;
+
    default:
       break;
    }




More information about the mesa-commit mailing list