29 lines
840 B
Zig
29 lines
840 B
Zig
const std = @import("std");
|
|
const vk = @import("vk");
|
|
const GraphicsContext = @import("GraphicsContext.zig");
|
|
pub const RenderGraph = @This();
|
|
|
|
pub const PassSetupContext = struct {};
|
|
pub const Texture2DHandle = struct { id: u64 };
|
|
|
|
pub fn declareTexture2D(comptime name: []const u8) Texture2DHandle {
|
|
return Texture2DHandle{ .id = std.hash.Wyhash.hash(0, name) };
|
|
}
|
|
|
|
test "RenderGraph" {
|
|
var GraphBuilder: *RenderGraph = undefined;
|
|
|
|
const GBuffer = RenderGraph.declareTexture2D("GBuffer");
|
|
|
|
GraphBuilder.addPass(
|
|
struct {
|
|
fn setup(ctx: *PassSetupContext) void {
|
|
ctx.createTexture2D(GBuffer, 1024, 1024, vk.Format.r8g8b8a8_unorm);
|
|
}
|
|
fn render(ctx: *GraphicsContext.CommandBuffer) void {
|
|
ctx.getTexture2D(GBuffer);
|
|
}
|
|
},
|
|
);
|
|
}
|