Enable descriptor_count() setter on ash::vk::WriteDescriptorSet (#809)

This parameter is not only used for the length of `pImageInfo`,
`pBufferInfo` or `pTexelBufferView`, but also matching the value
of `dataSize` when `VkWriteDescriptorSetInlineUniformBlock` is
appended in `pNext`, or the value of `accelerationStructureCount`
when `VkWriteDescriptorSetAccelerationStructureKHR` is in `pNext`.
Having the count setter directly avaialble makes builder code more
natural, instead of having to use a `mut` variable and manually assign
`.descriptor_count = xx.len();` afterwards.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkWriteDescriptorSet.html
This commit is contained in:
Marijn Suijten 2023-10-31 10:16:34 +01:00 committed by GitHub
parent 4180359ba7
commit 335251d383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View file

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_NV_low_latency2` device extension (#802)
- Added `VK_EXT_hdr_metadata` device extension (#804)
- Added `VK_NV_cuda_kernel_launch` device extension (#805)
- Added `descriptor_count()` setter on `ash::vk::WriteDescriptorSet` (#809)
### Changed

View file

@ -1835,6 +1835,11 @@ impl<'a> WriteDescriptorSet<'a> {
self
}
#[inline]
pub fn descriptor_count(mut self, descriptor_count: u32) -> Self {
self.descriptor_count = descriptor_count;
self
}
#[inline]
pub fn descriptor_type(mut self, descriptor_type: DescriptorType) -> Self {
self.descriptor_type = descriptor_type;
self

View file

@ -1893,6 +1893,9 @@ fn derive_setters(
("VkDescriptorSetLayoutBinding", "descriptorCount"),
// No ImageView attachments when VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT is set
("VkFramebufferCreateInfo", "attachmentCount"),
// descriptorCount also describes descriptor length in pNext extension structures
// https://github.com/ash-rs/ash/issues/806
("VkWriteDescriptorSet", "descriptorCount"),
];
let skip_members = members
.iter()