Skip to content

runtime: regenerate missing M15/M3/M4/buffer_uav shader modules on rebuild (#3854 follow-up) - #4888

Open
kingzzim7-create wants to merge 1 commit into
ItsNotRexed:mainfrom
kingzzim7-create:spv-fixture-outputs
Open

kingzzim7-create wants to merge 1 commit into
ItsNotRexed:mainfrom
kingzzim7-create:spv-fixture-outputs

Conversation

@kingzzim7-create

Copy link
Copy Markdown
Contributor

Claimed

New BUILD item, claimed on #4816. A follow-up to #3854, found by @tupacfan04 in their review there.

What and why

#3854 fixes a silent incremental-build failure for the M2/M2F fixtures: their shader lists declare only spirv/index.json and the fssm/*.fssm sidecars, so a translated spirv/*.spv that goes missing is invisible to the build graph. The build "succeeds", the module stays missing, and the test fails at CreateGraphicsPipelineState.

Four more fixtures in runtime/CMakeLists.txt have the same omission. This PR declares their .spv modules beside each .fssm, in the same layout as #3854:

List Modules added
LEONIDA_M15_FILES (d3d12_translated_draw) vs_m15, ps_m15
LEONIDA_M3_FILES (d3d12_m3_frame, d3d12_m3_first_pass) vs_m3, ps_m3, vs_m2, ps_m3_post, ps_m3_query
LEONIDA_M4_FILES (d3d12_m4_compute) cs_m4_fill, cs_m4_indirect
LEONIDA_BUFFER_UAV_FILES (d3d12_buffer_uav) cs_buf_typed, cs_buf_counter

The M2/M2F lists are left to #3854. The two PRs change different lines of the same file, so they don't conflict.

Tested

Windows 11, VS 2026 (MSVC 14.52.37025), Ninja via scripts/build_runtime.ps1, real llvm-mc 23.1.6 and SPIRV-Tools v2026.2 (no stub generator), NVIDIA RTX 4060 Ti, driver 621.01, main ec34b54.

  • Before (main): delete generated/m15_shaders/spirv/vs_m15.spv and rebuild. The file is not regenerated, and d3d12_translated_draw fails at CreateGraphicsPipelineState (line 167).
  • After: the same rebuild regenerates it. Then, for each of the 11 modules in turn, I deleted it, rebuilt incrementally, and compared SHA-256. 11/11 came back byte-identical.
  • An unchanged rebuild afterwards runs 0 translation steps, so there is no overbuild.
  • GPU tests: d3d12_translated_draw, d3d12_m3_frame, d3d12_m3_first_pass, d3d12_m4_compute and d3d12_buffer_uav pass 5/5, and also 5/5 with LEONIDA_VK_VALIDATION=1.
  • tests/test_ctest_registration.py 4 OK, tests/test_shader_build_fallbacks.py 4 OK.
  • Full ctest: 100% passed, 0 failed out of 176.
  • git diff --check is clean. The diff is 1 file, +14 −9.

Checklist

  • No game data, keys or decryption; nothing online
  • Before/after reproduced; full ctest green

AI-assisted: yes (Claude).

…build

Follow-up to ItsNotRexed#3854 (found by tupacfan04 in its review): the M15, M3, M4 and buffer_uav fixture lists declared only index.json and the .fssm sidecars, so a deleted spirv/*.spv stayed missing after an incremental build and its test failed at CreateGraphicsPipelineState. Declare each fixture's .spv modules beside their .fssm, as ItsNotRexed#3854 does for M2/M2F.

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

Independent Windows CPU integration check, AI-assisted. This head merges cleanly into main d974c88a. Bringing in #3854 at 3d32aade leaves its existing M2 list conflict. I kept main's ps_m2_literal.fssm and added its corresponding ps_m2_literal.spv alongside the other pairs, as noted in the #3854 review. None of the four lists changed here conflicts with that resolution.

On resolved scratch tree 01dd4d13bc97532551529ca3f9ae6796e87fc5a9, the configured Ninja graph registered 42 outputs across M15, M2, M2F, M3, M4 and buffer UAV and all seven consuming CTests. Running the six configured generation commands with LLVM 21.1.8 through WSL generated 18 synthetic modules; all 18 passed spirv-val and matched their indexed FSSM hashes. Both focused Python suites passed (8 tests). This verifies the combined graph and generation, without repeating the deletion matrix or running the GPU tests.

@Ayinaki

Ayinaki commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested d90e8bf on RTX 5070, driver 616.86, Windows 10.0.26200: pass.

Built runtime with MSVC 14.52 (Visual Studio 18 2026, x64, RelWithDebInfo). Then, in the build tree:

  1. built d3d12_translated_draw_test once (the M15 generation ran and wrote generated/m15_shaders/spirv/ps_m15.spv);
  2. deleted generated/m15_shaders/spirv/ps_m15.spv;
  3. rebuilt the same target without cleaning.

The rebuild re-ran the custom command ("Translating vs_m15 and ps_m15 for the translated draw test") and ps_m15.spv was back afterwards. Running the rebuilt test with LEONIDA_VK_DEVICE="RTX 5070" exits 0: "M1.5: translated VS+PS found by FSSM hash drew three draws; 4064 of 4096 pixels exact, 32 edge pixels on the triangle's diagonal", i.e. the regenerated module is the one the test loads.

@tupacfan04

Copy link
Copy Markdown
Contributor

MERGE. One file runtime/CMakeLists.txt (+14/-9), 11 .spv outputs added (2+5+2+2), each matching a build.py argument.

Verified at graph level with Ninja + MSVC 19.51 and a forced -DLEONIDA_LLVM_MC: build.ninja:9723 (m15) and :9768 (buffer_uav) list .../spirv/vs_m15.spv etc. as build outputs, not just dependencies. Mechanism repro with a stub writer: the new OUTPUT list rebuilds a deleted ps_m15.spv, while main's list says ninja: no work to do and leaves it missing - the bug is confirmed at runtime/CMakeLists.txt:1661,1748,1782,1809.

No permanent-rebuild risk: build.py:217-228 exits non-zero if any name lacks a validated .spv and publishes one for every validated name; NEEDS_PER_VERTEX_INPUTS = ("ps_ij_computed",) (build.py:48) excludes all 11. test_ctest_registration 4, test_shader_build_fallbacks 4, test_runtime_paths 5, compileall and diff-check clean, merge clean.

Skipped here: real translation (no llvm-mc), full build/ctest and GPU run.

Approve. AI-assisted review, no game files.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested d90e8bf merged onto main 3faac55 on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 178/178.
  • Warnings: none new in the files this PR changes.

AI-assisted (Claude Code).

@kingzzim7-create

Copy link
Copy Markdown
Contributor Author

Thanks @tupacfan04, @whattheflop, @Ayinaki and @JRamos1993 for the checks, and for confirming it combines cleanly with #3854 and the new ps_m2_literal module.

@kapitche

Copy link
Copy Markdown
Contributor

Tested d90e8bf merged with main 3faac55 on Windows 11 native, MSVC 14.51 (VS 18), Ninja, RelWithDebInfo, real llvm-mc 23.1.6 and spirv-as/spirv-val from the Vulkan tools, NVIDIA GeForce RTX 4080 SUPER (plus Linux/WSL2, Python 3.12.16, for the two CMake-related Python tests): pass.

  • Built the four test targets (d3d12_translated_draw_test, d3d12_m3_frame_test, d3d12_m4_compute_test, d3d12_buffer_uav_test): all 11 listed .spv present afterwards (11/11).
  • ctest -R "translated_draw|m3_frame|m3_first_pass|m4_compute|buffer_uav": 5 run, 5 passed, 0 failed.
  • PR: deleted all 11 .spv (0/11), rebuilt the four targets: 11/11 regenerated, SHA-256 of all 11 identical to the pre-delete files; a following ninja -n on the same targets: "no work to do".
  • Negative control: runtime/CMakeLists.txt checked out from main, all 11 .spv deleted, same rebuild: 0/11 regenerated.
  • tests/test_ctest_registration.py 4 run / 4 passed, tests/test_shader_build_fallbacks.py 4 run / 4 passed (Linux, Python 3.12.16).
  • Not run: the M2/M2F lists (left to runtime: regenerate missing M2 shader modules on rebuild #3854 as the description says), Intel UHD 770 for the 5 GPU tests, validation layer.

@kingzzim7-create

Copy link
Copy Markdown
Contributor Author

Thanks @kapitche, especially for the negative control: 0/11 regenerated with main's CMakeLists vs 11/11 byte-identical with this change, on a second Ada card.

@memorypressure

Copy link
Copy Markdown

Verified on current main (3faac55, merged cleanly): the four extended OUTPUT lists match exactly what runtime/test/shaders/build.py publishes for the shader names those custom commands pass it, so a build directory missing only the .spv files will now regenerate instead of failing the tests at runtime. compileall passes; the cmake build itself was not attempted here (CPU-only review box). Two same-shape gaps the PR leaves untouched (pre-existing on main): the M2/M2F blocks (runtime/CMakeLists.txt:1690, :1720) omit their .spv outputs the same way, and the .spvasm sidecars build.py also writes are tracked by no block — fine to follow up separately. This branch reports no CI checks. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@kingzzim7-create

Copy link
Copy Markdown
Contributor Author

Thanks @memorypressure. M2/M2F are #3854's part; I tested its rebased head 7fda9b8 there (7/7 regenerated byte-identical, including ps_m2_literal). The .spvasm sidecars are left out on purpose: the tests load the .spv (a missing one is what fails at CreateGraphicsPipelineState), so this PR only declares what a test needs. Happy to add them in a follow-up if something starts reading them.

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.

7 participants