adding device memory support, fences base

This commit is contained in:
2025-11-09 00:34:52 +01:00
parent 4b23abe795
commit e89d1ff8d9
14 changed files with 381 additions and 27 deletions

View File

@@ -15,6 +15,7 @@ is_mapped: bool,
vtable: *const VTable,
pub const VTable = struct {
destroy: *const fn (*Self, std.mem.Allocator) void,
map: *const fn (*Self, vk.DeviceSize, vk.DeviceSize) VkError!?*anyopaque,
unmap: *const fn (*Self) void,
};
@@ -25,9 +26,14 @@ pub fn init(device: *const Device, size: vk.DeviceSize, memory_type_index: u32)
.size = size,
.memory_type_index = memory_type_index,
.is_mapped = false,
.vtable = undefined,
};
}
pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
self.vtable.destroy(self, allocator);
}
pub inline fn map(self: *Self, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!?*anyopaque {
return self.vtable.map(self, offset, size);
}