engine/tools/CompileShaderPipeline.zig

39 lines
976 B
Zig

const std = @import("std");
const Build = std.Build;
const Step = Build.Step;
const CompileShaderProgram = @This();
step: Step,
program_path: Build.LazyPath,
pub fn create(b: *Build, program_path: Build.LazyPath) *CompileShaderProgram {
const csp = b.allocator.create(CompileShaderProgram) catch @panic("OOM");
csp.* = .{
.step = Step.init(.{
.id = .custom,
.name = b.fmt("CompileShaderProgram ({s}))"),
.owner = b,
.makeFn = make,
}),
.program_path = program_path,
};
return csp;
}
fn make(step: *Step, prog_node: std.Progress.Node) !void {
_ = prog_node; // autofix
const b = step.owner;
var arena = std.heap.ArenaAllocator.init(b.allocator);
defer arena.deinit();
const alloc = arena.allocator();
const self: *CompileShaderProgram = @fieldParentPtr("step", step);
_ = self; // autofix
var man = b.graph.cache.obtain();
defer man.deinit();
}