# dragiyski-vulkan-binding Python bindings for the [Vulkan](https://www.vulkan.org/) graphics and compute API, generated on-demand from the official [Vulkan XML registry](https://github.com/KhronosGroup/Vulkan-Docs). ## Overview The binding is *lazy*: the module structure is set up at import time, but individual symbols (types, constants, functions, macros) are resolved and bound only when first accessed. This keeps startup overhead minimal regardless of how large the registry is. Bindings are derived from `dragiyski-vulkan-registry`, which parses the official Vulkan XML registry and exposes its taxonomy. The binding layer translates that taxonomy into Python-callable objects backed by `ctypes`, including: - **Macros** — version utility macros such as `VK_MAKE_VERSION`, `VK_MAKE_API_VERSION`, and their corresponding accessors, exposed as plain Python callables with matching signatures. - **Constants** — scalar values such as `VK_HEADER_VERSION`, exposed as Python `int` or `float`. - **Types** — Vulkan structs, unions, handles, and enums, mapped to `ctypes` equivalents. - **Commands** — Vulkan API commands, loadable via the standard `vkGetInstanceProcAddr` / `vkGetDeviceProcAddr` mechanism. - **Callbacks** — Vulkan callback function pointer types, wrapped as `ctypes.CFUNCTYPE` factories. ## Requirements - Python 3.12 or later - [`pycparser`](https://github.com/eliben/pycparser) ≥ 2.23 - [`dragiyski-vulkan-registry`](https://git.dragiyski.org/dragiyski/vulkan-registry) ## Installation ```bash pip install dragiyski-vulkan-binding ``` ## Usage ```python import ctypes import dragiyski.vulkan.binding as vulkan version = vulkan.VK_MAKE_API_VERSION(0, 1, 3, 0) print(vulkan.VK_HEADER_VERSION) vulkan_version = ctypes.c_uint32() vulkan.vkEnumerateInstanceVersion(ctypes.byref(vulkan_version)) print('.'.join([ str(vulkan.VK_API_VERSION_MAJOR(vulkan_version.value)), str(vulkan.VK_API_VERSION_MINOR(vulkan_version.value)), str(vulkan.VK_API_VERSION_PATCH(vulkan_version.value)), ])) ``` Symbols are resolved lazily on first attribute access, so importing the module itself is fast.