make_game, vk_subgroup_info: auto-enable --bary-fallback without VK_KHR_fragment_shader_barycentric #2192

Open
github-bot wants to merge 2 commits from github-bot/gh-2192 into main AGit
Owner

@⁠robot00f on GitHub · 2026-11-26 04:44 UTC · original
robot00f:feat/make-game-bary-fallback-no-ext → main · +252 −50 · 9 files · 2 commits · open

Summary

Auto-enable --bary-fallback in make_game.py (and scripts/run_gpu_tests.py) when tools/vk_subgroup_info.py selects a GPU without VK_KHR_fragment_shader_barycentric (fragmentShaderBarycentric) that supports geometryShader (such as NVIDIA Pascal / GTX 1050 Ti, Intel Gen9.5, and older GCN):

  • Previously, vk_subgroup_info.py reported per_vertex_inputs: false on Pascal (turning on --f16-interp-fallback), while barycentric_fallback only checked for driver bugs on devices that do advertise VK_KHR_fragment_shader_barycentric (Mesa ANV and AMD Windows on gfx90c), returning false on Pascal and leaving raw BaryCoordKHR pixel shaders untranslated unless --bary-fallback or LEONIDA_BARY_FALLBACK=1 was passed manually.
  • Read VkPhysicalDeviceFeatures.geometryShader (offset 32 in the existing VkPhysicalDeviceFeatures2 query) alongside VK_KHR_fragment_shader_barycentric in tools/vk_subgroup_info.py, exposing "fragment_shader_barycentric" and "geometry_shader", and set "barycentric_fallback" to true when not fragment_shader_barycentric and geometry_shader (MoltenVK has geometry_shader == false and stays false).
  • Log the missing VK_KHR_fragment_shader_barycentric reason distinctly from the Mesa ANV / AMD gfx90c driver-bug message in make_game.py, preserving LEONIDA_BARY_FALLBACK=0/1, explicit --bary-fallback, and keep_recorded_fallback on transient probe failures.
  • Update CLI help, README.md, docs/design.md, and unit tests in tests/test_vk_subgroup_info.py and tests/test_make_game_translator_flags.py.

Validation

  • Live probe on NVIDIA GeForce GTX 1050 Ti (Pascal, Windows 10 19045, driver 582.28): python -I tools/vk_subgroup_info.py now reports "fragment_shader_barycentric": false, "geometry_shader": true, "per_vertex_inputs": false, "barycentric_fallback": true, "mesh_shader": false.
  • python -I tests/test_vk_subgroup_info.py, python -I tests/test_make_game_translator_flags.py, python -I tests/test_make_game_wave64.py, test_docs_*, test_text_write_line_endings.py (all OK).
  • python -I scripts/check_no_game_data.py (clean).

Depends on: #1885
Claim: #1608
AI-assisted: yes (Antigravity, Gemini 4 Carbon)

