Skip to content

make_game: --bary-fallback is on by itself where the GPU lacks fragmentShaderBarycentric - #4762

Closed
kapitche wants to merge 1 commit into
ItsNotRexed:mainfrom
kapitche:kap-bary-auto
Closed

kapitche wants to merge 1 commit into
ItsNotRexed:mainfrom
kapitche:kap-bary-auto

Conversation

@kapitche

Copy link
Copy Markdown
Contributor

Item: new BUILD item, claimed at #4571 (comment) (my sweep finding #4571 (comment)). Related: #804 (the flag), #4309 (runtime half), #3898.

What broke. --bary-fallback exists, but make_game.py never selects it. Where tools/vk_subgroup_info.py reports per_vertex_inputs false (no fragmentShaderBarycentric, or MoltenVK) it turned on only --f16-interp-fallback, so on an Intel UHD 770 the whole corpus was translated with BaryCoordKHR. In my #4628 sweep (480 of 12,101 pixel shaders) 207 of them could not be created on that GPU for that reason. Repro on main: python -I tests/test_make_game_translator_flags.py after pointing per_vertex=False at run_main shows only --f16-interp-fallback in the flags.

Fix. In that case main() also turns on --bary-fallback (explicit flags still work, a probe that can't answer keeps a recorded flag like the other automatic ones, and a probe that answers still decides). The --bary-fallback help says so. The 8 shaders in the sample with a computed I/J pair are still refused until #3898; the shaders that read raw barycentrics need the geometry shader of #4309 at draw time.

Tested. Linux, Python 3.12.16: tests/test_make_game_translator_flags.py (26, the device test now covers both flags and an explicit --bary-fallback; the probe-failure tests keep three automatic flags), tests/test_docs_cli_flags.py, tests/test_make_game_argparse.py, _wave64, _preflight.

Negative control. With make_game.py from upstream/main the translator-flags tests fail (4 failures).

Real-shader before/after pass counts on Intel are on #4628's follow-up and will be posted on this PR.

AI-assisted.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at 04c27d769 on Windows 11: pytest tests/test_make_game_translator_flags.py -q -> 26 passed, 7 subtests passed; git diff --check clean.

--bary-fallback is now enabled by itself when the probed GPU lacks fragmentShaderBarycentric, instead of requiring the user to pass it; an explicit off still wins. The added subtests cover the automatic-on, the explicit choice and the already-capable device. No blocking issue.

@PingasMech

Copy link
Copy Markdown

On an Intel UHD Graphics 770 (Windows, driver 32.0.101.7088), the real device probe reported per_vertex_inputs=false. With no explicit fallback flags, main 98fa503f selected only --f16-interp-fallback. This head (04c27d76) selected both that flag and --bary-fallback. I used the build’s argument handling, device selection and shard translator with three hand-written fixtures in place of the package-extraction stage.

For the follow-up already noted on #4309, the same computed fixture can check the C++ helper once it consumes bary_fallback_input.per_vertex. All 26 translator-flag tests also passed. AI-assisted, synthetic inputs only.

@Atomic258

Copy link
Copy Markdown

Tested 04c27d769d1812f9123085e4c8d49d8a1d791d55 on Windows 11, CPython 3.15.2 (C:\Python315), in a clean worktree.

Commands and results:

  • python -I tests/test_make_game_translator_flags.py -> 26 tests, OK (~0.5s; the shard 0/1 exited with 1 lines are expected output from the error-path tests).
  • python -I make_game.py --help -> exit 0, usage prints with --bary-fallback in the option list.
  • python -I -m unittest discover -s tests -p "test_docs_cli_flags.py" -> 3 tests, OK (flag help text still consistent).
  • python -m compileall -q make_game.py tools tests -> clean.
  • git diff --check origin/main...HEAD -> clean.

Red control: git checkout origin/main -- make_game.py, re-ran python -I tests/test_make_game_translator_flags.py -> FAILED (failures=4), matching the PR body's negative-control count (automatic-flags expectations missing --bary-fallback). Restored with git checkout HEAD -- make_game.py -> 26 tests OK, git status --porcelain clean.

AI-assisted (Devin).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded: #4772 covers the same automatic flag with a broader rule (--bary-fallback and --mesh-compute, driven by the new vk_subgroup_info feature fields) and conflicts with this branch in make_game.py (git merge-tree refs/remotes/pr/4772 refs/remotes/pr/4762 -> exit 1). #4772 was verified at 17d40e2 (116 passed, 100 subtests). Consider closing this one in its favor.

@whattheflop whattheflop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted Windows CPU integration check of this head 04c27d76 and #4760 690b9711 on 98fa503f. The edits merged cleanly in scratch, tree 2a89c3cd.

Across 19 synthetic build invocations, both shards and FSPX received the same flags. Changing optimization or barycentric fallback independently invalidated shader reuse, the shard plan and the FSPX fingerprint. Identical settings reused all three. An inconclusive probe preserved recorded automatic fallbacks. Two hand-written fixtures produced eight Vulkan 1.2 modules across both fallback and optimization settings. All eight validated, and optimization preserved the expected CPU output words and fragment interfaces. Focused pytest on uv CPython 3.12.13 passed 25 tests and seven subtests.

One docs follow-up: docs/design.md:425 still says the device never selects --bary-fallback. This head selects it on per_vertex_inputs=false. The raw-barycentric geometry stage tracked in #4309 is still a separate runtime dependency.

@kapitche

Copy link
Copy Markdown
Contributor Author

Closing in favour of #4772, which makes the same default (--bary-fallback on when the runtime's GPU lacks fragmentShaderBarycentric) and adds --mesh-compute and the vk_subgroup_info feature fields, so it is a superset of this change and the two conflict in make_game.py.

I checked #4772 at 8e2b1d706 on Linux, Python 3.12.16: tests/test_make_game_translator_flags.py (30 tests), tests/test_vk_subgroup_info.py (51) and tests/test_make_game_argparse.py (36, 1 skipped) all OK. Thanks @Kam471 and @PingasMech for the runs, including the UHD 770 draw check.

@kapitche kapitche closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants