adding descriptor sets injections to graphics stages
This commit is contained in:
@@ -18,7 +18,7 @@ layout: *DescriptorSetLayout,
|
||||
vtable: *const VTable,
|
||||
|
||||
pub const VTable = struct {
|
||||
copy: *const fn (*Self, vk.CopyDescriptorSet) VkError!void,
|
||||
copy: *const fn (*Self, *const Self, vk.CopyDescriptorSet) VkError!void,
|
||||
destroy: *const fn (*Self, std.mem.Allocator) void,
|
||||
write: *const fn (*Self, vk.WriteDescriptorSet) VkError!void,
|
||||
};
|
||||
@@ -33,8 +33,8 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, layout: *DescriptorSe
|
||||
};
|
||||
}
|
||||
|
||||
pub inline fn copy(self: *Self, copy_data: vk.CopyDescriptorSet) VkError!void {
|
||||
try self.vtable.copy(self, copy_data);
|
||||
pub inline fn copy(self: *Self, src: *const Self, copy_data: vk.CopyDescriptorSet) VkError!void {
|
||||
try self.vtable.copy(self, src, copy_data);
|
||||
}
|
||||
|
||||
pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
|
||||
|
||||
@@ -34,19 +34,6 @@ dynamic_descriptor_count: usize,
|
||||
/// Shader stages affected by this descriptor set
|
||||
stages: vk.ShaderStageFlags,
|
||||
|
||||
/// Mesa's common Vulkan runtime states:
|
||||
///
|
||||
/// It's often necessary to store a pointer to the descriptor set layout in
|
||||
/// the descriptor so that any entrypoint which has access to a descriptor
|
||||
/// set also has the layout. While layouts are often passed into various
|
||||
/// entrypoints, they're notably missing from vkUpdateDescriptorSets(). In
|
||||
/// order to implement descriptor writes, you either need to stash a pointer
|
||||
/// to the descriptor set layout in the descriptor set or you need to copy
|
||||
/// all of the relevant information. Storing a pointer is a lot cheaper.
|
||||
///
|
||||
/// Because descriptor set layout lifetimes and descriptor set lifetimes are
|
||||
/// not guaranteed to coincide, we have to reference count if we're going to
|
||||
/// do this.
|
||||
ref_count: std.atomic.Value(usize),
|
||||
|
||||
vtable: *const VTable,
|
||||
|
||||
@@ -1598,8 +1598,9 @@ pub export fn strollUpdateDescriptorSets(p_device: vk.Device, write_count: u32,
|
||||
}
|
||||
|
||||
for (copies, 0..copy_count) |copy, _| {
|
||||
const set = NonDispatchable(DescriptorSet).fromHandleObject(copy.dst_set) catch |err| return errorLogger(err);
|
||||
set.copy(copy) catch |err| return errorLogger(err);
|
||||
const dst = NonDispatchable(DescriptorSet).fromHandleObject(copy.dst_set) catch |err| return errorLogger(err);
|
||||
const src = NonDispatchable(DescriptorSet).fromHandleObject(copy.src_set) catch |err| return errorLogger(err);
|
||||
dst.copy(src, copy) catch |err| return errorLogger(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user