aboutsummaryrefslogtreecommitdiff
path: root/externals/sirit/src/instructions/function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/sirit/src/instructions/function.cpp')
-rw-r--r--externals/sirit/src/instructions/function.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/externals/sirit/src/instructions/function.cpp b/externals/sirit/src/instructions/function.cpp
new file mode 100644
index 0000000000..f84cd7ff53
--- /dev/null
+++ b/externals/sirit/src/instructions/function.cpp
@@ -0,0 +1,34 @@
+/* This file is part of the sirit project.
+ * Copyright (c) 2019 sirit
+ * This software may be used and distributed according to the terms of the
+ * 3-Clause BSD License
+ */
+
+#include "sirit/sirit.h"
+
+#include "stream.h"
+
+namespace Sirit {
+
+Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control, Id function_type) {
+ code->Reserve(5);
+ return *code << OpId{spv::Op::OpFunction, result_type} << function_control << function_type
+ << EndOp{};
+}
+
+void Module::OpFunctionEnd() {
+ code->Reserve(1);
+ *code << spv::Op::OpFunctionEnd << EndOp{};
+}
+
+Id Module::OpFunctionCall(Id result_type, Id function, std::span<const Id> arguments) {
+ code->Reserve(4 + arguments.size());
+ 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