adding Descriptors fundamental implementation

This commit is contained in:
2025-11-27 23:42:05 +01:00
parent a3df2cadd2
commit 7a94396abe
10 changed files with 244 additions and 57 deletions
+9
View File
@@ -2,9 +2,12 @@ const std = @import("std");
const vk = @import("vulkan");
const VkError = @import("error_set.zig").VkError;
const Dispatchable = @import("Dispatchable.zig").Dispatchable;
const Device = @import("Device.zig");
const DescriptorSet = @import("DescriptorSet.zig");
const Self = @This();
pub const ObjectType: vk.ObjectType = .descriptor_pool;
@@ -15,6 +18,7 @@ vtable: *const VTable,
pub const VTable = struct {
destroy: *const fn (*Self, std.mem.Allocator) void,
freeDescriptorSets: *const fn (*Self, []*Dispatchable(DescriptorSet)) VkError!void,
};
pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.DescriptorPoolCreateInfo) VkError!Self {
@@ -22,9 +26,14 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Descr
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 freeDescriptorSets(self: *Self, sets: []*Dispatchable(DescriptorSet)) VkError!void {
try self.vtable.freeDescriptorSets(self, sets);
}