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

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


Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_vec4.h       |  2 ++
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 12 ++++++++++++
 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 0150bb9..e7293af 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -343,6 +343,8 @@ public:
                        unsigned num_components = 4);
    src_reg get_nir_src_imm(nir_src src, enum brw_reg_type type);
 
+   src_reg get_nir_indirect_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 ffd480a..beab9a8 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -391,6 +391,18 @@ vec4_visitor::nir_emit_load_const(nir_load_const_instr *instr)
    nir_ssa_values[instr->def.index] = reg;
 }
 
+/**
+ * Return the indirect source for a load/store indirect intrinsic.
+ *
+ * For non-indirect load/store intrinsics, return a BAD_FILE register.
+ */
+src_reg
+vec4_visitor::get_nir_indirect_src(nir_intrinsic_instr *instr)
+{
+   nir_src *src = nir_get_io_indirect_src(instr);
+   return src ? get_nir_src(*src, BRW_REGISTER_TYPE_D, 1) : src_reg();
+}
+
 void
 vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {
-- 
2.6.2



More information about the mesa-dev mailing list