[Mesa-dev] [PATCH 19/26] i965: Implement a get_nir_vertex_index_src() helper.

Kenneth Graunke kenneth at whitecape.org
Wed Dec 2 16:16:00 PST 2015


Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_vec4.h       |  1 +
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index e7293af..dfe9853 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -344,6 +344,7 @@ public:
    src_reg get_nir_src_imm(nir_src src, enum brw_reg_type type);
 
    src_reg get_nir_indirect_src(nir_intrinsic_instr *instr);
+   src_reg get_nir_vertex_index_src(nir_intrinsic_instr *instr);
 
    virtual dst_reg *make_reg_for_system_value(int location,
                                               const glsl_type *type) = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index beab9a8..890879c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -403,6 +403,19 @@ vec4_visitor::get_nir_indirect_src(nir_intrinsic_instr *instr)
    return src ? get_nir_src(*src, BRW_REGISTER_TYPE_D, 1) : src_reg();
 }
 
+/**
+ * Return the vertex index source for a load/store per_vertex intrinsic.
+ *
+ * For other intrinsics, return a BAD_FILE register.
+ */
+src_reg
+vec4_visitor::get_nir_vertex_index_src(nir_intrinsic_instr *instr)
+{
+   nir_src *src = nir_get_io_vertex_index_src(instr);
+   return src ? get_nir_src_imm(*src, BRW_REGISTER_TYPE_D) : src_reg();
+}
+
+
 void
 vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {
-- 
2.6.2



More information about the mesa-dev mailing list