Files
metal2vulkan/tests
Anees Iqbal 9f0123eb41 Reject a member layout that reaches past its argument
AIR states a buffer argument's size (`air.arg_type_size`) and the member layout
inside it (`air.struct_type_info`) as two independent facts, and reflection
reconstructs them independently. When the reconstruction over-runs the declared
size, some member's storage was mistaken and every member after it names an
offset the shader never reads.

Nothing else catches that. A consumer packs its upload at the reported offsets,
so the disagreement is silent data corruption rather than anything a driver
reports, and the emitted SPIR-V does not settle it either -- a buffer whose
reconstruction is that far off is represented as raw bytes and declares no struct
type to compare against. `validate_descriptor_abi`, which both reflection paths
run, now rejects it, so the class that produced the previous commit becomes a
translation error rather than a number a consumer has to re-derive.

Reaching short stays valid: the declared size is a `sizeof` and carries tail
padding. Over 2880 corpus sources 1340 reported layouts legitimately stop short
and none over-run, so the gate rejects nothing that translates today.

The bound needs `air_metadata_extent`, not `air_metadata_size_align`. The latter
answers a different question -- the stride a pointee type needs -- and rounds to
alignment, which over-runs the declared size for 96 corpus buffers whose layout
is correct. It also inflates an array of `packed_half3` from six-byte to
eight-byte elements, since the memcpy rule floors array alignment at four,
whereas AIR states the per-element size in the member tuple itself.
2026-09-01 01:05:23 +03:00
..
2026-07-22 13:15:24 +03:00