runtime: -DLEONIDA_VULKAN_HEADERS_FETCH=ON uses the pinned Vulkan-Headers even when others are installed (CMAKE-VULKAN-HEADERS-PIN) #491

Open
github-bot wants to merge 5 commits from github-bot/gh-491 into main AGit
Owner

@⁠milk4sale on GitHub · 2026-11-24 06:17 UTC · original
milk4sale:claude/vulkan-headers-pin-0114f6 → main · +566 −16 · 6 files · 5 commits · open

Claimed in the coordination issue as: CMAKE-VULKAN-HEADERS-PIN (claim)

What and why

Mby159's finding (record in #431): runtime/CMakeLists.txt ran find_package(Vulkan QUIET) and the find_path(Vulkan_INCLUDE_DIR ...) fallback before the LEONIDA_VULKAN_HEADERS_FETCH / FETCHCONTENT_SOURCE_DIR_VULKANHEADERS branch. Any Vulkan headers on the machine (an SDK, conda-forge's vulkan-headers, /usr/include) therefore defined Vulkan::Headers first, and the pinned Khronos Vulkan-Headers 6802bb47 (vulkan-sdk-1.4.363.0, the same commit .github/workflows/runtime.yml checks out) were never used, even with -DLEONIDA_VULKAN_HEADERS_FETCH=ON. On a Radeon 780M this changed the GPU counts: against conda-forge's Vulkan 1.3 headers run_gpu_tests.py skipped ps_texoff, ps_texoff_forms and ps_texoff_implicit (225/248 passed instead of 228/248).

  • The fetch, or a local copy given with FETCHCONTENT_SOURCE_DIR_VULKANHEADERS, now runs before find_package(Vulkan). FindVulkan still runs afterwards, because it is what finds glslangValidator (Vulkan_GLSLANG_VALIDATOR_EXECUTABLE, used by the shader-building tests). It creates Vulkan::Headers only if(... NOT TARGET Vulkan::Headers), so the target is defined once. If the fetched project defines no Vulkan::Headers, the configure stops instead of quietly falling back to other headers. Without the flag nothing changes and nothing is downloaded.
  • Nothing else can stand in for the pin (Dezmonius's review): with -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS, FetchContent_MakeAvailable() used to try find_package(VulkanHeaders) first, so an installed VulkanHeadersConfig.cmake (VK_HEADER_VERSION 111) became Vulkan::Headers, nothing was downloaded, and the line still said "the pin". The declaration now carries OVERRIDE_FIND_PACKAGE, which stops that try. After FetchContent_MakeAvailable(), leonida_vulkan_headers_check fails the configure unless Vulkan::Headers is the copy FetchContent populated, which covers a dependency provider or an earlier FetchContent_Declare(VulkanHeaders). For the pin, the copy must also have VK_HEADER_VERSION LEONIDA_VULKAN_HEADERS_PIN_VERSION (363), which covers a stale copy that FETCHCONTENT_FULLY_DISCONNECTED=ON keeps after the pin changes.
  • The pinned commit is in one variable, LEONIDA_VULKAN_HEADERS_PIN, which the URL uses, and its VK_HEADER_VERSION in LEONIDA_VULKAN_HEADERS_PIN_VERSION. A test checks both against the two checkouts in runtime.yml (ref: <commit> # vulkan-sdk-1.4.363.0).
  • Every configure that has headers prints one line a GPU record can quote (runtime/cmake/vulkan_headers_report.cmake):
    -- Vulkan headers: <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1, hash-checked
    -- Vulkan headers: /usr/include (VK_HEADER_VERSION 363), found on this machine, not the pin (-DLEONIDA_VULKAN_HEADERS_FETCH=ON builds against the pinned Khronos Vulkan-Headers)
    
    A FETCHCONTENT_SOURCE_DIR_VULKANHEADERS copy is reported as such: a local copy that is not checked against the pin. With FETCHCONTENT_FULLY_DISCONNECTED=ON, FetchContent reuses the copy already in FETCHCONTENT_BASE_DIR and checks no archive. The version check still applies, but the line no longer says "hash-checked" (titoreinaldo's review):
    -- Vulkan headers: <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pinned version, cached source: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1; archive not checked in this configure (FETCHCONTENT_FULLY_DISCONNECTED=ON)
    
  • docs/testing.md (Build the test programs) and docs/gpu_test_results.md now say: for a result you will post, configure with -DLEONIDA_VULKAN_HEADERS_FETCH=ON and quote the Vulkan headers: line. They also note that older entries naming the flag may have used installed headers. runtime/README.md and the option's doc string no longer say the flag only applies "if no Vulkan headers are found".

The fetch stays opt-in rather than becoming the default: the configure downloads nothing unless asked.

#269 (Vulkan header version check for the Windows runtime) edits the same block. This PR doesn't build on it and stays out of its way: the two endif() lines and the if(TARGET Vulkan::Headers) line where #269 inserts its check are unchanged. git merge-tree of this branch with #269's head a2828eee is clean, and on the merged tree tests/test_cmake_vulkan_headers_version.py, tests/test_cmake_vulkan_headers_pin.py and tests/test_cmake_vulkan_missing.py all pass. If both land, #269's advice to pass the flag "with no other headers installed" can drop that qualifier.

Tested

CachyOS Linux (kernel 7.3.3), CMake 4.4.5 + Ninja, GCC 16.2.1, system Vulkan headers in /usr/include (VK_HEADER_VERSION 363):

  • tests/test_cmake_vulkan_headers_pin.py (new, 19 tests, 3.6 s): it configures runtime/ with a fake installed SDK on VULKAN_SDK (VK_HEADER_VERSION 231) and a fake local copy of the pinned project through FETCHCONTENT_SOURCE_DIR_VULKANHEADERS (363), with no network. A cmake_language(DEFER) hook reads the include directories Vulkan::Headers really carries. With FETCH=ON on a fresh build folder, and after turning FETCH on in a folder that already found (and cached) the SDK, the pin is used; turning it off again returns to the SDK. The cmake -P cases check the report line and the new check. On origin/main the first version of the file failed 9/9, and the configure case failed for the bug itself: Vulkan::Headers includes ['/tmp/.../sdk/include'], not /tmp/.../vulkan-headers/include.
  • The review's case, offline: a fake installed package (VulkanHeadersConfig.cmake, VK_HEADER_VERSION 111) on VulkanHeaders_DIR, -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS, no FETCHCONTENT_SOURCE_DIR_VULKANHEADERS, and a fake pin already in FETCHCONTENT_BASE_DIR with FETCHCONTENT_FULLY_DISCONNECTED=ON. The pin is used. There is also a dependency provider (CMAKE_PROJECT_TOP_LEVEL_INCLUDES) that answers with the package, and a stale copy at version 362; both now fail the configure. On the previous head c8ac7e4a the ALWAYS case fails with Vulkan::Headers includes ['/tmp/.../package/include'], not /tmp/.../deps/vulkanheaders-src/include, and the provider configure exits 0 while calling 111 the pin. The disconnected case also asserts the "cached source; archive not checked" wording and no "hash-checked"; on aea4da4c that assertion fails.
  • The review's exact command, with a real download: on c8ac7e4a it exits 0 with no _deps/ and prints .../pkg/include (VK_HEADER_VERSION 111), the pin: .... With this PR it downloads the pin and prints <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: ....
  • Real configures, with and without the flag: on main, -DLEONIDA_VULKAN_HEADERS_FETCH=ON creates no _deps/, caches Vulkan_INCLUDE_DIR=/usr/include, and vk_harness compiles with no -I. With this PR, compile_commands.json has vk_harness compiled with -I<build>/_deps/vulkanheaders-src/include while /usr/include is still found (Vulkan_INCLUDE_DIR and glslangValidator are cached as before). Without the flag it is /usr/include, as before.
  • ctest --test-dir <build> --output-on-failure (portable subset): 72 tests, 70 passed and 2 skipped (shader_library_corpus, vk_sync_validation), the same on main, on this PR without the flag, on this PR with the pin, and with the pin under -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS after the review fix. The GPU runs below predate the review fix, which leaves the headers of both those builds unchanged (the same -I paths).
  • python -I scripts/run_gpu_tests.py (VK_LOADER_DRIVERS_SELECT='*nvidia*', VK_LOADER_LAYERS_DISABLE='~implicit~'): main (system headers) gave 257/257 shaders translated and spirv-val valid, and 197/248 passed, 49 skipped, 2 failed. This PR built against the pin gave the same, with identical per-test statuses. The two failures are the known cs_imgload_tfe / cs_imgload_d16_tfe (the tfe status VGPR), and the skips are the wave64 fixtures plus the 16 "run by d3d12_*_test" cases, as in gpu-test-results/RTX4070Ti.txt. The system headers here are also 363, so no count difference was expected.
  • tests/test_docs_*.py, tests/test_cmake_*.py, tests/test_build_runtime_cmake.py, tests/test_text_write_line_endings.py, python -m compileall -q make_game.py tools tests, and scripts/check_no_game_data.py on every changed file: all OK.
  • Not run here: Windows (Visual Studio generator) and macOS. The new configure test passes -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DBUILD_TESTING=OFF and skips when CMake has no working C++ compiler.

GPUs tested: NVIDIA GeForce RTX 4070 Ti (AD104), NVIDIA 620.70.06 (proprietary), Vulkan 1.4.357, CachyOS Linux

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠milk4sale** on GitHub · 2026-11-24 06:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491) `milk4sale:claude/vulkan-headers-pin-0114f6` → `main` · +566 −16 · 6 files · 5 commits · open Claimed in the coordination issue as: CMAKE-VULKAN-HEADERS-PIN ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### What and why Mby159's [finding](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) (record in #431): `runtime/CMakeLists.txt` ran `find_package(Vulkan QUIET)` and the `find_path(Vulkan_INCLUDE_DIR ...)` fallback before the `LEONIDA_VULKAN_HEADERS_FETCH` / `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS` branch. Any Vulkan headers on the machine (an SDK, conda-forge's `vulkan-headers`, `/usr/include`) therefore defined `Vulkan::Headers` first, and the pinned Khronos Vulkan-Headers `6802bb47` (vulkan-sdk-1.4.363.0, the same commit `.github/workflows/runtime.yml` checks out) were never used, even with `-DLEONIDA_VULKAN_HEADERS_FETCH=ON`. On a Radeon 780M this changed the GPU counts: against conda-forge's Vulkan 1.3 headers `run_gpu_tests.py` skipped `ps_texoff`, `ps_texoff_forms` and `ps_texoff_implicit` (225/248 passed instead of 228/248). - The fetch, or a local copy given with `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS`, now runs **before** `find_package(Vulkan)`. FindVulkan still runs afterwards, because it is what finds `glslangValidator` (`Vulkan_GLSLANG_VALIDATOR_EXECUTABLE`, used by the shader-building tests). It creates `Vulkan::Headers` only `if(... NOT TARGET Vulkan::Headers)`, so the target is defined once. If the fetched project defines no `Vulkan::Headers`, the configure stops instead of quietly falling back to other headers. Without the flag nothing changes and nothing is downloaded. - Nothing else can stand in for the pin (Dezmonius's [review](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/491)): with `-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS`, `FetchContent_MakeAvailable()` used to try `find_package(VulkanHeaders)` first, so an installed `VulkanHeadersConfig.cmake` (VK_HEADER_VERSION 111) became `Vulkan::Headers`, nothing was downloaded, and the line still said "the pin". The declaration now carries `OVERRIDE_FIND_PACKAGE`, which stops that try. After `FetchContent_MakeAvailable()`, `leonida_vulkan_headers_check` fails the configure unless `Vulkan::Headers` is the copy FetchContent populated, which covers a dependency provider or an earlier `FetchContent_Declare(VulkanHeaders)`. For the pin, the copy must also have VK_HEADER_VERSION `LEONIDA_VULKAN_HEADERS_PIN_VERSION` (363), which covers a stale copy that `FETCHCONTENT_FULLY_DISCONNECTED=ON` keeps after the pin changes. - The pinned commit is in one variable, `LEONIDA_VULKAN_HEADERS_PIN`, which the URL uses, and its VK_HEADER_VERSION in `LEONIDA_VULKAN_HEADERS_PIN_VERSION`. A test checks both against the two checkouts in `runtime.yml` (`ref: <commit> # vulkan-sdk-1.4.363.0`). - Every configure that has headers prints one line a GPU record can quote (`runtime/cmake/vulkan_headers_report.cmake`): ``` -- Vulkan headers: <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1, hash-checked -- Vulkan headers: /usr/include (VK_HEADER_VERSION 363), found on this machine, not the pin (-DLEONIDA_VULKAN_HEADERS_FETCH=ON builds against the pinned Khronos Vulkan-Headers) ``` A `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS` copy is reported as such: a local copy that is not checked against the pin. With `FETCHCONTENT_FULLY_DISCONNECTED=ON`, FetchContent reuses the copy already in `FETCHCONTENT_BASE_DIR` and checks no archive. The version check still applies, but the line no longer says "hash-checked" (titoreinaldo's [review](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/491)): ``` -- Vulkan headers: <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pinned version, cached source: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1; archive not checked in this configure (FETCHCONTENT_FULLY_DISCONNECTED=ON) ``` - `docs/testing.md` (Build the test programs) and `docs/gpu_test_results.md` now say: for a result you will post, configure with `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` and quote the `Vulkan headers:` line. They also note that older entries naming the flag may have used installed headers. `runtime/README.md` and the option's doc string no longer say the flag only applies "if no Vulkan headers are found". The fetch stays opt-in rather than becoming the default: the configure downloads nothing unless asked. **#269** (Vulkan header version check for the Windows runtime) edits the same block. This PR doesn't build on it and stays out of its way: the two `endif()` lines and the `if(TARGET Vulkan::Headers)` line where #269 inserts its check are unchanged. `git merge-tree` of this branch with #269's head `a2828eee` is clean, and on the merged tree `tests/test_cmake_vulkan_headers_version.py`, `tests/test_cmake_vulkan_headers_pin.py` and `tests/test_cmake_vulkan_missing.py` all pass. If both land, #269's advice to pass the flag "with no other headers installed" can drop that qualifier. ### Tested CachyOS Linux (kernel 7.3.3), CMake 4.4.5 + Ninja, GCC 16.2.1, system Vulkan headers in `/usr/include` (VK_HEADER_VERSION 363): - `tests/test_cmake_vulkan_headers_pin.py` (new, 19 tests, 3.6 s): it configures `runtime/` with a fake installed SDK on `VULKAN_SDK` (VK_HEADER_VERSION 231) and a fake local copy of the pinned project through `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS` (363), with no network. A `cmake_language(DEFER)` hook reads the include directories `Vulkan::Headers` really carries. With FETCH=ON on a fresh build folder, and after turning FETCH on in a folder that already found (and cached) the SDK, the pin is used; turning it off again returns to the SDK. The `cmake -P` cases check the report line and the new check. On `origin/main` the first version of the file failed 9/9, and the configure case failed for the bug itself: `Vulkan::Headers includes ['/tmp/.../sdk/include'], not /tmp/.../vulkan-headers/include`. - The review's case, offline: a fake installed package (`VulkanHeadersConfig.cmake`, VK_HEADER_VERSION 111) on `VulkanHeaders_DIR`, `-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS`, no `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS`, and a fake pin already in `FETCHCONTENT_BASE_DIR` with `FETCHCONTENT_FULLY_DISCONNECTED=ON`. The pin is used. There is also a dependency provider (`CMAKE_PROJECT_TOP_LEVEL_INCLUDES`) that answers with the package, and a stale copy at version 362; both now fail the configure. On the previous head `c8ac7e4a` the ALWAYS case fails with `Vulkan::Headers includes ['/tmp/.../package/include'], not /tmp/.../deps/vulkanheaders-src/include`, and the provider configure exits 0 while calling 111 the pin. The disconnected case also asserts the "cached source; archive not checked" wording and no "hash-checked"; on `aea4da4c` that assertion fails. - The review's exact command, with a real download: on `c8ac7e4a` it exits 0 with no `_deps/` and prints `.../pkg/include (VK_HEADER_VERSION 111), the pin: ...`. With this PR it downloads the pin and prints `<build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: ...`. - Real configures, with and without the flag: on `main`, `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` creates no `_deps/`, caches `Vulkan_INCLUDE_DIR=/usr/include`, and `vk_harness` compiles with no `-I`. With this PR, `compile_commands.json` has `vk_harness` compiled with `-I<build>/_deps/vulkanheaders-src/include` while `/usr/include` is still found (`Vulkan_INCLUDE_DIR` and `glslangValidator` are cached as before). Without the flag it is `/usr/include`, as before. - `ctest --test-dir <build> --output-on-failure` (portable subset): 72 tests, 70 passed and 2 skipped (`shader_library_corpus`, `vk_sync_validation`), the same on `main`, on this PR without the flag, on this PR with the pin, and with the pin under `-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS` after the review fix. The GPU runs below predate the review fix, which leaves the headers of both those builds unchanged (the same `-I` paths). - `python -I scripts/run_gpu_tests.py` (`VK_LOADER_DRIVERS_SELECT='*nvidia*'`, `VK_LOADER_LAYERS_DISABLE='~implicit~'`): `main` (system headers) gave 257/257 shaders translated and spirv-val valid, and 197/248 passed, 49 skipped, 2 failed. This PR built against the pin gave the same, with identical per-test statuses. The two failures are the known `cs_imgload_tfe` / `cs_imgload_d16_tfe` (the tfe status VGPR), and the skips are the wave64 fixtures plus the 16 "run by d3d12_*_test" cases, as in `gpu-test-results/RTX4070Ti.txt`. The system headers here are also 363, so no count difference was expected. - `tests/test_docs_*.py`, `tests/test_cmake_*.py`, `tests/test_build_runtime_cmake.py`, `tests/test_text_write_line_endings.py`, `python -m compileall -q make_game.py tools tests`, and `scripts/check_no_game_data.py` on every changed file: all OK. - Not run here: Windows (Visual Studio generator) and macOS. The new configure test passes `-DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DBUILD_TESTING=OFF` and skips when CMake has no working C++ compiler. GPUs tested: NVIDIA GeForce RTX 4070 Ti (AD104), NVIDIA 620.70.06 (proprietary), Vulkan 1.4.357, CachyOS Linux AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
find_package(Vulkan) and the find_path(Vulkan_INCLUDE_DIR) fallback ran before the fetch branch, so any Vulkan
headers on the machine (an SDK, conda-forge's vulkan-headers, /usr/include) defined Vulkan::Headers first and the
pinned Khronos Vulkan-Headers 6802bb47 (vulkan-sdk-1.4.363.0) were never used, even with the flag on. Against
conda-forge's Vulkan 1.3 headers that cost a Radeon 780M three GPU tests (225/248 passed instead of 228/248).

The fetch, or a FETCHCONTENT_SOURCE_DIR_VULKANHEADERS copy, now runs first. FindVulkan still runs afterwards for
glslangValidator and leaves the existing Vulkan::Headers alone. The pinned commit is one variable the URL uses.

Every configure with headers prints one "-- Vulkan headers:" line with the include directory, VK_HEADER_VERSION and
whether they are the pin (runtime/cmake/vulkan_headers_report.cmake); docs/testing.md and docs/gpu_test_results.md
ask a GPU record to build with the pin and quote it.

tests/test_cmake_vulkan_headers_pin.py configures runtime/ with a fake SDK on VULKAN_SDK and a fake local copy of
the pin (no network) and checks the include directories Vulkan::Headers carries; it fails on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS, FetchContent_MakeAvailable(VulkanHeaders) tried
find_package(VulkanHeaders) first: an installed VulkanHeadersConfig.cmake (VK_HEADER_VERSION 111) became
Vulkan::Headers, nothing was downloaded, and the "Vulkan headers:" line still called it the pin.

- The declaration carries OVERRIDE_FIND_PACKAGE, so FetchContent never tries find_package() in place of
  the pin, and a later find_package(VulkanHeaders) gets the pin.
- After FetchContent_MakeAvailable, leonida_vulkan_headers_check fails the configure unless Vulkan::Headers
  is the copy FetchContent populated, which catches a dependency provider or an earlier
  FetchContent_Declare(VulkanHeaders). For the pin, the copy must also be VK_HEADER_VERSION
  LEONIDA_VULKAN_HEADERS_PIN_VERSION (363), which catches a stale copy kept by
  FETCHCONTENT_FULLY_DISCONNECTED=ON.
- tests/test_cmake_vulkan_headers_pin.py: offline configures for ALWAYS mode with an installed package
  (pre-seeded FETCHCONTENT_BASE_DIR, FULLY_DISCONNECTED), a dependency provider and a stale copy, cmake -P
  cases for the check, and the pin version against runtime.yml.

Reported by Dezmonius on #491.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With FETCHCONTENT_FULLY_DISCONNECTED=ON, FetchContent reuses the copy already in FETCHCONTENT_BASE_DIR and
checks no archive, but the "Vulkan headers:" line still said "hash-checked". The path and version checks
confirm what was selected, not that this configure checked an archive.

- A new origin, PIN_CACHED, is used when FETCHCONTENT_FULLY_DISCONNECTED is on and no
  FETCHCONTENT_SOURCE_DIR_VULKANHEADERS is given. The line reads "the pinned version, cached source:
  Khronos Vulkan-Headers <commit>; archive not checked in this configure
  (FETCHCONTENT_FULLY_DISCONNECTED=ON)". leonida_vulkan_headers_check still requires
  LEONIDA_VULKAN_HEADERS_PIN_VERSION for it.
- Each branch of the report builds its text with string(CONCAT) on quoted pieces, so the ";" survives.
- tests/test_cmake_vulkan_headers_pin.py: the disconnected-mode configure test asserts the wording and that
  "hash-checked" is gone, a cmake -P case checks the wording, and the version check runs for both pin
  origins (19 tests).

Reported by titoreinaldo on #491.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:03:57 +00:00
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 06:21 UTC · original

Independent Windows check at 13604ac with CMake 4.4.5 and Ninja. All nine tests in test_cmake_vulkan_headers_pin.py passed.

One configuration still silently uses installed headers with the fetch flag on. In a fresh build directory I ran:

cmake -S runtime -B build -G Ninja -DBUILD_TESTING=OFF -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DLEONIDA_VULKAN_HEADERS_FETCH=ON -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS -DVulkanHeaders_DIR=<installed-package-dir>

My synthetic installed package contains VulkanHeadersConfig.cmake defining the imported target Vulkan::Headers with an include directory whose vulkan_core.h sets VK_HEADER_VERSION 111. This uses the same package and target names as the Khronos install. Configure exited 0, never created build/_deps/vulkanheaders-src, and printed:

-- Vulkan headers: <installed-package-dir>/include (VK_HEADER_VERSION 111), the pin: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1, hash-checked

In CMake's ALWAYS mode, the implicit package lookup occurs inside FetchContent_MakeAvailable(), before the explicit find_package(Vulkan) in this PR. Could we ensure the pin branch cannot silently take that path, or fail configuration when the pinned source was not used? A test with the package config above and no FETCHCONTENT_SOURCE_DIR_VULKANHEADERS would cover the distinction.

Synthetic configure tests only. AI-assisted (Codex).

**@⁠Dezmonius** on GitHub · 2026-11-24 06:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7123846565) Independent Windows check at `13604ac` with CMake 4.4.5 and Ninja. All nine tests in `test_cmake_vulkan_headers_pin.py` passed. One configuration still silently uses installed headers with the fetch flag on. In a fresh build directory I ran: ```text cmake -S runtime -B build -G Ninja -DBUILD_TESTING=OFF -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DLEONIDA_VULKAN_HEADERS_FETCH=ON -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS -DVulkanHeaders_DIR=<installed-package-dir> ``` My synthetic installed package contains `VulkanHeadersConfig.cmake` defining the imported target `Vulkan::Headers` with an include directory whose `vulkan_core.h` sets `VK_HEADER_VERSION 111`. This uses the same package and target names as the Khronos install. Configure exited 0, never created `build/_deps/vulkanheaders-src`, and printed: ```text -- Vulkan headers: <installed-package-dir>/include (VK_HEADER_VERSION 111), the pin: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1, hash-checked ``` In [CMake's ALWAYS mode](https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE), the implicit package lookup occurs inside `FetchContent_MakeAvailable()`, before the explicit `find_package(Vulkan)` in this PR. Could we ensure the pin branch cannot silently take that path, or fail configuration when the pinned source was not used? A test with the package config above and no `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS` would cover the distinction. Synthetic configure tests only. AI-assisted (Codex).
Author
Owner

@⁠Okachamie on GitHub · 2026-11-24 15:30 UTC · original

Ty for the fix. I independently checked c8ac7e4a76264f106daf114871a3cd2f89520864 on CachyOS with CMake 4.5.1, Ninja 1.13.2, and GCC 16.2.1.

I configured fresh build directories with cmake -S runtime -B <build> -G Ninja -DBUILD_TESTING=OFF -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON, then ran cmake --build <build> --target vk_harness --parallel 2. Ninja’s compiler dependencies showed which headers each build used.

  • Default used /usr/include/vulkan/vulkan_core.h and fetched nothing.
  • -DLEONIDA_VULKAN_HEADERS_FETCH=ON used <build>/_deps/vulkanheaders-src/include/vulkan/vulkan_core.h. The archive’s SHA-256 matched the declared hash for Khronos revision 6802bb4733b63ed5efd3adb308a6c885ef180ea1. Both configurations used header version 363 and still found /usr/bin/glslangValidator.
  • Pre-fix baseline at 8f481cf16f261c7f37458aeb45e8f4e19994146d used /usr/include/vulkan/vulkan_core.h even with fetch enabled.

I also confirmed Dezmonius’s FETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS finding with CachyOS’s installed package. With both flags enabled, CMake resolved /usr/share/cmake/VulkanHeaders, built against /usr/include/vulkan/vulkan_core.h, and printed “hash-checked” without fetching the archive.

All nine tests in python -I tests/test_cmake_vulkan_headers_pin.py passed. Game-free Linux configure and build checks only. AI-assisted (Codex).

**@⁠Okachamie** on GitHub · 2026-11-24 15:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7136152904) Ty for the fix. I independently checked `c8ac7e4a76264f106daf114871a3cd2f89520864` on CachyOS with CMake 4.5.1, Ninja 1.13.2, and GCC 16.2.1. I configured fresh build directories with `cmake -S runtime -B <build> -G Ninja -DBUILD_TESTING=OFF -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON`, then ran `cmake --build <build> --target vk_harness --parallel 2`. Ninja’s compiler dependencies showed which headers each build used. - **Default** used `/usr/include/vulkan/vulkan_core.h` and fetched nothing. - **`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`** used `<build>/_deps/vulkanheaders-src/include/vulkan/vulkan_core.h`. The archive’s SHA-256 matched the declared hash for Khronos revision `6802bb4733b63ed5efd3adb308a6c885ef180ea1`. Both configurations used header version 363 and still found `/usr/bin/glslangValidator`. - **Pre-fix baseline** at `8f481cf16f261c7f37458aeb45e8f4e19994146d` used `/usr/include/vulkan/vulkan_core.h` even with fetch enabled. I also confirmed Dezmonius’s `FETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS` finding with CachyOS’s installed package. With both flags enabled, CMake resolved `/usr/share/cmake/VulkanHeaders`, built against `/usr/include/vulkan/vulkan_core.h`, and printed “hash-checked” without fetching the archive. All nine tests in `python -I tests/test_cmake_vulkan_headers_pin.py` passed. Game-free Linux configure and build checks only. AI-assisted (Codex).
Author
Owner

@⁠milk4sale on GitHub · 2026-11-24 15:36 UTC · original

Thanks, reproduced. At c8ac7e4a (the rebase of 13604ac), your command with a VulkanHeadersConfig.cmake at VK_HEADER_VERSION 111 exits 0, creates no _deps/, and the line calls those headers the pin. Fixed in aea4da4c:

  • FetchContent_Declare(VulkanHeaders ...) now carries OVERRIDE_FIND_PACKAGE, so FetchContent_MakeAvailable() doesn't try find_package(VulkanHeaders) in place of the pin, even in ALWAYS mode. Your command now downloads the pin and prints <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: ....

  • After FetchContent_MakeAvailable(), the configure fails unless Vulkan::Headers is the copy FetchContent populated. That covers what OVERRIDE_FIND_PACKAGE can't stop: a dependency provider, or an earlier FetchContent_Declare(VulkanHeaders). For the pin, the copy must also have VK_HEADER_VERSION 363 (LEONIDA_VULKAN_HEADERS_PIN_VERSION, tested against runtime.yml). That catches a stale copy that FETCHCONTENT_FULLY_DISCONNECTED=ON keeps after the pin changes.

  • Tests in tests/test_cmake_vulkan_headers_pin.py:

    • Your case: the package config on VulkanHeaders_DIR, ALWAYS, and no FETCHCONTENT_SOURCE_DIR_VULKANHEADERS. It stays offline by pre-seeding FETCHCONTENT_BASE_DIR with a fake pin and setting FETCHCONTENT_FULLY_DISCONNECTED=ON.
    • A dependency provider that answers with the package.
    • A stale copy.
    • cmake -P cases for the check.

    On c8ac7e4a, the ALWAYS case fails (Vulkan::Headers includes ['.../package/include']), and the provider configure exits 0 while calling 111 the pin.

Tested on Linux only (CMake 4.4.5, Ninja); Windows and macOS are left to CI. AI-assisted (Claude Code).

**@⁠milk4sale** on GitHub · 2026-11-24 15:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7136307535) Thanks, reproduced. At `c8ac7e4a` (the rebase of `13604ac`), your command with a `VulkanHeadersConfig.cmake` at VK_HEADER_VERSION 111 exits 0, creates no `_deps/`, and the line calls those headers the pin. Fixed in aea4da4c: - `FetchContent_Declare(VulkanHeaders ...)` now carries `OVERRIDE_FIND_PACKAGE`, so `FetchContent_MakeAvailable()` doesn't try `find_package(VulkanHeaders)` in place of the pin, even in `ALWAYS` mode. Your command now downloads the pin and prints `<build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pin: ...`. - After `FetchContent_MakeAvailable()`, the configure fails unless `Vulkan::Headers` is the copy FetchContent populated. That covers what `OVERRIDE_FIND_PACKAGE` can't stop: a dependency provider, or an earlier `FetchContent_Declare(VulkanHeaders)`. For the pin, the copy must also have VK_HEADER_VERSION 363 (`LEONIDA_VULKAN_HEADERS_PIN_VERSION`, tested against `runtime.yml`). That catches a stale copy that `FETCHCONTENT_FULLY_DISCONNECTED=ON` keeps after the pin changes. - Tests in `tests/test_cmake_vulkan_headers_pin.py`: - Your case: the package config on `VulkanHeaders_DIR`, `ALWAYS`, and no `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS`. It stays offline by pre-seeding `FETCHCONTENT_BASE_DIR` with a fake pin and setting `FETCHCONTENT_FULLY_DISCONNECTED=ON`. - A dependency provider that answers with the package. - A stale copy. - `cmake -P` cases for the check. On `c8ac7e4a`, the `ALWAYS` case fails (`Vulkan::Headers includes ['.../package/include']`), and the provider configure exits 0 while calling 111 the pin. Tested on Linux only (CMake 4.4.5, Ninja); Windows and macOS are left to CI. AI-assisted (Claude Code).
Author
Owner

@⁠milk4sale on GitHub · 2026-11-24 15:38 UTC · original

@⁠Okachamie thanks for the independent check. aea4da4c, now the head of this PR, covers the FETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS case that you and Dezmonius confirmed. FetchContent_Declare(VulkanHeaders ...) now carries OVERRIDE_FIND_PACKAGE, so the installed package is never tried. The configure also fails unless Vulkan::Headers is the downloaded copy at VK_HEADER_VERSION 363.

I re-ran your command at aea4da4c with -DLEONIDA_VULKAN_HEADERS_FETCH=ON -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS, on CachyOS with CMake 4.4.5 and /usr/share/cmake/VulkanHeaders installed. The configure reports <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363). Ninja's deps for vk_harness show <build>/_deps/vulkanheaders-src/include/vulkan/vulkan_core.h, not /usr/include.

