diff options
| author | Robin Voetter <robin@voetter.nl> | 2021-01-18 23:47:25 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2021-01-19 15:28:17 +0100 |
| commit | 02c138fe7011346ebab5e4b24ba0f8575bb52173 (patch) | |
| tree | 5f59ca5e6e25d700dd3aa9d1ea1f9be577bdb1a6 /src/link | |
| parent | b2b87b590011d8df52874e3f9bd1f88d1b0189d1 (diff) | |
| download | zig-02c138fe7011346ebab5e4b24ba0f8575bb52173.tar.gz zig-02c138fe7011346ebab5e4b24ba0f8575bb52173.zip | |
SPIR-V: Add glsl450 and vulkan spir-v operating system definitions
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/SpirV.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig index 207e460174..68edfab845 100644 --- a/src/link/SpirV.zig +++ b/src/link/SpirV.zig @@ -12,6 +12,8 @@ const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); const spec = @import("../codegen/spirv/spec.zig"); +//! SPIR-V Documentation: https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html + pub const FnData = struct { id: ?u32 = null, code: std.ArrayListUnmanaged(u32) = .{}, @@ -32,6 +34,22 @@ pub fn createEmpty(gpa: *Allocator, options: link.Options) !*SpirV { .allocator = gpa, }, }; + + // TODO: Figure out where to put all of these + switch (options.target.cpu.arch) { + .spirv32, .spirv64 => {}, + else => return error.TODOArchNotSupported, + } + + switch (options.target.os.tag) { + .opencl, .glsl450, .vulkan => {}, + else => return error.TODOOsNotSupported, + } + + if (options.target.abi != .none) { + return error.TODOAbiNotSupported; + } + return spirv; } @@ -119,6 +137,8 @@ pub fn flushModule(self: *SpirV, comp: *Compilation) !void { switch (decl.typed_value) { .most_recent => |tvm| { const fn_data = &decl.fn_link.spirv; + + // TODO: This could probably be more efficient. for (fn_data.code.items) |word| { try writer.writeIntLittle(u32, word); } |
