runtime: add a read-only shader-pack compatibility check #2417

Open
github-bot wants to merge 1 commit from github-bot/gh-2417 into main AGit
Owner

@⁠marcelofrayha on GitHub · 2026-11-27 02:17 UTC · original
marcelofrayha:rt-shader-pack-check → main · +441 −37 · 13 files · 1 commits · open

Claimed in the coordination issue as: RT-SHADER-PACK-CHECK

Depends on: none. There are textual conflicts with #1885 and #2192 in the builder/probe code; this change shares the existing driver rules without changing translation flag selection. It does not depend on the runtime fallback or pipeline-check PRs.

What and why

Add gta6rt --check-shader-pack [DIR] to catch mesh and barycentric mismatches before precompiling pipelines. It uses the same physical Vulkan adapter selection as --run with the Vulkan backend and reads only shader indexes. It does not open game files, create a logical Vulkan device, compile pipelines, or write caches.

The report distinguishes missing native GPU features, known driver issues (using the same rules as make_game.py), and translated fallbacks the runtime does not yet support. Unrecognized stages and unreadable optional indexes are reported without hiding blockers found in readable indexes. Exit codes: 0 no mismatch found, 1 blockers, 2 incomplete without known blockers.

Tested

  • Linux CTest: shader_library and shader_pack_check, including synthetic driver IDs, unknown stages, and malformed optional indexes.
  • Python: test_vk_subgroup_info.py and test_make_game_translator_flags.py (89 tests), test_text_write_line_endings.py, and make_game.py --help.
  • Windows cross-build and seven synthetic Wine CLI cases; expected diagnostics and exit codes, no logical device creation or runtime cache writes. No retail run or shader retranslation.

GPUs tested: AMD Radeon RX 5700 XT (RADV) and Lavapipe/llvmpipe (LLVM 21.1.8), both Mesa 26.0.8-1ubuntu0.3 on Linux under Wine 10.0. The affected Intel/AMD driver cases were tested with synthetic adapter data, not on affected hardware.

AI-assisted: yes.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • Translator contract update: not applicable; no new translator rule.
**@⁠marcelofrayha** on GitHub · 2026-11-27 02:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2417) `marcelofrayha:rt-shader-pack-check` → `main` · +441 −37 · 13 files · 1 commits · open Claimed in the coordination issue as: [RT-SHADER-PACK-CHECK](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) Depends on: none. There are textual conflicts with #1885 and #2192 in the builder/probe code; this change shares the existing driver rules without changing translation flag selection. It does not depend on the runtime fallback or pipeline-check PRs. ### What and why Add `gta6rt --check-shader-pack [DIR]` to catch mesh and barycentric mismatches before precompiling pipelines. It uses the same physical Vulkan adapter selection as `--run` with the Vulkan backend and reads only shader indexes. It does not open game files, create a logical Vulkan device, compile pipelines, or write caches. The report distinguishes missing native GPU features, known driver issues (using the same rules as `make_game.py`), and translated fallbacks the runtime does not yet support. Unrecognized stages and unreadable optional indexes are reported without hiding blockers found in readable indexes. Exit codes: `0` no mismatch found, `1` blockers, `2` incomplete without known blockers. ### Tested - Linux CTest: `shader_library` and `shader_pack_check`, including synthetic driver IDs, unknown stages, and malformed optional indexes. - Python: `test_vk_subgroup_info.py` and `test_make_game_translator_flags.py` (89 tests), `test_text_write_line_endings.py`, and `make_game.py --help`. - Windows cross-build and seven synthetic Wine CLI cases; expected diagnostics and exit codes, no logical device creation or runtime cache writes. No retail run or shader retranslation. GPUs tested: AMD Radeon RX 5700 XT (RADV) and Lavapipe/llvmpipe (LLVM 21.1.8), both Mesa 26.0.8-1ubuntu0.3 on Linux under Wine 10.0. The affected Intel/AMD driver cases were tested with synthetic adapter data, not on affected hardware. AI-assisted: yes. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [ ] Translator contract update: not applicable; no new translator rule.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:25:46 +00:00
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-27 02:48 UTC · original

Verified the CLI on native Windows 11, RTX 4090, NVIDIA 616.64 at 7f3892a4. I built gta6rt.exe with MSVC and used the translator's metadata for the hand-written ps_bary and ms_tri fixtures, each in native and fallback mode, with synthetic lookup hashes.

All nine CLI cases returned the expected code. The native pixel/mesh pair returned 0. The fallback pair returned 1 and reported both blockers even with an unreadable optional index. An incomplete pack, a missing main index, and an unmatched adapter filter returned 2. A non-ASCII directory worked through the positional argument, LEONIDA_SHADERS, and UTF-8 shader_path.txt. When those settings pointed at different packs, the explicit argument won over the environment, which won over the file.