Game-free configure and build only. AI-assisted.

**@⁠milk4sale** on GitHub · 2026-11-24 15:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7136371547) @⁠Okachamie thanks for the independent check. `aea4da4c`, now the head of this PR, covers the `FETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS` case that you and Dezmonius confirmed. `FetchContent_Declare(VulkanHeaders ...)` now carries `OVERRIDE_FIND_PACKAGE`, so the installed package is never tried. The configure also fails unless `Vulkan::Headers` is the downloaded copy at `VK_HEADER_VERSION` 363. I re-ran your command at `aea4da4c` with `-DLEONIDA_VULKAN_HEADERS_FETCH=ON -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS`, on CachyOS with CMake 4.4.5 and `/usr/share/cmake/VulkanHeaders` installed. The configure reports `<build>/_deps/vulkanheaders-src/include` (VK_HEADER_VERSION 363). Ninja's deps for `vk_harness` show `<build>/_deps/vulkanheaders-src/include/vulkan/vulkan_core.h`, not `/usr/include`. Game-free configure and build only. AI-assisted.
Author
Owner

@⁠milk4sale on GitHub · 2026-11-24 20:18 UTC · original

The red windows and linux-gpu-tools jobs come from main as it was when this run was created, not from this change. Their checkout step says Merge aea4da4ca into a28927849, and a28927849 is older than two fixes:

  • windows: linking gta6rt.exe fails with __imp_WaitOnAddress, __imp_WakeByAddressSingle and __imp_WakeByAddressAll unresolved in leonida_xma2_decoder.lib. #877 (merged 16:58 UTC) adds synchronization to that library's link libraries.
  • linux-gpu-tools: cs_imgload_tfe and cs_imgload_d16_tfe fail (r32 sint (sint view): 64 bad, texel(5,3) = 2071). #892 (merged 17:15 UTC) corrected those two fixtures' expected TFE status.

