From 9b897c35411353a7578a2102fde53ae6ba0878e5 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 2 Nov 2019 19:39:41 -0300 Subject: [PATCH] Add OpGroupNonUniformShuffleXor --- include/sirit/sirit.h | 6 ++++++ src/CMakeLists.txt | 1 + src/instructions/group.cpp | 20 ++++++++++++++++++++ src/instructions/misc.cpp | 1 - 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/instructions/group.cpp diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 49312f0..2181d26 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -939,6 +939,12 @@ public: /// Query the number of samples available per texel fetch in a multisample image. Id OpImageQuerySamples(Id result_type, Id image); + // Group + + /// 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); + private: Id AddCode(std::unique_ptr op); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 53a409e..e1a632a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,6 +26,7 @@ add_library(sirit instructions/arithmetic.cpp instructions/extension.cpp instructions/image.cpp + instructions/group.cpp ) target_compile_options(sirit PRIVATE ${SIRIT_CXX_FLAGS}) diff --git a/src/instructions/group.cpp b/src/instructions/group.cpp new file mode 100644 index 0000000..4025553 --- /dev/null +++ b/src/instructions/group.cpp @@ -0,0 +1,20 @@ +/* This file is part of the sirit project. + * Copyright (c) 2019 sirit + * This software may be used and distributed according to the terms of the + * 3-Clause BSD License + */ + +#include "op.h" +#include "sirit/sirit.h" + +namespace Sirit { + +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)); + op->Add(value); + op->Add(mask); + return AddCode(std::move(op)); +} + +} // namespace Sirit diff --git a/src/instructions/misc.cpp b/src/instructions/misc.cpp index c2aa68c..b589090 100644 --- a/src/instructions/misc.cpp +++ b/src/instructions/misc.cpp @@ -4,7 +4,6 @@ * 3-Clause BSD License */ -#include #include "op.h" #include "sirit/sirit.h"