**@⁠robot00f** on GitHub · 2026-11-26 04:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2192) `robot00f:feat/make-game-bary-fallback-no-ext` → `main` · +252 −50 · 9 files · 2 commits · open ## Summary Auto-enable `--bary-fallback` in `make_game.py` (and `scripts/run_gpu_tests.py`) when `tools/vk_subgroup_info.py` selects a GPU without `VK_KHR_fragment_shader_barycentric` (`fragmentShaderBarycentric`) that supports `geometryShader` (such as NVIDIA Pascal / GTX 1050 Ti, Intel Gen9.5, and older GCN): - Previously, `vk_subgroup_info.py` reported `per_vertex_inputs: false` on Pascal (turning on `--f16-interp-fallback`), while `barycentric_fallback` only checked for driver bugs on devices that *do* advertise `VK_KHR_fragment_shader_barycentric` (Mesa ANV and AMD Windows on `gfx90c`), returning `false` on Pascal and leaving raw `BaryCoordKHR` pixel shaders untranslated unless `--bary-fallback` or `LEONIDA_BARY_FALLBACK=1` was passed manually. - Read `VkPhysicalDeviceFeatures.geometryShader` (offset `32` in the existing `VkPhysicalDeviceFeatures2` query) alongside `VK_KHR_fragment_shader_barycentric` in `tools/vk_subgroup_info.py`, exposing `"fragment_shader_barycentric"` and `"geometry_shader"`, and set `"barycentric_fallback"` to `true` when `not fragment_shader_barycentric and geometry_shader` (MoltenVK has `geometry_shader == false` and stays `false`). - Log the missing `VK_KHR_fragment_shader_barycentric` reason distinctly from the Mesa ANV / AMD `gfx90c` driver-bug message in `make_game.py`, preserving `LEONIDA_BARY_FALLBACK=0/1`, explicit `--bary-fallback`, and `keep_recorded_fallback` on transient probe failures. - Update CLI help, `README.md`, `docs/design.md`, and unit tests in `tests/test_vk_subgroup_info.py` and `tests/test_make_game_translator_flags.py`. ## Validation - Live probe on **NVIDIA GeForce GTX 1050 Ti** (Pascal, Windows 10 `19045`, driver `582.28`): `python -I tools/vk_subgroup_info.py` now reports `"fragment_shader_barycentric": false, "geometry_shader": true, "per_vertex_inputs": false, "barycentric_fallback": true, "mesh_shader": false`. - `python -I tests/test_vk_subgroup_info.py`, `python -I tests/test_make_game_translator_flags.py`, `python -I tests/test_make_game_wave64.py`, `test_docs_*`, `test_text_write_line_endings.py` (all OK). - `python -I scripts/check_no_game_data.py` (clean). Depends on: #1885 Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 AI-assisted: yes (Antigravity, Gemini 4 Carbon)
make_game.py previously turned on --mesh-compute automatically only on
Intel's Windows Vulkan driver (BUILD-2202, runtime_gpu_mesh_draws_crash).
On GPUs without VK_EXT_mesh_shader / meshShader (such as NVIDIA Pascal,
AMD RDNA1/GCN, older Intel iGPUs, and MoltenVK), make_game.py left
--mesh-compute off unless passed on the command line, translating native
MeshEXT modules that the target GPU cannot create or execute.

- Query VK_EXT_mesh_shader and VkPhysicalDeviceMeshShaderFeaturesEXT.meshShader
  (offset 20, after taskShader) in tools/vk_subgroup_info.py across both
  Vulkan 1.2 and Vulkan 1.3 devices (reusing the cached Vulkan 1.2 extension
  set and deferring Vulkan 1.3 extension enumeration to the winning device),
  exposing "mesh_shader" in the JSON output.
- Add runtime_gpu_mesh_shader() in make_game.py and auto-enable
  --mesh-compute during the shaders stage when mesh_shader is False
  (unless --native-mesh is passed), preserving a recorded --mesh-compute
  setting via keep_recorded_fallback when the probe cannot answer.
- Update CLI help, README.md, docs/design.md, and unit tests in
  tests/test_vk_subgroup_info.py and tests/test_make_game_translator_flags.py.

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7152196533
AI-assisted: yes (Antigravity, Gemini 4 Carbon)
tools/vk_subgroup_info.py previously returned barycentric_fallback=true only
for drivers that advertise native barycentrics with a known BaryCoordKHR bug
(Mesa ANV and AMD Windows on gfx90c). On GPUs that lack
VK_KHR_fragment_shader_barycentric altogether while supporting geometryShader
(such as NVIDIA Pascal / GTX 1050 Ti, Intel Gen9.5, and older GCN),
per_vertex_inputs=false turned on --f16-interp-fallback in make_game.py, while
barycentric_fallback remained false and left raw BaryCoordKHR pixel shaders
untranslated unless --bary-fallback or LEONIDA_BARY_FALLBACK=1 was passed
manually.

