summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-10-19 12:18:54 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-11-04 10:18:56 -0800
commit24b1b050edd100f9157f5e3a8b48cae9975d075c (patch)
tree9d0b60e02ebcd6604d81956dc3ca7a9c3a1b9a72
parenta4ca8afe5ee8099b23dc2f31ae1a913d4032b92e (diff)
i965: Implement a get_nir_indirect_src() helper.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp25
2 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index ec8abf49cd..d4867841bd 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -359,6 +359,8 @@ public:
src_reg get_nir_src(nir_src src,
unsigned num_components = 4);
+ 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 8ca8ddb98f..24fd3526fa 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -375,6 +375,31 @@ 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)
+{
+ switch (instr->intrinsic) {
+ case nir_intrinsic_load_input_indirect:
+ case nir_intrinsic_load_output_indirect:
+ case nir_intrinsic_load_uniform_indirect:
+ return get_nir_src(instr->src[0], BRW_REGISTER_TYPE_D, 1);
+ case nir_intrinsic_load_per_vertex_input_indirect:
+ case nir_intrinsic_load_per_vertex_output_indirect:
+ case nir_intrinsic_store_output_indirect:
+ return get_nir_src(instr->src[1], BRW_REGISTER_TYPE_D, 1);
+ case nir_intrinsic_store_per_vertex_output_indirect:
+ return get_nir_src(instr->src[2], BRW_REGISTER_TYPE_D, 1);
+ default:
+ /* Return a BAD_FILE register. */
+ return src_reg();
+ }
+}
+
void
vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
{