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

49
src/vulkan/Fence.zig git.filemode.normal_file
View File

@@ -0,0 +1,49 @@
const std = @import("std");
const vk = @import("vulkan");
const VkError = @import("error_set.zig").VkError;
const Device = @import("Device.zig");
const Self = @This();
pub const ObjectType: vk.ObjectType = .fence;
owner: *const Device,
flags: vk.FenceCreateFlags,
vtable: *const VTable,
pub const VTable = struct {
destroy: *const fn (*Self, std.mem.Allocator) void,
getStatus: *const fn (*Self) VkError!void,
reset: *const fn (*Self) VkError!void,
signal: *const fn (*Self) VkError!void,
wait: *const fn (*Self, u64) VkError!void,
};
pub fn init(device: *const Device, info: *const vk.FenceCreateInfo) VkError!Self {
return .{
.owner = device,
.flags = info.flags,
.vtable = undefined,
};
}
pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
self.vtable.destroy(self, allocator);
}
pub inline fn getStatus(self: *Self) VkError!void {
try self.vtable.getStatus(self);
}
pub inline fn reset(self: *Self) VkError!void {
try self.vtable.reset(self);
}
pub inline fn signal(self: *Self) VkError!void {
try self.vtable.signal(self);
}
pub inline fn wait(self: *Self, timeout: u64) VkError!void {
try self.vtable.wait(self, timeout);
}