summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-10-19 12:21:43 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-11-04 10:18:56 -0800
commit356bf05b3219a20644a4acb5dc0811cea8354021 (patch)
treefc2265e158ccbe85f3616893267b5bbc5446e842
parent24b1b050edd100f9157f5e3a8b48cae9975d075c (diff)
i965: Implement a get_nir_vertex_index_src() helper.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp24
2 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index d4867841bd..fb8fbbdc93 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -360,6 +360,7 @@ public:
unsigned num_components = 4);
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 24fd3526fa..483e14d02c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -400,6 +400,30 @@ vec4_visitor::get_nir_indirect_src(nir_intrinsic_instr *instr)
}
}
+/**
+ * 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)
+{
+ switch (instr->intrinsic) {
+ case nir_intrinsic_load_per_vertex_input:
+ case nir_intrinsic_load_per_vertex_output:
+ case nir_intrinsic_load_per_vertex_input_indirect:
+ case nir_intrinsic_load_per_vertex_output_indirect:
+ return get_nir_src(instr->src[0], BRW_REGISTER_TYPE_D, 1);
+ case nir_intrinsic_store_per_vertex_output:
+ case nir_intrinsic_store_per_vertex_output_indirect:
+ return get_nir_src(instr->src[1], BRW_REGISTER_TYPE_D, 1);
+ default:
+ /* Return a BAD_FILE register. */
+ return src_reg();
+ }
+}
+
+
void
vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
{