[Mesa-dev] [PATCH 4/6] nir: add shader_clock intrinsic

Emil Velikov emil.l.velikov at gmail.com
Wed Oct 7 04:51:55 PDT 2015


XXX: commit message, comment in nir_intrinsics.h

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/glsl/nir/glsl_to_nir.cpp  | 6 ++++++
 src/glsl/nir/nir_intrinsics.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index efaa73e..231bdbf 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -698,6 +698,8 @@ nir_visitor::visit(ir_call *ir)
          op = nir_intrinsic_ssbo_atomic_exchange;
       } else if (strcmp(ir->callee_name(), "__intrinsic_ssbo_atomic_comp_swap_internal") == 0) {
          op = nir_intrinsic_ssbo_atomic_comp_swap;
+      } else if (strcmp(ir->callee_name(), "__intrinsic_shader_clock") == 0) {
+         op = nir_intrinsic_shader_clock;
       } else {
          unreachable("not reached");
       }
@@ -802,6 +804,10 @@ nir_visitor::visit(ir_call *ir)
       case nir_intrinsic_memory_barrier:
          nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
          break;
+      case nir_intrinsic_shader_clock:
+         nir_ssa_dest_init(&instr->instr, &instr->dest, 1, NULL);
+         nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
+         break;
       case nir_intrinsic_store_ssbo: {
          exec_node *param = ir->actual_parameters.get_head();
          ir_rvalue *block = ((ir_instruction *)param)->as_rvalue();
diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
index 263d8c1..4b32215 100644
--- a/src/glsl/nir/nir_intrinsics.h
+++ b/src/glsl/nir/nir_intrinsics.h
@@ -83,6 +83,8 @@ BARRIER(discard)
  */
 BARRIER(memory_barrier)
 
+INTRINSIC(shader_clock, 0, ARR(), true, 1, 1, 0, 0 /* flags ? */)
+
 /** A conditional discard, with a single boolean source. */
 INTRINSIC(discard_if, 1, ARR(1), false, 0, 0, 0, 0)
 
-- 
2.5.0



More information about the mesa-dev mailing list