fixing command pool, adding base command buffer dispatch table

This commit is contained in:
2025-11-16 20:42:08 +01:00
parent c74bc7fb15
commit 5661505bef
7 changed files with 94 additions and 11 deletions

View File

@@ -10,6 +10,12 @@ pub const ObjectType: vk.ObjectType = .command_buffer;
owner: *Device,
vtable: *const VTable,
dispatch_table: *const DispatchTable,
pub const DispatchTable = struct {
begin: *const fn (*Self, *const vk.CommandBufferBeginInfo) VkError!void,
end: *const fn (*Self) VkError!void,
};
pub const VTable = struct {
destroy: *const fn (*Self, std.mem.Allocator) void,
@@ -21,9 +27,18 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma
return .{
.owner = device,
.vtable = undefined,
.dispatch_table = undefined,
};
}
pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
self.vtable.destroy(self, allocator);
}
pub inline fn begin(self: *Self, info: *const vk.CommandBufferBeginInfo) VkError!void {
try self.dispatch_table.begin(self, info);
}
pub inline fn end(self: *Self) VkError!void {
try self.dispatch_table.end(self);
}