#877 and this pull request both change runtime/CMakeLists.txt, in different places: #877 the decoder's link libraries near line 129, this one the Vulkan-Headers setup near line 1368. The branch merges into current main (58be9cdf8) without conflict; I haven't built that merge on Windows. Re-running the failed jobs would test the same old merge, so I'm not pushing just to restart CI. I haven't found a finished run of these jobs on a main that has both fixes yet.

AI-assisted.

**@⁠milk4sale** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7143346527) The red `windows` and `linux-gpu-tools` jobs come from `main` as it was when this run was created, not from this change. Their checkout step says `Merge aea4da4ca into a28927849`, and `a28927849` is older than two fixes: - `windows`: linking `gta6rt.exe` fails with `__imp_WaitOnAddress`, `__imp_WakeByAddressSingle` and `__imp_WakeByAddressAll` unresolved in `leonida_xma2_decoder.lib`. #877 (merged 16:58 UTC) adds `synchronization` to that library's link libraries. - `linux-gpu-tools`: `cs_imgload_tfe` and `cs_imgload_d16_tfe` fail (`r32 sint (sint view): 64 bad, texel(5,3) = 2071`). #892 (merged 17:15 UTC) corrected those two fixtures' expected TFE status. #877 and this pull request both change `runtime/CMakeLists.txt`, in different places: #877 the decoder's link libraries near line 129, this one the Vulkan-Headers setup near line 1368. The branch merges into current `main` (`58be9cdf8`) without conflict; I haven't built that merge on Windows. Re-running the failed jobs would test the same old merge, so I'm not pushing just to restart CI. I haven't found a finished run of these jobs on a `main` that has both fixes yet. AI-assisted.
Author
Owner

