improving vulkan allocator; ci skip

This commit is contained in:
2025-11-14 17:32:37 +01:00
parent fae09760a3
commit 2928517451
6 changed files with 41 additions and 2 deletions

View File

@@ -37,6 +37,22 @@ pub fn allocator(self: *const Self) Allocator {
};
}
pub fn from(a: Allocator) *Self {
const self: *Self = @ptrCast(@alignCast(a.ptr));
return self;
}
pub fn clone(self: *Self) Self {
return self.cloneWithScope(self.scope);
}
pub fn cloneWithScope(self: *Self, scope: vk.SystemAllocationScope) Self {
return .{
.callbacks = self.callbacks,
.scope = scope,
};
}
fn alloc(context: *anyopaque, len: usize, alignment: Alignment, ret_addr: usize) ?[*]u8 {
const self: *Self = @ptrCast(@alignCast(context));
if (self.callbacks.?.pfn_allocation) |pfn_allocation| {