Skip to content

make_game: forward the translator's fallback flags (--no-float-controls and the three fallbacks), recorded beside the translation - #1267

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
abilliontokens:build/make-game-translator-flags
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
abilliontokens:build/make-game-translator-flags

Conversation

@abilliontokens

Copy link
Copy Markdown
Contributor

claim: claiming comment 7076987811 — new BUILD item from @WHOISJARDAS's finding 7076922626 (SHADER-99 follow-up to #664, first raised by @matheuskshn in #664).

Depends on: #664 for --no-float-controls; the other three flags work on today's main.

What

make_game.py's translation step only ever passed --wave64-emulate to rdna2spirv.py, so a player whose device lacks shaderSignedZeroInfNanPreserveFloat32 (or VK_KHR_fragment_shader_barycentric, VK_KHR_maintenance8, VK_EXT_mesh_shader) could not ask the build for the translator's fallback at all.

  • New options --no-float-controls, --bary-fallback, --texel-offset-fallback, --mesh-compute (all off by default: a default build translates exactly as before).
  • translate() forwards the flags to every shard and records them in the shard plan, so shards finished under other flags restart.
  • shaders() records the chosen flags in spirv/translator_flags.txt beside the translation, like wave64_emulate.txt; a work folder translated with other flags is translated again, and shader_outputs_reusable() (the preflight disk-space estimate) honours it. A folder from before the file existed reads as "no flags", so it stays reusable until flags are asked for.
  • README documents the four flags next to --wave64-emulate.

Tests

python -I tests/test_make_game_translator_flags.py — 13/13 pass on this branch, and all 13 error on pristine main 426023a5 (negative control: the flags, the recording and the re-translate are all absent there). They cover: fallback_flags() mapping/order; translate() putting the flags in every shard argv, keeping finished shards when the flags are unchanged and discarding them when they change; shaders() recording translator_flags.txt, re-translating on a flag change, and treating a pre-file folder as unflagged; main() handing the same tuple to preflight() and shaders().

Existing suites re-run green with the mocks updated for the new keyword: test_make_game_resume (18), test_shader_stage_resume (39), test_make_game_wave64, test_make_game_dry_run, test_make_game_argparse (35) — all OK.

No game data

No game files or game-derived data: synthetic tests only, mocked vulkaninfo/translator. AI-assisted (omp orchestrator), Windows 10, Python 3.12.

…side the translation

- `translate()` takes `fallbacks` (the --no-float-controls/--bary-fallback/--texel-offset-fallback/--mesh-compute flags), keeps them in the shard plan, and passes them to every shard; shards finished under other flags restart.
- `shaders()` records the flags in spirv/translator_flags.txt like wave64_emulate.txt and re-translates when they change; `shader_outputs_reusable()` and `preflight()` count a folder with other flags as not reusable.
- New `--no-float-controls`, `--bary-fallback`, `--texel-offset-fallback` and `--mesh-compute` options; `fallback_flags()` maps them in a stable order.
- Tests: 13 new in tests/test_make_game_translator_flags.py (all 13 fail on main 426023a as the negative control); mocks in the resume/argparse suites take the new keyword.
Keep both sides: preflight/main() take fallbacks and jobs; argparse mock
asserts fallbacks=() and jobs=6 together.
@abilliontokens

Copy link
Copy Markdown
Contributor Author

Merge round against main (re-merged e7584c52, the branch opened on 426023a5). New head: c91b5710.

Conflicts (2 files, all keep-both):

  • make_game.py — two hunks, both the same shape: preflight()'s signature and its call site in main(). This PR adds fallbacks, main added jobs in the same kwarg run. Resolved by keeping both (fallbacks: tuple[str, ...] = (), jobs: int = 1; call passes fallbacks=fallbacks, jobs=a.jobs). Main's build_pipeline_check(jobs) in preflight and our shader_outputs_reusable(work, emulate, keep_emulated, fallbacks) reuse hint coexist untouched.
  • tests/test_make_game_argparse.py — test_custom_jobs_forwarded_to_shaders's mock_preflight assertion: expects fallbacks=(), main added jobs=6. Kept both kwargs.

README auto-merged cleanly (main's i18n line and Linux text kept; our fallback-flags paragraph added; no token lines reintroduced — git diff origin/main HEAD -- README.md contains only the four-flag paragraph). tests/test_make_game_translator_flags.py and the resume mock updates added without conflict.

Flag semantics intact: forwarded per shard (extra.extend(fallbacks)), recorded in the shard plan, spirv/translator_flags.txt beside the translation with re-translate on change, pre-file folders read as unflagged, preflight honours it.

Tests (CPU, mocked): test_make_game_translator_flags 13/13, test_make_game_resume 13/13, test_shader_stage_resume 39/39, test_make_game_wave64 28/28, test_make_game_dry_run 24/24, test_make_game_argparse 35/35 — 152 OK total; compileall make_game.py tests clean.

Branch is maintained against main; it will re-merge on request or when #664 lands — no need to flag each hourly round.

AI-assisted (omp orchestrator)

@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.

Independently tested c91b571031275c8f9e13350df54b6bdc3d635bd6 on Windows 11 x64 with uv-managed CPython 3.12.13 and SPIRV-Tools 2026.4. CPU-side translation and SPIR-V validation, with no GPU execution. AI-assisted.

  • Called make_game.shaders() over pre-staged, source-built synthetic listings in a disposable work folder. Only the LLVM signature was substituted. Both translator shards, the merge, the assembler and the validator ran as real subprocesses.
  • All four fixtures passed spirv-val with defaults and with --bary-fallback --texel-offset-fallback --mesh-compute. The enabled run recorded the barycentric input location, removed the texel fixture’s maintenance8 requirement, and emitted a compute entry point with mesh layout metadata. The unaffected pixel shader stayed byte-identical.
  • Checked translator_flags.txt, shards.json and the preflight reuse predicate. An identical rerun launched zero translator subprocesses. With the merged index and one shard removed, the same flags reused the surviving shard and rebuilt only the missing one. Changing flags rebuilt both shards. Switching back to defaults reproduced all four binaries and the merged index byte-for-byte. Default outputs also matched both direct parents (f5a07321, e7584c52) and the feature commit’s parent (426023a5).
  • 153 focused tests passed, including CLI forwarding, resume, wave64 and the preflight disk-space boundary. #664 is still open and the pinned translator lacks --no-float-controls, so that flag was verified at the mocked routing boundary. The barycentric and mesh results cover translation; their runtime integration remains the follow-up documented in docs/design.md.

@kapitche

Copy link
Copy Markdown
Contributor

Tested c91b571 on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass.

  • The four touched test files: 99 passed. With main's make_game.py, 16 fail.
  • The fallback flags are recorded in spirv/translator_flags.txt and the shard plan, so changing one re-translates, and shader_outputs_reusable compares them too.
  • Merging make_game.py: accept versioned LLVM tools for the Linux cross-build #1273 is clean, with 130 passed across the make_game tests.

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.

4 participants