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

Closed
robot00f wants to merge 2 commits from upstream-pr/2192 into main
robot00f commented 2026-11-26 04:44:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-26T04:44:49Z.


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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7182727159
AI-assisted: yes (Antigravity, Gemini 4 Carbon)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5504142647 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-26T04:44:49Z. --- ## 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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7182727159 AI-assisted: yes (Antigravity, Gemini 4 Carbon)
Tauwni commented 2026-11-26 09:26:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T09:26:42Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7187997907 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2192#issuecomment-7187997907). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T09:26:42Z. --- 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.
qhukz13 commented 2026-11-27 22:18:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-27T22:18:23Z.


Tested on the GPU this PR names: GeForce GTX 1050 Ti 4 GB (Pascal), NVIDIA 582.66, Windows 10 19045 (profile S). Head d260b81d4 merged onto main 34e33d3dd (README.md and run_gpu_tests.py auto-merged), test programs built from main; scripts/run_gpu_tests.py in auto mode (no LEONIDA_* variables).

MEASURED:

  • tools/vk_subgroup_info.py: main reports per_vertex_inputs: false, barycentric_fallback: false; this PR adds mesh_shader: false, fragment_shader_barycentric: false, geometry_shader: true and reports barycentric_fallback: true.
  • Auto mode, main: 202/269 passed, 65 skipped; ps_bary, ps_persp_bary, ps_scc_mask32, ps_uniform_branch SKIP ("reads BaryCoordKHR and the device has no VK_KHR_fragment_shader_barycentric").
  • Auto mode, this PR: 206/269 passed, 61 skipped; the runner builds bary fallback GS for those four and all four PASS (ps_bary 4096/4096 pixels, ps_persp_bary perspective-correct on every covered pixel, ps_scc_mask32 and ps_uniform_branch 4096 px). No test went from pass to fail.
  • The two failures are the same on both sides and on every mode we ran, so not from this PR: cs_imgatomic_ext (6 of 64 sint words) and cs_texture_uav (no formatless storage access for format 98).

