aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2015-07-01 10:12:10 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:50 -0700
commit287b006a673dabe3e21cc207a1b4622ef91a877e (patch)
tree800ccd365bc6203ab22d7e288bf09aa606c567d8 /src
parent7eced3aa863394c6e74ac3f037ed1cf9c481fe37 (diff)
i965/nir/gs: Implement support for gl_InvocationID system value
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp28
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
index f627a8dbdae..d85fb6f31ec 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
@@ -67,6 +67,25 @@ vec4_gs_visitor::nir_setup_inputs(nir_shader *shader)
}
void
+vec4_gs_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
+{
+ dst_reg *reg;
+
+ switch (instr->intrinsic) {
+ case nir_intrinsic_load_invocation_id:
+ reg = &this->nir_system_values[SYSTEM_VALUE_INVOCATION_ID];
+ if (reg->file == BAD_FILE)
+ *reg = *this->make_reg_for_system_value(SYSTEM_VALUE_INVOCATION_ID,
+ glsl_type::int_type);
+ break;
+
+ default:
+ vec4_visitor::nir_setup_system_value_intrinsic(instr);
+ }
+
+}
+
+void
vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
{
dst_reg dest;
@@ -83,6 +102,15 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
gs_end_primitive();
break;
+ case nir_intrinsic_load_invocation_id: {
+ src_reg invocation_id =
+ src_reg(nir_system_values[SYSTEM_VALUE_INVOCATION_ID]);
+ assert(invocation_id.file != BAD_FILE);
+ dest = get_nir_dest(instr->dest, invocation_id.type);
+ emit(MOV(dest, invocation_id));
+ break;
+ }
+
default:
vec4_visitor::nir_emit_intrinsic(instr);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index 517e99d7862..0e8fefabecc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -76,6 +76,7 @@ public:
int shader_time_index);
virtual void nir_setup_inputs(nir_shader *shader);
+ virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
protected:
virtual dst_reg *make_reg_for_system_value(int location,