add descriptor count

This commit is contained in:
Matthew 2025-11-23 14:35:53 +11:00
parent a484c0cbe1
commit 9340114d02

View File

@ -233,6 +233,7 @@ struct Descriptor
{
DescType type;
u32 binding;
u32 count;
union
{
Buffer buf;
@ -564,10 +565,11 @@ CreatePipelineLayout(T)(Vulkan* vk, T layouts, u32 push_const_size, bool compute
}
void
CreateBuffer(Vulkan* vk, Descriptor* desc, BufferType type, u64 size, bool host_visible, DescType desc_type, u32 binding)
CreateBuffer(Vulkan* vk, Descriptor* desc, BufferType type, u64 size, bool host_visible, DescType desc_type, u32 binding, u32 count = 1)
{
desc.type = desc_type;
desc.binding = binding;
desc.count = count;
CreateBuffer(vk, &desc.buf, type, size, host_visible);
}
@ -961,6 +963,7 @@ CreateImageView(Vulkan* vk, Descriptor* view, u32 w, u32 h, u32 ch, u8[] data, D
ImageDescCheck(type);
view.type = type;
view.binding = binding;
view.count = 1;
CreateImageView(vk, &view.view, w, h, ch, data);
}
@ -1033,6 +1036,7 @@ CreateImageView(Vulkan* vk, Descriptor* desc, u32 w, u32 h, Format format, Image
ImageDescCheck(type);
desc.type = type;
desc.binding = binding;
desc.count = 1;
CreateImageView(vk, &desc.view, w, h, format, usage);
}
@ -1166,6 +1170,7 @@ CreateBufferView(Vulkan* vk, Descriptor* desc, u64 size, Format format, DescType
VkCheckA("CreateBufferView failure: vkCreateBufferView failed", result);
desc.binding = binding;
desc.count = 1;
desc.buf_view.size = size;
}
@ -1980,7 +1985,7 @@ PrepareWrite(Vulkan* vk, VkWriteDescriptorSet* write, DescSet set, Descriptor* d
write.descriptorType = desc.type;
write.dstSet = set.handle;
write.dstBinding = desc.binding;
write.descriptorCount = 1;
write.descriptorCount = desc.count;
switch(desc.type) with(DescType)
{