aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/spirv.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index db4ddbd657..a6b8216774 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -57,6 +57,7 @@ pub const DeclGen = struct {
module: *Module,
spv: *SPIRVModule,
+ args: std.ArrayList(u32),
types: TypeMap,
decl: *Decl,
@@ -213,7 +214,17 @@ pub const DeclGen = struct {
prototype_id,
});
- // TODO: Parameters
+ const params = tv.ty.fnParamLen();
+ var i: usize = 0;
+
+ try self.args.ensureCapacity(params);
+ while (i < params) : (i += 1) {
+ const param_type_id = self.types.get(tv.ty.fnParamType(i)).?;
+ const arg_result_id = self.spv.allocResultId();
+ try writeInstruction(&self.spv.fn_decls, .OpFunctionParameter, &[_]u32{ param_type_id, arg_result_id });
+ self.args.appendAssumeCapacity(arg_result_id);
+ }
+
// TODO: Body
try writeInstruction(&self.spv.fn_decls, .OpFunctionEnd, &[_]u32{});