mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2024-12-22 12:12:05 +00:00
Add OpFunctionCall
This commit is contained in:
parent
798f8a5866
commit
4043020f45
2 changed files with 13 additions and 0 deletions
|
@ -160,6 +160,10 @@ class Module {
|
||||||
/// Ends a function.
|
/// Ends a function.
|
||||||
Id OpFunctionEnd();
|
Id OpFunctionEnd();
|
||||||
|
|
||||||
|
/// Call a function.
|
||||||
|
Id OpFunctionCall(Id result_type, Id function,
|
||||||
|
const std::vector<Id>& arguments = {});
|
||||||
|
|
||||||
// Flow
|
// Flow
|
||||||
|
|
||||||
/// Declare a structured loop.
|
/// Declare a structured loop.
|
||||||
|
|
|
@ -20,4 +20,13 @@ Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control,
|
||||||
|
|
||||||
Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); }
|
Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); }
|
||||||
|
|
||||||
|
Id Module::OpFunctionCall(Id result_type, Id function,
|
||||||
|
const std::vector<Id>& arguments) {
|
||||||
|
auto op{
|
||||||
|
std::make_unique<Op>(spv::Op::OpFunctionCall, bound++, result_type)};
|
||||||
|
op->Add(function);
|
||||||
|
op->Add(arguments);
|
||||||
|
return AddCode(std::move(op));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
|
Loading…
Reference in a new issue