adding base descriptors
This commit is contained in:
28
src/vulkan/DescriptorSetLayout.zig
git.filemode.normal_file
28
src/vulkan/DescriptorSetLayout.zig
git.filemode.normal_file
@@ -0,0 +1,28 @@
|
||||
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 = .descriptor_set_layout;
|
||||
|
||||
owner: *Device,
|
||||
bindings: []const vk.DescriptorSetLayoutBinding,
|
||||
|
||||
vtable: *const VTable,
|
||||
|
||||
pub const VTable = struct {
|
||||
destroy: *const fn (*Self, std.mem.Allocator) void,
|
||||
};
|
||||
|
||||
pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.DescriptorSetLayoutCreateInfo) VkError!Self {
|
||||
return .{
|
||||
.owner = device,
|
||||
.bindings = allocator.dupe(info.bindings[0..info.binding_count]) catch return VkError.OutOfHostMemory,
|
||||
};
|
||||
}
|
||||
|
||||
pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
|
||||
self.vtable.destroy(self, allocator);
|
||||
}
|
||||
Reference in New Issue
Block a user