More TODO code
This commit is contained in:
parent
3339845d57
commit
c87606d425
@ -22,7 +22,7 @@ pub const Document = struct {
|
||||
}
|
||||
|
||||
pub fn op(self: *Document, code: u32) std.mem.Allocator.Error!void {
|
||||
try self.ops.pushGrow(@byteSwap(code));
|
||||
try self.ops.pushGrow(std.mem.nativeToLittle(u32, code));
|
||||
}
|
||||
|
||||
pub fn opCapability(self: *Document, capability: Capability) std.mem.Allocator.Error!void {
|
||||
@ -30,6 +30,15 @@ pub const Document = struct {
|
||||
try self.op(@intFromEnum(capability));
|
||||
}
|
||||
|
||||
pub fn opEntryPoint(self: *Document, name: []const u8, interfaces: []const u32) std.mem.Allocator.Error!void {
|
||||
try self.op(14);
|
||||
try self.string(name);
|
||||
|
||||
for (interfaces) |interface| {
|
||||
self.op(interface);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn opMemoryModel(self: *Document, addressing: AddressingModel, memory: MemoryModel) std.mem.Allocator.Error!void {
|
||||
try self.op(14);
|
||||
try self.op(@intFromEnum(addressing));
|
||||
@ -85,13 +94,14 @@ pub const MemoryModel = enum(u32) {
|
||||
|
||||
pub fn generate(spirv: coral.bytes.Writable, root: coral.shaders.Root) (coral.shaders.GenerationError || std.mem.Allocator.Error)!void {
|
||||
// TODO: Finish and testing coverage.
|
||||
var document = Document{};
|
||||
var arena = std.heap.ArenaAllocator.init(coral.heap.allocator);
|
||||
|
||||
try document.opCapability(.shader);
|
||||
var module = Module{
|
||||
.capabilities = &.{.shader},
|
||||
.memory_model = .{ .logical, .glsl450 },
|
||||
};
|
||||
|
||||
_ = root;
|
||||
_ = try document.opExtInstImport("GLSL.std.450");
|
||||
|
||||
try document.opMemoryModel(.logical, .glsl450);
|
||||
try document.writeTo(spirv);
|
||||
const glsl_std_450 = module.importExtension(&arena, "GLSL.std.450");
|
||||
// TODO: specify frag entry point
|
||||
const frag = module.entryPoint(.fragment, "main", .{});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user