@⁠titoreinaldo on GitHub · 2026-11-24 20:44 UTC · original

Independent Linux check at aea4da4c: all 18 tests in python -I tests/test_cmake_vulkan_headers_pin.py passed with CMake 3.24.3 and GCC 14.2. With FETCHCONTENT_FULLY_DISCONNECTED=ON, the existing fixture selects the preseeded version-363 headers, with no archive under _deps, but configure reports “hash-checked.” The version and path checks confirm what was selected, not that this configure checked an archive. Could disconnected mode report “pinned version, cached source; archive not checked in this configure” and assert that wording in the existing test? A local patch with that distinction passed all 18 tests again. No GPU or game data; AI-assisted.

**@⁠titoreinaldo** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7144002550) Independent Linux check at `aea4da4c`: all 18 tests in `python -I tests/test_cmake_vulkan_headers_pin.py` passed with CMake 3.24.3 and GCC 14.2. With `FETCHCONTENT_FULLY_DISCONNECTED=ON`, the existing fixture selects the preseeded version-363 headers, with no archive under `_deps`, but configure reports “hash-checked.” The version and path checks confirm what was selected, not that this configure checked an archive. Could disconnected mode report “pinned version, cached source; archive not checked in this configure” and assert that wording in the existing test? A local patch with that distinction passed all 18 tests again. No GPU or game data; AI-assisted.
Author
Owner

