From 688d6d9799b33787506a768b5cf10b392e226567 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 3 Nov 2019 00:32:35 -0300 Subject: [PATCH] Add OpSubgroupReadInvocationKHR --- include/sirit/sirit.h | 5 +++++ src/instructions/group.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 2181d26..7b68757 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -941,6 +941,11 @@ public: // Group + /// Return the value from the invocation in the subgroup with an invocation ID equal to index. + /// The index must be the same for all active invocations in the subgroup, otherwise the results + /// are undefined. + Id OpSubgroupReadInvocationKHR(Id result_type, Id value, Id index); + /// Return the value of the invocation identified by the current invocation's id within the /// group xor'ed with mask. Id OpGroupNonUniformShuffleXor(Id result_type, spv::Scope scope, Id value, Id mask); diff --git a/src/instructions/group.cpp b/src/instructions/group.cpp index 4025553..3c3d429 100644 --- a/src/instructions/group.cpp +++ b/src/instructions/group.cpp @@ -9,6 +9,13 @@ namespace Sirit { +Id Module::OpSubgroupReadInvocationKHR(Id result_type, Id value, Id index) { + auto op = std::make_unique(spv::Op::OpSubgroupReadInvocationKHR, bound++, result_type); + op->Add(value); + op->Add(index); + return AddCode(std::move(op)); +} + Id Module::OpGroupNonUniformShuffleXor(Id result_type, spv::Scope scope, Id value, Id mask) { auto op = std::make_unique(spv::Op::OpGroupNonUniformShuffleXor, bound++, result_type); op->Add(static_cast(scope));