I also checked the read-only behavior. With VK_LOADER_DEBUG=all, the checker logged vkCreateInstance only among the two creation calls. A separate small draw on the same loader logged both vkCreateInstance and vkCreateDevice. File names, sizes, and modification times in the pack and runtime scratch directories stayed unchanged during all nine checks. Both relevant CTests and all 89 Python tests passed. The checker only queried adapter capabilities. No game data or gameplay run was involved.

**@⁠ecox982745** on GitHub · 2026-11-27 02:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2417#issuecomment-7208458218) Verified the CLI on **native Windows 11, RTX 4090, NVIDIA 616.64** at `7f3892a4`. I built `gta6rt.exe` with MSVC and used the translator's metadata for the hand-written `ps_bary` and `ms_tri` fixtures, each in native and fallback mode, with synthetic lookup hashes. All nine CLI cases returned the expected code. The native pixel/mesh pair returned 0. The fallback pair returned 1 and reported both blockers even with an unreadable optional index. An incomplete pack, a missing main index, and an unmatched adapter filter returned 2. A non-ASCII directory worked through the positional argument, `LEONIDA_SHADERS`, and UTF-8 `shader_path.txt`. When those settings pointed at different packs, the explicit argument won over the environment, which won over the file. I also checked the read-only behavior. With `VK_LOADER_DEBUG=all`, the checker logged `vkCreateInstance` only among the two creation calls. A separate small draw on the same loader logged both `vkCreateInstance` and `vkCreateDevice`. File names, sizes, and modification times in the pack and runtime scratch directories stayed unchanged during all nine checks. Both relevant CTests and all 89 Python tests passed. The checker only queried adapter capabilities. No game data or gameplay run was involved.
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-27 05:53 UTC · original · approved these changes

Approving. Checked on 7f3892a43, which merges cleanly onto main.

Built shader_pack_check_test and gta6rt (clang-cl, cross-built). Under Wine on llvmpipe the ctest passes. I ran gta6rt --check-shader-pack on hand-made indexes (no game data): one ms entry, one ps entry that needs native barycentrics, one ps with bary_fallback_input and a vs. It reports llvmpipe as native mesh yes, barycentrics no, counts 1 + 1 blockers, exits 1. A pack with only a vs exits 0 ("no known mesh/barycentric mismatch"), a missing directory exits 2 ("cannot open ...index.json"), and two arguments print the usage. tests/test_vk_subgroup_info.py and tests/test_make_game_translator_flags.py: 89 passed.

Read the diff. The probe stops before the logical device, and OwnedRuntime has no destructor, so the explicit destroy_instance on the probe path is the only one (no double destroy). read_shader_index moving out of load_index keeps the BOM and object checks. The rules table is now one source for C++ and Python, and the gfx90c and ANV entries are the same IDs that were removed from vk_subgroup_info.py. I checked that nothing copies that script out of the tree, so reading runtime/src/shader_driver_rules.inc by relative path is safe. And main's runtime indeed reads neither mesh_compute nor bary_fallback_input, so "cannot replay" and "not implemented" are accurate today.

Two small things, not blockers. With a missing or unreadable directory it still probes the GPU before reporting the index error, and the device line prints after the error; reading the main index first would fail fast. And usage() returns 2, the same code as "incomplete check", so a script calling it with bad arguments can't tell the two apart.

**@⁠tiguan26** on GitHub · 2026-11-27 05:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2417#pullrequestreview-6084058535) · **approved these changes** Approving. Checked on 7f3892a43, which merges cleanly onto main. Built `shader_pack_check_test` and `gta6rt` (clang-cl, cross-built). Under Wine on llvmpipe the ctest passes. I ran `gta6rt --check-shader-pack` on hand-made indexes (no game data): one ms entry, one ps entry that needs native barycentrics, one ps with `bary_fallback_input` and a vs. It reports llvmpipe as native mesh yes, barycentrics no, counts 1 + 1 blockers, exits 1. A pack with only a vs exits 0 ("no known mesh/barycentric mismatch"), a missing directory exits 2 ("cannot open ...index.json"), and two arguments print the usage. `tests/test_vk_subgroup_info.py` and `tests/test_make_game_translator_flags.py`: 89 passed. Read the diff. The probe stops before the logical device, and `OwnedRuntime` has no destructor, so the explicit `destroy_instance` on the probe path is the only one (no double destroy). `read_shader_index` moving out of `load_index` keeps the BOM and object checks. The rules table is now one source for C++ and Python, and the gfx90c and ANV entries are the same IDs that were removed from `vk_subgroup_info.py`. I checked that nothing copies that script out of the tree, so reading `runtime/src/shader_driver_rules.inc` by relative path is safe. And main's runtime indeed reads neither `mesh_compute` nor `bary_fallback_input`, so "cannot replay" and "not implemented" are accurate today. Two small things, not blockers. With a missing or unreadable directory it still probes the GPU before reporting the index error, and the device line prints after the error; reading the main index first would fail fast. And `usage()` returns 2, the same code as "incomplete check", so a script calling it with bad arguments can't tell the two apart.
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/2417/head:github-bot/gh-2417'
git switch 'github-bot/gh-2417'

Merge

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