working on queues
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
const std = @import("std");
|
||||
const vk = @import("vulkan");
|
||||
|
||||
const Dispatchable = @import("Dispatchable.zig").Dispatchable;
|
||||
const VulkanAllocator = @import("VulkanAllocator.zig");
|
||||
const VkError = @import("error_set.zig").VkError;
|
||||
const PhysicalDevice = @import("PhysicalDevice.zig");
|
||||
const DeviceMemory = @import("DeviceMemory.zig");
|
||||
const Fence = @import("Fence.zig");
|
||||
const Queue = @import("Queue.zig");
|
||||
|
||||
const Self = @This();
|
||||
pub const ObjectType: vk.ObjectType = .device;
|
||||
@@ -13,6 +15,7 @@ pub const ObjectType: vk.ObjectType = .device;
|
||||
physical_device: *const PhysicalDevice,
|
||||
dispatch_table: *const DispatchTable,
|
||||
host_allocator: VulkanAllocator,
|
||||
queues: std.AutoArrayHashMapUnmanaged(u32, *Dispatchable(Queue)),
|
||||
|
||||
pub const DispatchTable = struct {
|
||||
allocateMemory: *const fn (*Self, std.mem.Allocator, *const vk.MemoryAllocateInfo) VkError!*DeviceMemory,
|
||||
@@ -32,10 +35,12 @@ pub fn init(allocator: std.mem.Allocator, physical_device: *const PhysicalDevice
|
||||
.physical_device = physical_device,
|
||||
.dispatch_table = undefined,
|
||||
.host_allocator = vulkan_allocator.*,
|
||||
.queues = .empty,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn destroy(self: *Self, allocator: std.mem.Allocator) VkError!void {
|
||||
self.queues.deinit(allocator);
|
||||
try self.dispatch_table.destroy(self, allocator);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ comptime {
|
||||
const Self = @This();
|
||||
pub const ObjectType: vk.ObjectType = .instance;
|
||||
|
||||
physical_devices: std.ArrayList(*Dispatchable(PhysicalDevice)),
|
||||
physical_devices: std.ArrayListUnmanaged(*Dispatchable(PhysicalDevice)),
|
||||
dispatch_table: *const DispatchTable,
|
||||
|
||||
pub const DispatchTable = struct {
|
||||
|
||||
@@ -21,13 +21,13 @@ pub const DispatchTable = struct {
|
||||
waitIdle: *const fn (*Self) VkError!void,
|
||||
};
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator, device: *const Device, index: u32, info: vk.DeviceQueueCreateInfo) VkError!Self {
|
||||
pub fn init(allocator: std.mem.Allocator, device: *const Device, index: u32, family_index: u32, flags: vk.DeviceQueueCreateFlags) VkError!Self {
|
||||
_ = allocator;
|
||||
return .{
|
||||
.owner = device,
|
||||
.family_index = info.queueFamilyIndex,
|
||||
.family_index = family_index,
|
||||
.index = index,
|
||||
.flags = info.flags,
|
||||
.flags = flags,
|
||||
.dispatch_table = undefined,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user