aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/instructions
diff options
context:
space:
mode:
authorcomex <[email protected]>2020-11-26 14:39:27 -0500
committerRodrigo Locatti <[email protected]>2020-11-26 17:20:01 -0300
commitab567491e15aa5c94d6e64956f46d7896583f321 (patch)
treeb42ebeeb3bd62fb10d2b2675b5e5f6bdbfec094c /src/instructions
parentc095705f59caaf92e4988d5da6434933f5481dc2 (diff)
downloadsirit-ab567491e15aa5c94d6e64956f46d7896583f321.tar.gz
sirit-ab567491e15aa5c94d6e64956f46d7896583f321.zip
Add support for `OpGroupNonUniform{All,Any,AllEqual,Ballot}`, and fix `OpGroupNonUniformShuffleXor`.
These Vulkan 1.1 operations can be used in place of `OpSubgroup{All,Any,AllEqual,Ballot}KHR`, among other things. For `OpGroupNonUniformShuffleXor`, which was already implemented, turns out the scope argument needs to be encoded not as an immediate, but as an id that points to a constant integer.
Diffstat (limited to 'src/instructions')
-rw-r--r--src/instructions/group.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/instructions/group.cpp b/src/instructions/group.cpp
index 605a17f..274b5b6 100644
--- a/src/instructions/group.cpp
+++ b/src/instructions/group.cpp
@@ -36,10 +36,30 @@ Id Module::OpSubgroupAllEqualKHR(Id result_type, Id predicate) {
return *code << OpId{spv::Op::OpSubgroupAllEqualKHR, result_type} << predicate << EndOp{};
}
-Id Module::OpGroupNonUniformShuffleXor(Id result_type, spv::Scope scope, Id value, Id mask) {
+Id Module::OpGroupNonUniformShuffleXor(Id result_type, Id scope, Id value, Id mask) {
code->Reserve(6);
return *code << OpId{spv::Op::OpGroupNonUniformShuffleXor, result_type} << scope << value
<< mask << EndOp{};
}
+Id Module::OpGroupNonUniformAll(Id result_type, Id scope, Id predicate) {
+ code->Reserve(5);
+ return *code << OpId{spv::Op::OpGroupNonUniformAll, result_type} << scope << predicate << EndOp{};
+}
+
+Id Module::OpGroupNonUniformAny(Id result_type, Id scope, Id predicate) {
+ code->Reserve(5);
+ return *code << OpId{spv::Op::OpGroupNonUniformAny, result_type} << scope << predicate << EndOp{};
+}
+
+Id Module::OpGroupNonUniformAllEqual(Id result_type, Id scope, Id value) {
+ code->Reserve(5);
+ return *code << OpId{spv::Op::OpGroupNonUniformAllEqual, result_type} << scope << value << EndOp{};
+}
+
+Id Module::OpGroupNonUniformBallot(Id result_type, Id scope, Id predicate) {
+ code->Reserve(5);
+ return *code << OpId{spv::Op::OpGroupNonUniformBallot, result_type} << scope << predicate << EndOp{};
+}
+
} // namespace Sirit