Add OpReturnValue
This commit is contained in:
parent
91e0769db5
commit
798f8a5866
2 changed files with 28 additions and 20 deletions
|
@ -141,8 +141,7 @@ class Module {
|
||||||
Id OpConstant(Id result_type, const Literal& literal);
|
Id OpConstant(Id result_type, const Literal& literal);
|
||||||
|
|
||||||
/// Returns a numeric scalar constant.
|
/// Returns a numeric scalar constant.
|
||||||
Id OpConstantComposite(Id result_type,
|
Id OpConstantComposite(Id result_type, const std::vector<Id>& constituents);
|
||||||
const std::vector<Id>& constituents);
|
|
||||||
|
|
||||||
/// Returns a sampler constant.
|
/// Returns a sampler constant.
|
||||||
Id OpConstantSampler(Id result_type,
|
Id OpConstantSampler(Id result_type,
|
||||||
|
@ -188,6 +187,9 @@ class Module {
|
||||||
/// Returns with no value from a function with void return type.
|
/// Returns with no value from a function with void return type.
|
||||||
Id OpReturn();
|
Id OpReturn();
|
||||||
|
|
||||||
|
/// Return a value from a function.
|
||||||
|
Id OpReturnValue(Id value);
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
|
|
||||||
/// Assign a name string to a reference.
|
/// Assign a name string to a reference.
|
||||||
|
|
|
@ -53,4 +53,10 @@ Id Module::OpBranchConditional(Id condition, Id true_label, Id false_label,
|
||||||
|
|
||||||
Id Module::OpReturn() { return AddCode(spv::Op::OpReturn); }
|
Id Module::OpReturn() { return AddCode(spv::Op::OpReturn); }
|
||||||
|
|
||||||
|
Id Module::OpReturnValue(Id value) {
|
||||||
|
auto op{std::make_unique<Op>(spv::Op::OpReturnValue)};
|
||||||
|
op->Add(value);
|
||||||
|
return AddCode(std::move(op));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
|
Loading…
Reference in a new issue