Add descriptor write checks

This commit is contained in:
hodasemi 2023-04-21 10:42:31 +02:00
parent 7b5b54d149
commit 21c2256975
2 changed files with 17 additions and 1 deletions

View file

@ -72,7 +72,7 @@ impl DescriptorPoolBuilder {
pub struct DescriptorPool { pub struct DescriptorPool {
device: Arc<Device>, device: Arc<Device>,
descriptor_pool: VkDescriptorPool, descriptor_pool: VkDescriptorPool,
descriptor_set_layout: Arc<DescriptorSetLayout>, pub(crate) descriptor_set_layout: Arc<DescriptorSetLayout>,
} }
impl DescriptorPool { impl DescriptorPool {

View file

@ -266,6 +266,22 @@ impl DescriptorSet {
pub fn update(&self, writes: &[DescriptorWrite]) -> Result<()> { pub fn update(&self, writes: &[DescriptorWrite]) -> Result<()> {
debug_assert!(!writes.is_empty()); debug_assert!(!writes.is_empty());
#[cfg(debug_assertions)]
{
for (i, binding) in self
.pool
.descriptor_set_layout
.bindings()
.iter()
.enumerate()
{
if let Some(write) = writes.get(i) {
assert_eq!(write.binding, binding.binding);
assert_eq!(write.descriptor_type, binding.desc_type);
}
}
}
let mut vk_writes = Vec::new(); let mut vk_writes = Vec::new();
let mut handles_lock = self.handles.lock().unwrap(); let mut handles_lock = self.handles.lock().unwrap();