blob: 7e419136251fba9b1ebee8941089929fba2dbf7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
const std = @import("std");
const spec = @import("spirv/spec.zig");
const Module = @import("../Module.zig");
const Decl = Module.Decl;
pub const SPIRVModule = struct {
// TODO: Also use a free list.
next_id: u32 = 0,
pub fn allocId(self: *SPIRVModule) u32 {
defer self.next_id += 1;
return self.next_id;
}
pub fn idBound(self: *SPIRVModule) u32 {
return self.next_id;
}
pub fn genDecl(self: SPIRVModule, id: u32, code: *std.ArrayList(u32), decl: *Decl) !void {
}
pub fn writeInstruction(code: *std.ArrayList(u32), instr: spec.Opcode, args: []const u32) !void {
const word_count = @intCast(u32, args.len + 1);
try code.append((word_count << 16) | @enumToInt(instr));
try code.appendSlice(args);
}
};
|