diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 574a9cc..c26304b 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -242,6 +242,9 @@ public: return OpFunctionCall(result_type, function, std::span({arguments...})); } + /// Declare a formal parameter of the current function. + Id OpFunctionParameter(Id result_type); + // Flow /** diff --git a/src/instructions/function.cpp b/src/instructions/function.cpp index ece60e6..f84cd7f 100644 --- a/src/instructions/function.cpp +++ b/src/instructions/function.cpp @@ -26,4 +26,9 @@ Id Module::OpFunctionCall(Id result_type, Id function, std::span argum return *code << OpId{spv::Op::OpFunctionCall, result_type} << function << arguments << EndOp{}; } +Id Module::OpFunctionParameter(Id result_type) { + code->Reserve(3); + return *code << OpId{spv::Op::OpFunctionParameter, result_type} << EndOp{}; +} + } // namespace Sirit