@⁠milk4sale on GitHub · 2026-11-24 21:15 UTC · original

@⁠titoreinaldo agreed. The version and path checks show what was selected, not that this configure checked an archive. Fixed in b7c9afd7. With FETCHCONTENT_FULLY_DISCONNECTED=ON, the line now reads:

-- Vulkan headers: <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pinned version, cached source: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1; archive not checked in this configure (FETCHCONTENT_FULLY_DISCONNECTED=ON)
  • runtime/CMakeLists.txt picks a separate origin, PIN_CACHED, when FETCHCONTENT_FULLY_DISCONNECTED is on and no FETCHCONTENT_SOURCE_DIR_VULKANHEADERS is given. leonida_vulkan_headers_check still requires VK_HEADER_VERSION 363 for it, so a stale copy still fails the configure. "hash-checked" now appears only when FetchContent manages the download.

  • tests/test_cmake_vulkan_headers_pin.py:

    • The existing disconnected-mode configure test (test_always_mode_does_not_swap_in_an_installed_package) asserts the new wording and that "hash-checked" is absent.
    • A cmake -P case checks the same wording.
    • The version-check case runs for both origins.

    19 tests, all passing. On aea4da4c the three new assertions fail.

With the real download already in a build folder, reconfiguring with -DFETCHCONTENT_FULLY_DISCONNECTED=ON prints the line above, and =OFF prints ..., the pin: Khronos Vulkan-Headers 6802bb47..., hash-checked again. Linux only (CMake 4.4.5, Ninja). AI-assisted (Claude Code).

