Files
metal2vulkan/docs
Anees Iqbal f34c4a22d2 rt: every memory allocation counts against the device's maxMemoryAllocationCount, refused before the driver past it
rt never counted its vkAllocateMemory calls, so it could pass the device's
maxMemoryAllocationCount, which VUID-vkAllocateMemory-maxMemoryAllocationCount-04101
forbids: blocks, each texture's own memory, each staging buffer of replace_region
and get_bytes, the parameter ring's blocks and the zero source.

Every allocation now goes through memory::allocate, the one vkAllocateMemory call.
The live count is the blocks gauge, which already counted exactly these
allocations: allocate raises it only while it is below the device's count, else
returns Limit::MemoryAllocations { max } without calling the driver, and gives the
count back where the driver fails. Each site's own rise of the gauge after its
allocation is gone; the texture's and the staging buffer's failure paths after the
allocation now lower it as they free it.

Device::new is Device::open with the device's limits as queried; a test opens a
device with maxMemoryAllocationCount answered as 8. With the zero source and the
two ready blocks live, five 4x4 textures are made and the sixth is refused with the
typed limit, the gauges unchanged; a replace_region then is refused the same way
for its staging buffer; once a texture is dropped and its memory freed, a texture
is made again; every gauge reads zero after teardown.

The Err docs of Device::new, take_block, new_texture, replace_region (get_bytes
takes its list), set_bytes and the dispatches name the limit, and the runtime's
README states what counts and the limits measured: about 4.29 billion on RADV,
NVIDIA's Linux driver and ANV, 8,401,685 on Intel's Windows driver for the UHD
Graphics 630, 4,096 at Vulkan's minimum. docs/REFUSALS.md and the API signature
table are regenerated for the new Limit variant.
2026-11-17 17:43:57 -08:00
..