- Read VkPhysicalDeviceFeatures.geometryShader (offset 32 in
  VkPhysicalDeviceFeatures2) alongside VK_KHR_fragment_shader_barycentric in
  tools/vk_subgroup_info.py, exposing "fragment_shader_barycentric" and
  "geometry_shader" and setting "barycentric_fallback" to true when
  not fragment_shader_barycentric and geometry_shader (keeping MoltenVK false,
  as Metal has no geometryShader).
- Distinguish missing VK_KHR_fragment_shader_barycentric from the Mesa ANV /
  AMD gfx90c driver-bug log message in make_game.py while keeping
  LEONIDA_BARY_FALLBACK=0/1 and --bary-fallback precedence unchanged across
  make_game.py and scripts/run_gpu_tests.py.
- Update CLI help, README.md, docs/design.md, and unit tests in
  tests/test_vk_subgroup_info.py and tests/test_make_game_translator_flags.py.

Depends on: #1885
Claim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7182727159
AI-assisted: yes (Antigravity, Gemini 4 Carbon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:21:52 +00:00
Author
Owner

@⁠Tauwni on GitHub · 2026-11-26 09:26 UTC · original

Tested f1b46166c on an Apple M3 (macOS 26.5.1) with the three Vulkan drivers there, against main a73a57e13. Test programs were built from main; this PR changes no C++.

tools/vk_subgroup_info.py:

Driver fragment_shader_barycentric geometry_shader barycentric_fallback (main → PR)
MoltenVK 1.4.2 true false false → false
KosmicKrisp (Mesa 26.3.1) false false false → false
llvmpipe (Mesa 26.3.1) false true false → true

So the PR changes nothing on MoltenVK and KosmicKrisp. It turns the fallback on for llvmpipe, which lacks VK_KHR_fragment_shader_barycentric but has geometry shaders, the same case as Pascal. On llvmpipe, scripts/run_gpu_tests.py in auto mode gives:

passed skipped failed
main 177 90 1
this PR 181 86 1

ps_bary, ps_persp_bary, ps_scc_mask32 and ps_uniform_branch go from SKIP ("reads BaryCoordKHR and the device has no ...") to PASS through the generated *.bary_gs.spv. The one failure is cs_imgatomic_ext on both, which #1518 fixes. tests/test_vk_subgroup_info.py, test_make_game_translator_flags.py, test_make_game_argparse.py and test_make_game_wave64.py all pass.

AI-assisted (Claude Code). No game data.

**@⁠Tauwni** on GitHub · 2026-11-26 09:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2192#issuecomment-7187997907) Tested `f1b46166c` on an Apple M3 (macOS 26.5.1) with the three Vulkan drivers there, against `main` `a73a57e13`. Test programs were built from `main`; this PR changes no C++. `tools/vk_subgroup_info.py`: | Driver | `fragment_shader_barycentric` | `geometry_shader` | `barycentric_fallback` (`main` → PR) | |---|---|---|---| | MoltenVK 1.4.2 | true | false | false → false | | KosmicKrisp (Mesa 26.3.1) | false | false | false → false | | llvmpipe (Mesa 26.3.1) | false | true | false → **true** | So the PR changes nothing on MoltenVK and KosmicKrisp. It turns the fallback on for llvmpipe, which lacks `VK_KHR_fragment_shader_barycentric` but has geometry shaders, the same case as Pascal. On llvmpipe, `scripts/run_gpu_tests.py` in auto mode gives: | | passed | skipped | failed | |---|---|---|---| | `main` | 177 | 90 | 1 | | this PR | 181 | 86 | 1 | `ps_bary`, `ps_persp_bary`, `ps_scc_mask32` and `ps_uniform_branch` go from SKIP ("reads BaryCoordKHR and the device has no ...") to PASS through the generated `*.bary_gs.spv`. The one failure is `cs_imgatomic_ext` on both, which #1518 fixes. `tests/test_vk_subgroup_info.py`, `test_make_game_translator_flags.py`, `test_make_game_argparse.py` and `test_make_game_wave64.py` all pass. AI-assisted (Claude Code). No game data.
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/2192/head:github-bot/gh-2192'
git switch 'github-bot/gh-2192'

Merge

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