diff options
| author | Robin Voetter <robin@voetter.nl> | 2021-01-19 01:54:01 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2021-01-19 15:28:17 +0100 |
| commit | 801732aebd3092c539b754170032455139c7418c (patch) | |
| tree | 02d46e2d85d3e98e511055510fec79e4f38d7b37 /src/codegen | |
| parent | 71ac82ecb028605545b67eaa50b34f4e2494de44 (diff) | |
| download | zig-801732aebd3092c539b754170032455139c7418c.tar.gz zig-801732aebd3092c539b754170032455139c7418c.zip | |
SPIR-V: OpMemoryModel and basic capability generation
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 7e41913625..2fe759dc03 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -3,6 +3,12 @@ const spec = @import("spirv/spec.zig"); const Module = @import("../Module.zig"); const Decl = Module.Decl; +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); +} + pub const SPIRVModule = struct { // TODO: Also use a free list. next_id: u32 = 0, @@ -19,10 +25,4 @@ pub const SPIRVModule = struct { 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); - } }; |
