enabling shader gen
This commit is contained in:
parent
6300ef0e35
commit
bae150305d
|
|
@ -157,6 +157,11 @@ pub const Program = struct {
|
|||
return lib;
|
||||
}
|
||||
|
||||
pub fn generateStaticShaders(self: *@This()) *std.Build.Module {
|
||||
const loadStatics = self.buildSystem.generateInstallStaticResources(self.name, "content/_shaders") catch unreachable;
|
||||
return loadStatics;
|
||||
}
|
||||
|
||||
// spec is linked in both the base trampoline
|
||||
pub fn compileInstall(self: *@This()) *std.Build.Step.Compile {
|
||||
const bEngine = self.buildSystem.bEngine;
|
||||
|
|
@ -185,6 +190,10 @@ pub const Program = struct {
|
|||
exe.root_module.addImport("platform", platform);
|
||||
}
|
||||
|
||||
if (self.opts.static_build) {
|
||||
exe.root_module.addImport().addImport("staticShaderLoader", self.generateStaticShaders());
|
||||
}
|
||||
|
||||
const gameModule = self.makeGameModule();
|
||||
const gameApi = self.makeGameApi();
|
||||
gameModule.root_module.addImport("backlog", gameApi);
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ pub fn main() !void {
|
|||
|
||||
var ast = try std.zig.Ast.parse(allocator, @as([:0]const u8, @ptrCast(writer.items[0 .. writer.items.len - 1])), .zig);
|
||||
|
||||
// std.debug.print("output=\n{s}", .{content.items[0 .. content.items.len - 1]});
|
||||
defer ast.deinit(allocator);
|
||||
const out = try ast.renderAlloc(allocator);
|
||||
|
||||
std.debug.print("output=\n{s}", .{out});
|
||||
// Write the content to the file
|
||||
try file.writeAll(out);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,10 @@ pub fn build(b: *std.Build) void {
|
|||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
.root_source_file = b.path("tests/tests.zig"),
|
||||
}),
|
||||
.use_llvm = true,
|
||||
});
|
||||
|
||||
const sampleGameExtern = b.addLibrary(.{
|
||||
|
|
@ -40,6 +42,7 @@ pub fn build(b: *std.Build) void {
|
|||
.target = target,
|
||||
}),
|
||||
.linkage = .dynamic,
|
||||
.use_llvm = true,
|
||||
.name = "external",
|
||||
});
|
||||
sampleGameExtern.root_module.addImport("core", mod);
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ pub fn startEngine(spec: *core.SpecVariantMap) bool {
|
|||
|
||||
if (comptime core.BuildOption("static_build")) {
|
||||
core.engine_log("static build, using embedded shaders", .{});
|
||||
// const loader = @import("staticShaderLoader");
|
||||
// loader.installStaticResources() catch return false;
|
||||
const loader = @import("staticShaderLoader");
|
||||
loader.installStaticResources() catch return false;
|
||||
}
|
||||
|
||||
core.start_module(spec, args, allocator) catch return false;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ pub export fn startup_module(p_allocator: *anyopaque, p_a: ?*anyopaque) bool {
|
|||
defer z1.End();
|
||||
core.engine_logs("starting module >>>> " ++ feature ++ " <<<<");
|
||||
core.tracy.Message(Struct.Module.name);
|
||||
Struct.start_module(spec, args, allocator) catch return false;
|
||||
Struct.start_module(spec, args, allocator) catch @panic("start_module failed");
|
||||
|
||||
if (core.MemoryTracker.MTGet()) |_| {
|
||||
core.MemoryTracker.MTPrintStatsDelta();
|
||||
|
|
|
|||
|
|
@ -342,6 +342,8 @@ pub const PackerFS = struct {
|
|||
}
|
||||
|
||||
pub fn installFileBytesMount(self: *@This(), path: []const u8, fileBytes: []align(8) u8, embedded: bool) !?PackerBytesMapping {
|
||||
std.debug.print("mounting file path {s}\n", .{path});
|
||||
|
||||
const pakMountIndex = self.pakMountings.items.len;
|
||||
try self.pakMountings.append(self.allocator, .{
|
||||
.filePath = try self.stringAlloc().dupe(u8, path),
|
||||
|
|
|
|||
Loading…
Reference in New Issue