feat(khronos.vulkan-hpp): Vulkan-Hpp 1.4.357.0, the module Khronos already ships - #369
Merged
Conversation
…ready ships
The index carried the Vulkan loader and the C headers, and nothing that could
answer `import vulkan;`. This adds the package that can, and it authors no
wrapper at all — because there was never anything to author.
Khronos generates the C++ bindings in KhronosGroup/Vulkan-Hpp and RELEASES
them, already generated, inside every Vulkan-Headers tag. The two module
interface units have been sitting in the tarball `compat.vulkan-headers`
downloads all along — exposed through `include/`, compiled by nobody:
include/vulkan/vulkan.cppm export module vulkan;
include/vulkan/vulkan_video.cppm export module vulkan_video;
So this is the first package here to take shape C's FIRST branch ("upstream
already ships a `.cppm`, point straight at it"). Every other module package in
this index synthesizes a wrapper, and every one of them can lose a name
silently when upstream moves. This one cannot: the export surface is Khronos'
own generated code.
The payload is deliberately the SAME tarball, URL and sha256 as
`compat.vulkan-headers`. Pointing at the Vulkan-Hpp repository instead is worse
in three measured ways: it has no `vulkan-sdk-*` tag at all (404 — its tags are
`v1.4.357`, a different numbering from the SDK line the rest of the Vulkan
packages are keyed on); Vulkan-Headers is a git submodule there and a GitHub
archive never contains submodules; and the second copy that would then be
needed puts two `vulkan/` include roots on the path, each holding a
`vulkan.hpp`, with `-I` order deciding the winner. One tarball makes the pair
impossible to skew, and self-checking rather than merely intended — the module
unit opens with `VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == 357 )`, so a
half-done version bump fails to compile.
Three decisions worth stating, since none is a preference:
* `khronos`, not `compat`. In this index the namespace is the consumption
contract: `compat.*` means `#include`, an owning namespace promises
`import`. The MODULE names stay upstream's `vulkan` / `vulkan_video`,
never `khronos.vulkan` — the interface owner has already spoken, and an
adapter that renamed it would make every Vulkan-Hpp tutorial wrong for
mcpp users.
* `import_std = true`. Line 27 of `vulkan.cppm` is an unconditional
`export import std;`; upstream gates its whole module target on
`23 IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD` for the same reason.
* The dependency is the LOADER, not just the headers. Vulkan-Hpp defaults to
the static dispatcher (`VULKAN_HPP_DISPATCH_LOADER_DYNAMIC` is 0 without
`VK_NO_PROTOTYPES`), so `vk::enumerateInstanceVersion()` compiles into a
direct call to `vkEnumerateInstanceVersion`. Headers alone would give a
package that compiles and then fails at every consumer's link.
No `VK_USE_PLATFORM_*`, exactly like upstream's `Vulkan-HppModule` target:
those defines are mutually exclusive per platform and cannot become a portable
feature, and the portable route needs none of them — GLFW and SDL2 hand back a
`VkSurfaceKHR` that a consumer wraps as `vk::SurfaceKHR{ raw }`. Surface and
swapchain are in the module unconditionally; only the platform-specific
CREATION calls are not.
New workspace member `tests/examples/vulkan-hpp-module`, two tests. module.cpp
has no `#include` anywhere in it and asserts enumerator VALUES, the generated
`sType` defaults, the constexpr format traits, the RAII layer's compile-time
members, and two real loader calls through the static dispatcher (the link-time
proof that the loader dependency reaches a consumer). video.cpp exists for the
second unit alone: it says `import vulkan;`, so it can only be compiled after
the first, out of a `sources` list that is just a list — it is the only thing
that fails if that ordering ever stops working.
Verified: linux gcc 16.1.0 and linux llvm 22.1.8 both build both units (two
BMIs / two PCMs) and pass. macOS and Windows take the same clang path as the
llvm leg, and their runtime half is already green through
`tests/examples/vulkan`, which reaches the very same loader entry points on all
three legs.
`x86_64-windows-gnu` (mingw) does NOT work and is documented in the descriptor
so nobody re-derives it — it is not a CI leg (the index's windows toolchain is
llvm/MSVC ABI). GCC-on-PE emits the module-attached function-local static
`vk::errorCategory@vulkan()::instance` into plain `.bss` in the consumer object
while the module object has it in a COMDAT, and the link dies with `multiple
definition`; separately, `compat.vulkan`'s windows entry is an MSVC-style
`vulkan-1.lib` mingw's ld does not find. Neither is fixable from a descriptor.
`compat.vulkan-headers` gains the other half of that story: the tarball also
carries Vulkan-Hpp, this package builds it, and a version bump has to move both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The index carried the Vulkan loader (
compat.vulkan) and the C headers(
compat.vulkan-headers), and nothing that could answerimport vulkan;.This adds the package that can — and it authors no wrapper at all, because
there was never anything to author.
Khronos generates the C++ bindings in KhronosGroup/Vulkan-Hpp and releases
them, already generated, inside every Vulkan-Headers tag. The two module
interface units have been sitting in the tarball
compat.vulkan-headersalready downloads — exposed through
include/, compiled by nobody:So this is the first package here to take shape C's first branch —
upstream already ships a
.cppm, point straight at it. Every other modulepackage in this index synthesizes a wrapper, and every one of them can lose a
name silently when upstream moves. This one cannot: the export surface is
Khronos' own generated code.
Why the payload says Vulkan-Headers
Same tarball, URL and sha256 as
compat.vulkan-headers, deliberately.Pointing at the Vulkan-Hpp repository instead is worse in three measured ways:
vulkan-sdk-*tag at all (that URL 404s — its tags arev1.4.357,a different numbering from the SDK line the other Vulkan packages are keyed on);
contains submodules;
vulkan/include roots onthe path, each holding a
vulkan.hpp, with-Iorder deciding the winner.One tarball makes the pair impossible to skew — and self-checking rather than
merely intended: the module unit opens with
VULKAN_HPP_STATIC_ASSERT( VK_HEADER_VERSION == 357 ), so a half-done versionbump fails to compile instead of shipping a mismatched pair.
Three decisions, none of them a preference
khronos, notcompat. In this index the namespace is the consumptioncontract:
compat.*means#include, an owning namespace promisesimport.The module names stay upstream's
vulkan/vulkan_video, neverkhronos.vulkan— the interface owner has already spoken, and renaming wouldmake every Vulkan-Hpp tutorial wrong for mcpp users.
import_std = true. Line 27 ofvulkan.cppmis an unconditionalexport import std;; upstream gates its whole module target on23 IN_LIST CMAKE_CXX_COMPILER_IMPORT_STDfor the same reason.the static dispatcher (
VULKAN_HPP_DISPATCH_LOADER_DYNAMICis 0 withoutVK_NO_PROTOTYPES), sovk::enumerateInstanceVersion()compiles into a directcall to
vkEnumerateInstanceVersion. Headers alone would give a package thatcompiles and then fails at every consumer's link.
No
VK_USE_PLATFORM_*, exactly like upstream'sVulkan-HppModuletarget:those defines are mutually exclusive per platform and cannot become a portable
feature, and the portable route needs none of them — GLFW and SDL2 hand back a
VkSurfaceKHRa consumer wraps asvk::SurfaceKHR{ raw }. Surface andswapchain are in the module unconditionally; only the platform-specific
creation calls are not.
Tests
New workspace member
tests/examples/vulkan-hpp-module:module.cpphas no#includeanywhere in it. Asserts enumerator VALUES, thegenerated
sTypedefaults, the constexpr format traits, the RAII layer'scompile-time members, and two real loader calls through the static dispatcher
— the link-time proof that the loader dependency reaches a consumer.
video.cppexists for the second unit alone: it saysimport vulkan;, so itcan only be compiled after the first, out of a
sourceslist that is just alist. It is the only thing that fails if that ordering stops working.
Verified
macOS and Windows take the same clang path as the llvm leg, and their runtime
half is already green through
tests/examples/vulkan, which reaches the verysame loader entry points on all three legs.
x86_64-windows-gnu(mingw) does not work and is documented in thedescriptor so nobody re-derives it — it is not a CI leg (the index's windows
toolchain is llvm/MSVC ABI). GCC-on-PE emits the module-attached function-local
static
vk::errorCategory@vulkan()::instanceinto plain.bssin the consumerobject while the module object has it in a COMDAT, and the link dies with
multiple definition; separately,compat.vulkan's windows entry is anMSVC-style
vulkan-1.libthat mingw's ld does not find. Neither is fixable froma descriptor.
compat.vulkan-headersgains the other half of that story: the tarball alsocarries Vulkan-Hpp, this package builds it, and a version bump has to move both.