Files
metal2vulkan/scripts/regen-vulkan-requirements
Anees Iqbal 13b279df1b Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since 43c46ac8 into a single commit. Its tree is
identical to the tree of private master at
b3c77f2d2b20a432be10591a2129547c10b1c24b.

- A Cargo workspace of five crates under crates/: metal2vulkan (the
  translator and the metal2vulkan command), metal2vulkan-runtime (the
  Metal API on Vulkan), metal2vulkan-air (the AIR front end),
  metal2vulkan-validation and metal2vulkan-devtools.
- Dual license: GPL-2.0-or-later OR LGPL-3.0-or-later.
- docs/: API, architecture, fast paths, how-to, Metal coverage,
  refusals, runtime porting and validation guides.

Private-Commit: b3c77f2d2b20a432be10591a2129547c10b1c24b
2026-10-11 20:09:13 +03:00
..

Vulkan requirement extraction

registry.py extracts SPIR-V capability and extension enablement alternatives from Vulkan-Headers vulkan-sdk-1.4.341.0/registry/vk.xml. It verifies the complete registry SHA-256 before processing it. Use --registry PATH with the same pinned file for offline operation.

python3 scripts/regen-vulkan-requirements/registry.py crates/metal2vulkan/src/spirv/requirements/registry_generated.rs
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/regen-vulkan-requirements

The generated table retains feature prerequisites, aliases, property predicates, and alternative routes without interpreting them as unconditional permission. Unknown XML rule forms, empty routes, and duplicate identities fail extraction.

The table is keyed and valued by name, and it is test-only: the core's requirement tests (crates/metal2vulkan/src/spirv/requirements/tests.rs) compare its own vocabulary against the registry. It spells features, extensions, and properties as the core's VkFeature, VkExtension, and VkProperty do (shaderInt64 -> ShaderInt64, VK_KHR_x -> KhrX). A feature alternative carries only the feature; its exposure routes are the union listed by feature_exposure. Declaration rules alone do not cover operation-specific storage classes, stage restrictions, resource limits, or host protocols; those need structural analysis.

The generated file's header carries the registry's copyright line and the MIT notice the table is used under (vk.xml is licensed Apache-2.0 OR MIT); a registry whose license no longer offers MIT fails generation.

Generation requires Python 3 and rustfmt.