2026-07-10 01:35:45 +01:00
|
|
|
//! ----------------------------------------------------
|
|
|
|
|
//! ----------------------------------------------------
|
|
|
|
|
|
2026-07-09 23:16:38 +01:00
|
|
|
const App = @import("app");
|
|
|
|
|
const system = @import("system/root.zig");
|
|
|
|
|
const resource = @import("resource/root.zig");
|
|
|
|
|
|
|
|
|
|
/// ----------------------------------------------------
|
|
|
|
|
/// ----------------------------------------------------
|
|
|
|
|
pub const plugin: App.plugin.Plugin = .{
|
|
|
|
|
.name = "Renderer",
|
|
|
|
|
.description = "WebGPU Renderer",
|
|
|
|
|
.build = build,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// ----------------------------------------------------
|
|
|
|
|
/// ----------------------------------------------------
|
|
|
|
|
fn build(
|
|
|
|
|
_: *App.plugin.Plugin,
|
|
|
|
|
ctx: App.plugin.Context,
|
|
|
|
|
) !void {
|
2026-07-10 01:35:45 +01:00
|
|
|
// --- CORE ---
|
2026-07-09 23:16:38 +01:00
|
|
|
try ctx.app.resources.set(resource.Instance{});
|
|
|
|
|
try ctx.app.resources.set(resource.Device{});
|
|
|
|
|
try ctx.app.resources.set(resource.window{});
|
2026-07-10 01:35:45 +01:00
|
|
|
|
|
|
|
|
// --- RENDER ---
|
|
|
|
|
try ctx.app.resources.set(resource.RenderFrame{});
|
2026-07-10 00:23:33 +01:00
|
|
|
try ctx.app.resources.set(resource.RenderQueue.init(ctx.app.alloc));
|
2026-07-09 23:16:38 +01:00
|
|
|
|
|
|
|
|
// --- INIT ---
|
|
|
|
|
try ctx.app.schedules.addMany(App.stage.Init, &.{
|
|
|
|
|
system.instance.init,
|
|
|
|
|
system.window.init,
|
|
|
|
|
system.device.init,
|
2026-07-10 01:35:45 +01:00
|
|
|
|
|
|
|
|
system.frame.begin,
|
2026-07-09 23:16:38 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// --- DEINIT ---
|
|
|
|
|
try ctx.app.schedules.addMany(App.stage.Deinit, &.{
|
2026-07-10 01:35:45 +01:00
|
|
|
system.frame.end,
|
|
|
|
|
|
2026-07-09 23:16:38 +01:00
|
|
|
system.device.deinit,
|
|
|
|
|
system.window.deinit,
|
|
|
|
|
system.instance.deinit,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// --- INPUT ---
|
|
|
|
|
try ctx.app.schedules.addMany(App.stage.Inputs, &.{});
|
|
|
|
|
}
|