From a1ffb61707ee232066ad782832ca18f623bc69f7 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 1 Sep 2026 06:12:47 +0300 Subject: [PATCH] Count a descriptor array as the one binding it occupies `bindings_reflection_reports` expanded a `DescriptorLocation`'s `count` into `count` consecutive `(set, binding)` pairs, but a descriptor array occupies ONE binding holding `count` descriptors -- it maps to a single `VkDescriptorSetLayoutBinding`. The expansion let one array vouch for every binding above it: a runtime texture-handle array at 480 with a count of 128 "reported" the whole storage-texture band, so a module variable decorated anywhere in 480..608 satisfied a check reflection had never made. Nothing was masked -- the fixtures pass either way, and sweeping the same oracle over the 2880-source sample finds 0 modules with a decorated binding reflection omits -- but the assertion now means what its name says. --- tests/reflection_covers_declared_bindings.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/reflection_covers_declared_bindings.rs b/tests/reflection_covers_declared_bindings.rs index e2b1945e0..da576877a 100644 --- a/tests/reflection_covers_declared_bindings.rs +++ b/tests/reflection_covers_declared_bindings.rs @@ -69,14 +69,18 @@ fn bindings_the_module_declares(spirv: &[u8]) -> BTreeSet<(u32, u32)> { /// Every `(set, binding)` reflection reports, from all three places it carries one: ordinary /// resources, implicit imageblock attachment planes, and custom fragment imageblock members. +/// +/// A descriptor array occupies ONE binding holding `count` descriptors, not `count` consecutive +/// bindings -- `DescriptorLocation` maps to a single `VkDescriptorSetLayoutBinding`. Expanding the +/// count into a binding range would let one array silently vouch for every binding above it: a +/// runtime handle array at 480 with a count of 128 would "report" the whole storage-texture band, +/// so a module variable decorated anywhere in it would pass a check reflection never made. fn bindings_reflection_reports(reflection: &ShaderReflection) -> BTreeSet<(u32, u32)> { let set = reflection.descriptor_layout.set; let mut reported = BTreeSet::new(); for resource in &reflection.bindings { if let Some(location) = &resource.descriptor { - for index in 0..location.count { - reported.insert((location.set, location.binding + index)); - } + reported.insert((location.set, location.binding)); } } for attachment in &reflection.implicit_imageblock_attachments {