One small thing, READ IN CODE / MEASURED in the log: ps_ij_computed still SKIPs with "computed I/J pairs need PerVertexKHR inputs: no --bary-fallback / --f16-interp-fallback", while the translator line in the same run says "computed I/J pair under --bary-fallback: no PerVertexKHR inputs". The skip is right (computed pairs under the fallback are refused, #120), only the reason names the flags as if neither were on.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7229212700 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192#issuecomment-7229212700). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-27T22:18:23Z. --- Tested on the GPU this PR names: **GeForce GTX 1050 Ti 4 GB (Pascal), NVIDIA 582.66, Windows 10 19045** (profile S). Head `d260b81d4` merged onto `main` `34e33d3dd` (README.md and run_gpu_tests.py auto-merged), test programs built from `main`; `scripts/run_gpu_tests.py` in auto mode (no LEONIDA_* variables). MEASURED: - `tools/vk_subgroup_info.py`: main reports `per_vertex_inputs: false, barycentric_fallback: false`; this PR adds `mesh_shader: false, fragment_shader_barycentric: false, geometry_shader: true` and reports `barycentric_fallback: true`. - Auto mode, main: **202/269 passed, 65 skipped**; `ps_bary`, `ps_persp_bary`, `ps_scc_mask32`, `ps_uniform_branch` SKIP ("reads BaryCoordKHR and the device has no VK_KHR_fragment_shader_barycentric"). - Auto mode, this PR: **206/269 passed, 61 skipped**; the runner builds `bary fallback GS` for those four and all four PASS (`ps_bary` 4096/4096 pixels, `ps_persp_bary` perspective-correct on every covered pixel, `ps_scc_mask32` and `ps_uniform_branch` 4096 px). No test went from pass to fail. - The two failures are the same on both sides and on every mode we ran, so not from this PR: `cs_imgatomic_ext` (6 of 64 sint words) and `cs_texture_uav` (no formatless storage access for format 98). One small thing, READ IN CODE / MEASURED in the log: `ps_ij_computed` still SKIPs with "computed I/J pairs need PerVertexKHR inputs: no --bary-fallback / --f16-interp-fallback", while the translator line in the same run says "computed I/J pair under --bary-fallback: no PerVertexKHR inputs". The skip is right (computed pairs under the fallback are refused, #120), only the reason names the flags as if neither were on. AI-assisted (Claude Code).
MoonEyes commented 2026-11-28 02:56:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:56:09Z.


Hi @robot00f, thanks for this pull request. It currently conflicts with main (conflicting file(s): docs/design.md), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232688424 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192#issuecomment-7232688424). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T02:56:09Z. --- Hi @robot00f, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `docs/design.md`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
TheGeogeo commented 2026-11-29 04:50:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T04:50:36Z.


Checked d260b81d4 against main ef3299584 on Windows 11 10.0.26300: it does not merge (git merge-tree --write-tree), so I ran no tests.

  • Conflicts:
    • README.md: rewritten on main by a9e247cd6 and 8bb93e89d (2026-11-28).
    • make_game.py: b26e43491 and 2af23b9ac (2026-11-24) changed the same lines.
    • tools/vk_subgroup_info.py and docs/design.md: edits next to this PR's.
  • Still needed (STALE, needs a rebase). main's barycentric_fallback() (tools/vk_subgroup_info.py:209) still only lists drivers with broken barycentrics (Mesa ANV, AMD gfx90c, an old Raphael driver). It does not turn the fallback on for a device without VK_KHR_fragment_shader_barycentric.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250894036 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192#issuecomment-7250894036). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T04:50:36Z. --- Checked `d260b81d4` against `main` `ef3299584` on Windows 11 10.0.26300: it does not merge (`git merge-tree --write-tree`), so I ran no tests. - Conflicts: - `README.md`: rewritten on `main` by `a9e247cd6` and `8bb93e89d` (2026-11-28). - `make_game.py`: `b26e43491` and `2af23b9ac` (2026-11-24) changed the same lines. - `tools/vk_subgroup_info.py` and `docs/design.md`: edits next to this PR's. - Still needed (STALE, needs a rebase). `main`'s `barycentric_fallback()` (`tools/vk_subgroup_info.py:209`) still only lists drivers with broken barycentrics (Mesa ANV, AMD gfx90c, an old Raphael driver). It does not turn the fallback on for a device without `VK_KHR_fragment_shader_barycentric`. AI-assisted (Claude Code).
KelboLive commented 2026-11-30 18:11:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T18:11:11Z.


Independent check on Windows (not the author), at d260b81d4.

  • test_make_game_argparse.py: 38 tests OK
  • test_make_game_translator_flags.py: 38 tests OK
  • test_make_game_wave64.py: 45 tests OK
  • test_vk_subgroup_info.py: 57 tests OK

Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7287474790 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192#issuecomment-7287474790). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T18:11:11Z. --- Independent check on Windows (not the author), at `d260b81d4`. - `test_make_game_argparse.py`: **38 tests OK** - `test_make_game_translator_flags.py`: **38 tests OK** - `test_make_game_wave64.py`: **45 tests OK** - `test_vk_subgroup_info.py`: **57 tests OK** Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10. AI-assisted: yes (opencode).
aslan2142 commented 2026-12-01 11:49:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:49:15Z.

Review: CHANGES_REQUESTED


This PR cannot merge in its current state:

  • Stacked on unmerged base #1885: #1885 must land first, then this branch needs to be rebased onto main.
  • Merge conflicts with main (README.md, docs/design.md, make_game.py) and failing CI (windows, linux-gpu-tools, macos, macos-python, check).

Once #1885 lands, please rebase onto current main and obtain a green CI run.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130645593 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192#pullrequestreview-6130645593). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:49:15Z. **Review:** CHANGES_REQUESTED --- This PR cannot merge in its current state: - **Stacked on unmerged base `#1885`**: `#1885` must land first, then this branch needs to be rebased onto `main`. - **Merge conflicts** with `main` (`README.md`, `docs/design.md`, `make_game.py`) and **failing CI** (`windows`, `linux-gpu-tools`, `macos`, `macos-python`, `check`). Once `#1885` lands, please rebase onto current `main` and obtain a green CI run. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:25:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:25:21Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319273117 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2192#issuecomment-7319273117). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:25:21Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2192
No description provided.