diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 698e6e0..94211c1 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -292,6 +292,9 @@ class Module { /// Unsigned-integer division of Operand 1 divided by Operand 2. Id OpUDiv(Id result_type, Id operand_1, Id operand_2); + /// Unsigned modulo operation of Operand 1 modulo Operand 2. + Id OpUMod(Id result_type, Id operand_1, Id operand_2); + /// Floating-point division of Operand 1 divided by Operand 2. Id OpFDiv(Id result_type, Id operand_1, Id operand_2); @@ -314,7 +317,7 @@ class Module { Id AddDeclaration(std::unique_ptr op); - Id AddAnnotation(std::unique_ptr op); + void AddAnnotation(std::unique_ptr op); Id GetGLSLstd450(); diff --git a/src/insts/annotation.cpp b/src/insts/annotation.cpp index 400af8d..8f8305a 100644 --- a/src/insts/annotation.cpp +++ b/src/insts/annotation.cpp @@ -18,7 +18,8 @@ Id Module::Decorate(Id target, spv::Decoration decoration, op->Add(target); op->Add(static_cast(decoration)); op->Add(literals); - return AddAnnotation(std::move(op)); + AddAnnotation(std::move(op)); + return target; } Id Module::MemberDecorate(Id structure_type, Literal member, @@ -29,7 +30,8 @@ Id Module::MemberDecorate(Id structure_type, Literal member, op->Add(member); op->Add(static_cast(decoration)); op->Add(literals); - return AddAnnotation(std::move(op)); + AddAnnotation(std::move(op)); + return structure_type; } } // namespace Sirit diff --git a/src/insts/arithmetic.cpp b/src/insts/arithmetic.cpp index 5cedb2c..64a6a8a 100644 --- a/src/insts/arithmetic.cpp +++ b/src/insts/arithmetic.cpp @@ -29,6 +29,7 @@ namespace Sirit { DEFINE_UNARY(OpFNegate, spv::Op::OpFNegate); DEFINE_BINARY(OpUDiv, spv::Op::OpUDiv) +DEFINE_BINARY(OpUMod, spv::Op::OpUMod) DEFINE_BINARY(OpFDiv, spv::Op::OpFDiv) DEFINE_BINARY(OpIAdd, spv::Op::OpIAdd) diff --git a/src/sirit.cpp b/src/sirit.cpp index 6726985..be0b7fb 100644 --- a/src/sirit.cpp +++ b/src/sirit.cpp @@ -119,10 +119,9 @@ Id Module::AddDeclaration(std::unique_ptr op) { return id; } -Id Module::AddAnnotation(std::unique_ptr op) { +void Module::AddAnnotation(std::unique_ptr op) { const auto id = op.get(); annotations.push_back(std::move(op)); - return id; } Id Module::GetGLSLstd450() {