Annotations return target and add OpUMod

This commit is contained in:
ReinUsesLisp 2018-11-06 04:47:40 -03:00
parent 587f1dc9f5
commit 8f17ad84ba
4 changed files with 10 additions and 5 deletions

View file

@ -292,6 +292,9 @@ class Module {
/// Unsigned-integer division of Operand 1 divided by Operand 2. /// Unsigned-integer division of Operand 1 divided by Operand 2.
Id OpUDiv(Id result_type, Id operand_1, Id 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. /// Floating-point division of Operand 1 divided by Operand 2.
Id OpFDiv(Id result_type, Id operand_1, Id 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> op); Id AddDeclaration(std::unique_ptr<Op> op);
Id AddAnnotation(std::unique_ptr<Op> op); void AddAnnotation(std::unique_ptr<Op> op);
Id GetGLSLstd450(); Id GetGLSLstd450();

View file

@ -18,7 +18,8 @@ Id Module::Decorate(Id target, spv::Decoration decoration,
op->Add(target); op->Add(target);
op->Add(static_cast<u32>(decoration)); op->Add(static_cast<u32>(decoration));
op->Add(literals); op->Add(literals);
return AddAnnotation(std::move(op)); AddAnnotation(std::move(op));
return target;
} }
Id Module::MemberDecorate(Id structure_type, Literal member, 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(member);
op->Add(static_cast<u32>(decoration)); op->Add(static_cast<u32>(decoration));
op->Add(literals); op->Add(literals);
return AddAnnotation(std::move(op)); AddAnnotation(std::move(op));
return structure_type;
} }
} // namespace Sirit } // namespace Sirit

View file

@ -29,6 +29,7 @@ namespace Sirit {
DEFINE_UNARY(OpFNegate, spv::Op::OpFNegate); DEFINE_UNARY(OpFNegate, spv::Op::OpFNegate);
DEFINE_BINARY(OpUDiv, spv::Op::OpUDiv) DEFINE_BINARY(OpUDiv, spv::Op::OpUDiv)
DEFINE_BINARY(OpUMod, spv::Op::OpUMod)
DEFINE_BINARY(OpFDiv, spv::Op::OpFDiv) DEFINE_BINARY(OpFDiv, spv::Op::OpFDiv)
DEFINE_BINARY(OpIAdd, spv::Op::OpIAdd) DEFINE_BINARY(OpIAdd, spv::Op::OpIAdd)

View file

@ -119,10 +119,9 @@ Id Module::AddDeclaration(std::unique_ptr<Op> op) {
return id; return id;
} }
Id Module::AddAnnotation(std::unique_ptr<Op> op) { void Module::AddAnnotation(std::unique_ptr<Op> op) {
const auto id = op.get(); const auto id = op.get();
annotations.push_back(std::move(op)); annotations.push_back(std::move(op));
return id;
} }
Id Module::GetGLSLstd450() { Id Module::GetGLSLstd450() {