diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -54,6 +54,16 @@ pub fn build(b: *Build) void { const abi = b.addModule("abi", .{ .root_source_file = b.path("src/abi.zig"), .imports = &.{.{ .name = "abi_hash", .module = b.createModule(.{ .root_source_file = abi_hash }) }} }); const gpu = b.addModule("gpu", .{ .root_source_file = b.path("src/gpu/Executor.zig"), .imports = &.{.{ .name = "abi", .module = abi }} }); _ = b.addModule("gpu_scene", .{ .root_source_file = b.path("src/gpu/scene.zig"), .imports = &.{.{ .name = "abi", .module = abi }} }); + // The cell renderer's shaders (src/gpu/Cells.zig): embedders compile the + // GLSL or embed these committed copies; this refreshes the copies. + const update_shaders = b.addUpdateSourceFiles(); + for ([_][]const u8{ "ui.vert", "ui.frag", "decor.frag", "overlay.vert", "overlay.frag", "image.vert", "image.frag" }) |name| { + const glslc = b.addSystemCommand(&.{ "glslc", b.fmt("-fshader-stage={s}", .{if (std.mem.endsWith(u8, name, ".vert")) "vertex" else "fragment"}) }); + glslc.addFileArg(b.path(b.fmt("src/gpu/shaders/{s}.glsl", .{name}))); + glslc.addArg("-o"); + update_shaders.addCopyFileToSource(glslc.addOutputFileArg(b.fmt("{s}.spv", .{name})), b.fmt("src/gpu/shaders/prebuilt/{s}.spv", .{name})); + } + b.step("shaders", "refresh the committed src/gpu/shaders/prebuilt/*.spv (glslc)").dependOn(&update_shaders.step); // Embedders provide their existing SDL translation and device. if (b.option(bool, "gpu-only", "export GPU modules without building the sketch host") orelse false) return; // The host's session database (src/host/Sessions.zig). |
