implementing proper graphics pipeline creations
Build / build (push) Successful in 1m8s
Test / build_and_test (push) Successful in 25m29s

This commit is contained in:
2026-04-24 02:41:37 +02:00
parent 2a427c0b51
commit 5fc7d561fc
8 changed files with 161 additions and 80 deletions
+21 -4
View File
@@ -1,6 +1,7 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("../lib.zig");
const SoftDescriptorSet = @import("../SoftDescriptorSet.zig");
const SoftDevice = @import("../SoftDevice.zig");
@@ -15,29 +16,45 @@ const VkError = base.VkError;
const Self = @This();
pub const GRAPHICS_PIPELINE_STATE = 0;
pub const COMPUTE_PIPELINE_STATE = 1;
pub const PipelineState = struct {
pipeline: ?*SoftPipeline,
sets: [base.VULKAN_MAX_DESCRIPTOR_SETS]?*SoftDescriptorSet,
data: union {
compute: struct {},
graphics: struct {
vertex_buffers: [lib.MAX_VERTEX_INPUT_BINDINGS]Renderer.VertexBuffer,
},
},
};
compute: ComputeDispatcher,
renderer: Renderer,
/// .graphics = 0
/// .compute = 1
pipeline_states: [2]PipelineState,
/// Initializating an execution device and
/// not creating one to avoid dangling pointers
pub fn init(self: *Self, device: *SoftDevice) void {
for (self.pipeline_states[0..]) |*state| {
for (self.pipeline_states[0..], 0..) |*state, i| {
state.* = .{
.pipeline = null,
.sets = [_]?*SoftDescriptorSet{null} ** base.VULKAN_MAX_DESCRIPTOR_SETS,
.data = switch (i) {
GRAPHICS_PIPELINE_STATE => .{
.graphics = .{
.vertex_buffers = undefined,
},
},
COMPUTE_PIPELINE_STATE => .{ .compute = .{} },
else => unreachable,
},
};
}
self.compute = .init(device, &self.pipeline_states[@intFromEnum(vk.PipelineBindPoint.compute)]);
self.renderer = .init();
self.renderer = .init(device, &self.pipeline_states[@intFromEnum(vk.PipelineBindPoint.compute)]);
}
pub fn deinit(self: *Self) void {