**@⁠milk4sale** on GitHub · 2026-11-24 21:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/491#issuecomment-7144697878) @⁠titoreinaldo agreed. The version and path checks show what was selected, not that this configure checked an archive. Fixed in b7c9afd7. With `FETCHCONTENT_FULLY_DISCONNECTED=ON`, the line now reads: ```text -- Vulkan headers: <build>/_deps/vulkanheaders-src/include (VK_HEADER_VERSION 363), the pinned version, cached source: Khronos Vulkan-Headers 6802bb4733b63ed5efd3adb308a6c885ef180ea1; archive not checked in this configure (FETCHCONTENT_FULLY_DISCONNECTED=ON) ``` - `runtime/CMakeLists.txt` picks a separate origin, `PIN_CACHED`, when `FETCHCONTENT_FULLY_DISCONNECTED` is on and no `FETCHCONTENT_SOURCE_DIR_VULKANHEADERS` is given. `leonida_vulkan_headers_check` still requires VK_HEADER_VERSION 363 for it, so a stale copy still fails the configure. "hash-checked" now appears only when FetchContent manages the download. - `tests/test_cmake_vulkan_headers_pin.py`: - The existing disconnected-mode configure test (`test_always_mode_does_not_swap_in_an_installed_package`) asserts the new wording and that "hash-checked" is absent. - A `cmake -P` case checks the same wording. - The version-check case runs for both origins. 19 tests, all passing. On `aea4da4c` the three new assertions fail. With the real download already in a build folder, reconfiguring with `-DFETCHCONTENT_FULLY_DISCONNECTED=ON` prints the line above, and `=OFF` prints `..., the pin: Khronos Vulkan-Headers 6802bb47..., hash-checked` again. Linux only (CMake 4.4.5, Ninja). AI-assisted (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/491/head:github-bot/gh-491'
git switch 'github-bot/gh-491'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-491'
git switch 'github-bot/gh-491'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-491'
git switch 'github-bot/gh-491'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-491'
git switch 'main'
git merge --squash 'github-bot/gh-491'
git switch 'main'
git merge --ff-only 'github-bot/gh-491'
git switch 'main'
git merge 'github-bot/gh-491'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.