Files
metal2vulkan/tests
Anees Iqbal eaaf85abb0 Retract every descriptor the translator invented and nothing read
Two passes synthesize a resource with no Metal argument behind it, purely so an
AIR value has a legal SPIR-V type. `air.get_read_sampler()` gets an `OpTypeSampler`
because AIR threads a sampler pointer into the sampler-less `texture.read(coord)`;
`air.get_null_texture_*()` gets an `OpTypeImage` because a function-constant-gated
optional attachment still has to yield a handle. Either value can end up consumed
by nothing -- a phi that folds away, an `air.is_null_texture` that becomes a
constant -- and the descriptor then demands a resource the shader never reads,
which reflection cannot report because no Metal argument corresponds to it.

`cae8971` retracted the sampler. The rule was written over one named variable, so
the identical null-texture case kept shipping. It is now stated once, over
`Ctx::placeholder_descriptor_vars`: a third synthesized placeholder is covered by
registering it rather than by copying the pass.

The four sites that create a synthesized descriptor -- read sampler, null image,
implicit imageblock plane, custom fragment imageblock plane -- had four copies of
the same create-variable / decorate / add-to-interface block. They now share
`Ctx::descriptor_variable`, and the two placeholder callers go through
`Ctx::placeholder_descriptor`, which is what registers them for retraction.
Choosing the binding stays with each caller, since the ABI band is what actually
differs between them.

Measured over 2880 corpus sources: module-declared bindings reflection omits went
4 -> 1, and exactly 3 modules changed bytes -- each dropping one OpTypeImage, one
OpTypePointer, one OpVariable, its two descriptor decorations, and the unconsumed
OpLoad. spirv-val passes on all three. The remaining 1 is a placeholder image the
module genuinely reads, which needs reporting rather than retracting.

New authored fixture in `tests/reflection_covers_declared_bindings.rs`: a kernel
that asks `air.is_null_texture` about a placeholder and does nothing else with it.
Verified as a detector -- it fails at the parent commit, where the module declares
a texture binding reflection does not report.

`native_get_null_texture_models_unmodeled_placeholder` asserted that binding
exists. Its shader only stored the handle into an alloca nothing reads, which is
now the retraction case, so it moves to a kernel that queries the placeholder's
width -- a placeholder something DOES read keeps its descriptor -- and its
band claim is now checked against every Binding decoration rather than a substring.

Reflection output is byte-identical on all 2880 sources, so no REFLECTION_VERSION
bump: this removes a binding reflection never reported.

Gate: fmt, clippy -D warnings, warnings-denied all-features rustdoc, cargo test
-p metal2vulkan (debug and release), cargo test -p metal2vulkan-validation.
2026-08-31 23:18:07 +03:00
..
2026-07-22 13:15:24 +03:00