improving architecture, adding logical device creation and destruction

This commit is contained in:
2025-11-04 13:02:47 +01:00
parent 0664c3e94b
commit 31c9234a99
13 changed files with 302 additions and 103 deletions

View File

@@ -1,15 +1,28 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const VkError = @import("error_set.zig").VkError;
const PhysicalDevice = @import("PhysicalDevice.zig");
const Self = @This();
pub const ObjectType: vk.ObjectType = .device;
physical_device: *const PhysicalDevice,
dispatch_table: DispatchTable,
driver_data: ?*anyopaque,
dispatch_table: *const DispatchTable,
pub const DispatchTable = struct {};
pub const DispatchTable = struct {
destroy: *const fn (*Self, std.mem.Allocator) VkError!void,
};
pub fn createImplDevice(physical_device: *base.PhysicalDevice, infos: vk.DeviceCreateInfo, allocator: std.mem.Allocator) !*anyopaque {
pub fn init(allocator: std.mem.Allocator, physical_device: *const PhysicalDevice, infos: *const vk.DeviceCreateInfo) VkError!Self {
_ = allocator;
_ = infos;
return .{
.physical_device = physical_device,
.dispatch_table = undefined,
};
}
pub fn destroy(self: *Self, allocator: std.mem.Allocator) VkError!void {
try self.dispatch_table.destroy(self, allocator);
}