[Mesa-dev] [PATCH 1/7] glsl: add intrinsics for ARB_shader_group_vote and ARB_shader_ballot

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 19 08:56:47 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

These operations are currently implemented as IR expressions. However,
they cannot be transformed and moved in the way that other IR
expressions can because they have non-trivial interactions with
control-flow.
---
 src/compiler/glsl/ir.h                     | 7 +++++++
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index d7a81c5..9ab4df7 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -1091,20 +1091,27 @@ enum ir_intrinsic_id {
    ir_intrinsic_ssbo_atomic_comp_swap = MAKE_INTRINSIC_FOR_TYPE(atomic_comp_swap, ssbo),
 
    ir_intrinsic_memory_barrier,
    ir_intrinsic_shader_clock,
    ir_intrinsic_group_memory_barrier,
    ir_intrinsic_memory_barrier_atomic_counter,
    ir_intrinsic_memory_barrier_buffer,
    ir_intrinsic_memory_barrier_image,
    ir_intrinsic_memory_barrier_shared,
 
+   ir_intrinsic_vote_all,
+   ir_intrinsic_vote_any,
+   ir_intrinsic_vote_eq,
+   ir_intrinsic_ballot,
+   ir_intrinsic_read_invocation,
+   ir_intrinsic_read_first_invocation,
+
    ir_intrinsic_shared_load,
    ir_intrinsic_shared_store = MAKE_INTRINSIC_FOR_TYPE(store, shared),
    ir_intrinsic_shared_atomic_add = MAKE_INTRINSIC_FOR_TYPE(atomic_add, shared),
    ir_intrinsic_shared_atomic_and = MAKE_INTRINSIC_FOR_TYPE(atomic_and, shared),
    ir_intrinsic_shared_atomic_or = MAKE_INTRINSIC_FOR_TYPE(atomic_or, shared),
    ir_intrinsic_shared_atomic_xor = MAKE_INTRINSIC_FOR_TYPE(atomic_xor, shared),
    ir_intrinsic_shared_atomic_min = MAKE_INTRINSIC_FOR_TYPE(atomic_min, shared),
    ir_intrinsic_shared_atomic_max = MAKE_INTRINSIC_FOR_TYPE(atomic_max, shared),
    ir_intrinsic_shared_atomic_exchange = MAKE_INTRINSIC_FOR_TYPE(atomic_exchange, shared),
    ir_intrinsic_shared_atomic_comp_swap = MAKE_INTRINSIC_FOR_TYPE(atomic_comp_swap, shared),
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 96c08a6..4a92cab 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3987,20 +3987,26 @@ glsl_to_tgsi_visitor::visit(ir_call *ir)
    case ir_intrinsic_shader_clock: {
       ir->return_deref->accept(this);
 
       st_dst_reg dst = st_dst_reg(this->result);
       dst.writemask = TGSI_WRITEMASK_XY;
 
       emit_asm(ir, TGSI_OPCODE_CLOCK, dst);
       return;
    }
 
+   case ir_intrinsic_vote_all:
+   case ir_intrinsic_vote_any:
+   case ir_intrinsic_vote_eq:
+   case ir_intrinsic_ballot:
+   case ir_intrinsic_read_first_invocation:
+   case ir_intrinsic_read_invocation:
    case ir_intrinsic_invalid:
    case ir_intrinsic_generic_load:
    case ir_intrinsic_generic_store:
    case ir_intrinsic_generic_atomic_add:
    case ir_intrinsic_generic_atomic_and:
    case ir_intrinsic_generic_atomic_or:
    case ir_intrinsic_generic_atomic_xor:
    case ir_intrinsic_generic_atomic_min:
    case ir_intrinsic_generic_atomic_max:
    case ir_intrinsic_generic_atomic_exchange:
-- 
2.9.3



More information about the mesa-dev mailing list