[Mesa-dev] [PATCH 15/78] i965/nir/vec4: Implement load_input intrinsic

Eduardo Lima Mitev elima at igalia.com
Fri Jun 26 01:06:31 PDT 2015


The source register is fetched from the nir_inputs map built during
nir_setup_inputs stage.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89580
---
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 99d2725..8a2d335 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -495,13 +495,29 @@ vec4_visitor::get_nir_src(nir_src src)
 void
 vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
 {
+   dst_reg dest;
+   src_reg src;
+
+   bool has_indirect = false;
+
    switch (instr->intrinsic) {
 
    case nir_intrinsic_load_input_indirect:
+      has_indirect = true;
       /* fallthrough */
-   case nir_intrinsic_load_input:
-      /* @TODO: Not yet implemented */
+   case nir_intrinsic_load_input: {
+      int offset = instr->const_index[0];
+      src = nir_inputs[offset];
+
+      if (has_indirect)
+         src.reladdr = new(mem_ctx) src_reg(get_nir_src(instr->src[0]));
+
+      dest = get_nir_dest(instr->dest, src.type);
+      dest.writemask = brw_writemask_for_size(instr->num_components);
+
+      emit(MOV(dest, src));
       break;
+   }
 
    case nir_intrinsic_store_output_indirect:
       /* fallthrough */
-- 
2.1.4



More information about the mesa-dev mailing list