Skip to content

shaders: index the DXBC identities used by Xbox native graphics pipelines - #497

Merged
QemmHD merged 3 commits into
ProjectLeonida:mainfrom
Rain156:feat/native-graphics-shader-index
Nov 24, 2026
Merged

QemmHD merged 3 commits into
ProjectLeonida:mainfrom
Rain156:feat/native-graphics-shader-index

Conversation

@Rain156

@Rain156 Rain156 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-SLOT57-NATIVE-GRAPHICS-PSO-INDEX (claim). This is the shader-index prerequisite of RT-SLOT57-NATIVE-GRAPHICS-PSO.

What and why

Xbox native graphics pipeline descriptors refer to a stage by its DXBC HASH digest. The translation index names shaders by carved filename and FSSM hash. The shaders stage now writes a local, versioned native_hashes.txt joining those identities. This lets a renderer recover the stage and original container for a native pipeline request.

The writer validates the stage and FSSM hash, detects conflicting uses of a digest and atomically publishes the sorted catalog. An existing translation can add or refresh the catalog without rebuilding SPIR-V. The guest device dispatch is being tested separately.

Adapted from enx's GPL implementation using the format measurements by LooperSalty and KkelebekK. Original implementation

Tested

  • Independently read the HASH part of all 26,503 local retail 1.0.2.1 primary containers. Every row resolves to the expected stage and FSSM program. There are 25,321 distinct identities and zero missing or conflicting entries. The 26,503 translated primary modules passed spirv-val.
  • Regenerated the catalog in the translated workspace. The output was byte-identical. A second invocation kept its timestamp and reused it.
  • 216 Python tests covering the catalog, shader-stage resumption, translation settings and shader dependencies passed. The translator semantic suite passed all 6,104 tests in 465 files.
  • Python compilation, the build help command and the repository-wide game-data check passed.

GPUs tested: The catalog is CPU-only. Corpus verification ran on Windows 11 x64 on the RTX 5070 Ti / NVIDIA 617.42 test machine.

AI-assisted: yes, OpenAI Codex.

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption in this change or its report.
  • No translator rule changed.

Generate a deterministic hash-to-stage catalog alongside the translated shaders. Backfill an existing translation without disassembling it again, reject conflicting identities, and atomically replace a complete catalog.

Adapted from the GPL native stage index by enx, with the Xbox layout measurements by LooperSalty and KkelebekK.

Adapted-from: https://git.notrexed.dev/enx/leonida/commit/5c175db901f8486bcdefd03746b578b657e3151f
@QemmHD

QemmHD commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Looks useful, and its 8 new tests pass on Windows (main 7430f59). One thing before it can merge: make_game.py now imports the new tools/native_pso_hashes.py, which needs listing in runtime/cmake/translator_deps.cmake, in make_game.py's translation_sources_digest inputs and in the .github/workflows/runtime.yml paths. Without that, an edit to it doesn't re-trigger CI or invalidate the stage. Happy to re-test after a push.

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

Track the catalog writer and its local imports in the shader-stage fingerprint
and CMake fixture dependencies. Cover the same files in both Runtime event
filters, including the optional native scanner reached by the carver.
Check both import graphs and document the standalone catalog refresh for
existing translations.

On Windows x64, touching the writer rebuilt the three bindless fixtures once.
All three passed spirv-val and both Vulkan bindless tests passed on an RTX
5070 Ti with driver 617.42. The semantic suite ran 6,108 tests with no failed
files. The regenerated 25,321-row catalog matched the local reference byte
for byte.

AI-assisted: OpenAI Codex
@QemmHD

QemmHD commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Merging.

Why merged: Indexes the DXBC identities the Xbox native graphics pipelines use, which the native-PSO path needs. The earlier hold (new tool not listed as a translator input) is fixed in 62a9588: native_pso_hashes is now in translator_deps.cmake, make_game.py's translation sources and runtime.yml.

Why it's good: Security read of the three-dot diff: tools and tests only, no binaries, downloads or network calls. The PR's own tests: 129 passed. The consistency set, which caught the missing input registration last time, is clean now.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

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

@QemmHD
QemmHD merged commit 14b5825 into ProjectLeonida:main Nov 24, 2026
1 check passed
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** Adds the named NonSemantic.Shader.DebugInfo.100 instruction table so SPIR-V debug instructions disassemble by name. Oliwettoo checked that the table matches SPIRV-Headers' grammar exactly (44 names).

**Why it's good:** Data table plus tests only. Its tests: 47 passed. No behaviour change for shaders without debug info.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** manifest_verifier refuses a --cache path that aliases the input manifest (another spelling, a hard link, a symlink or a case alias), which would otherwise overwrite the manifest: a real data-loss guard. Reviewed as good by Oliwettoo.

**Why it's good:** Its tests: 82 passed, 4 skipped. It merges cleanly together with #346, which touches the same tool; the cumulative run includes both. Note from Oliwettoo: this conflicts with #344, which will need a rebase.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** manifest_verifier also protects every file the manifest lists from being overwritten by cache writes (the companion to #334). Reviewed as good by Oliwettoo.

**Why it's good:** Its tests: 83 passed, 4 skipped, on its own and stacked with #334.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** CI-only: a hung Windows runtime test now fails on its own (per-test ctest --timeout 300, TIMEOUT 180 on the loader test) instead of cancelling the whole job, and the job limit goes from 20 to 35 minutes. Each value is explained in a comment. Reviewed as good by Oliwettoo.

**Why it's good:** Workflow change with no new permissions, actions or downloads. The local tests it touches: 87 passed, 9 skipped. The runner-side effect can only be seen in CI, but there's nothing risky in it: the timeouts only turn hangs into failures.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** d3d12_xs_surface SDK discovery skips a Windows Kits version folder that lacks um/d3d12.h (a WDK-only folder), while an explicit WINDOWS_SDK_INCLUDE/SDK_INCLUDE is still taken as given. Reviewed as good by Oliwettoo.

**Why it's good:** Its tests: 18 passed, 1 skipped. The runtime build on this machine is unaffected (same ctest).

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** stale_build follows includes through the CMake include directories, so a header change in another include dir correctly marks a target stale. Dezmonius independently re-checked the fixed head; the "six failures" he first reported were the new tests running against the old implementation, which is expected.

**Why it's good:** Its tests: 55 passed, 8 skipped, and on current main with main's new tests/test_stale_build.py: 26/26.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** Fixes the mesh half of #506: the statistics pool active during vkCmdDrawMeshTasksEXT no longer enables the two clipping counters that VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076 forbids. Verified on an RTX 5070 Ti (sodove), RTX 4080 (quartz-heron-58) and RX 7900 XTX (bvtterbroot), all with validation on; the rebase to 916dbc6 is byte-identical (range-diff checked). Merged on its own first because #577 is stacked on it.

**Why it's good:** On the 4070 SUPER with LEONIDA_VK_VALIDATION=1: plain main fails d3d12_mesh with 3x VUID-...-07076; main + #540 + #577 passes d3d12_mesh, replay_query_edges and replay_query_predication with 0 validation errors, and the counters match sodove's numbers (mesh-only C 8/0, PS 1024).

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** Stacked on #540: the clipping invocations of a mesh segment now come from a mesh-pipeline query, so CInvocations/CPrimitives stay correct for mixed vertex + mesh work. sodove verified the exact head, including the disconnected-feature negative control that found (and now proves fixed) a gap in the test.

**Why it's good:** The embedded SPIR-V in statistics_sum_spirv.h was recompiled from the PR's .comp: all 431 words are identical and spirv-val passes. d3d12_mesh with validation: 0 errors, mixed C 12 vs vertex-only C 2, so the mesh share is 10, as expected.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
ubiquitarianism pushed a commit that referenced this pull request Nov 24, 2026
tools/native_pso_hashes.py (#497) imports shader_carve, so
test_tool_startup runs it with --help; it took that as a wrong argument
count and exited 2, which fails the test on main. -h/--help now print the
docstring to stdout and return 0, like mesh_compute_vs.py.
ubiquitarianism added a commit that referenced this pull request Nov 24, 2026
native_pso_hashes: exit 0 on --help (test_tool_startup red on main since #497)
demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
Brings 58 PRs integration did not have (among them ProjectLeonida#359 ProjectLeonida#360 ProjectLeonida#402 ProjectLeonida#497 ProjectLeonida#557 ProjectLeonida#558
ProjectLeonida#560 ProjectLeonida#561 ProjectLeonida#572 ProjectLeonida#573 ProjectLeonida#574 ProjectLeonida#577) and the newer heads of ProjectLeonida#401 and ProjectLeonida#404. 15 files
conflicted; resolved by hand:

- frame_pacer.h, d3d12_xs_device.h/.cpp: ProjectLeonida#402's pacer (per-event ticks,
  issue_token_locked) now issues from ProjectLeonida#414's shared FrameTokenSource, so a token
  from the device-side WaitFrameEventX is one the pacer accepts (towade's ProjectLeonida#14
  finding: without it every PresentX is refused). The dead frame_next_token and
  issued_ counters are dropped. Queue slot 32 stays ProjectLeonida#414's PresentX; ProjectLeonida#402's
  presentation-handler routes serve slot 30 or LEONIDA_XS_PRESENT_X_SLOT.
  ProjectLeonida#402's GetFrameStatisticsX route moves into ProjectLeonida#385's route_xbox_device_slot.
- acphal.cpp/acphal_test.cpp: upstream's reworked SHAPE allocation and release;
  the release writes nothing through its first argument, as ProjectLeonida#405 requires; both
  sides' tests kept. Upstream's ProjectLeonida#401/ProjectLeonida#404 heads remove lifecycle.cpp and the C++
  xma2_decoder.cpp (replaced by runtime/xma_decoder), so build_runtime.ps1's
  cl.exe list drops them and keeps ProjectLeonida#549's and ProjectLeonida#400's files.
- vulkan_backend.h, statistics_sum.comp, its SPIR-V header, d3d12_mesh_test,
  replay_query_edges_test, d3d12_vulkan_device.cpp, docs: ProjectLeonida#577's clipping
  counter on top of ProjectLeonida#540, which both sides carry; the Timestamps sentence keeps
  integration's corrected wording (c33ce87).
- xs_proxy_mock_test.cpp: both sides' cases; pr_conflict_label.py keeps the
  guarded reconfigure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…ranslation indexes from shards

Conflicts resolved by hand: make_game.py takes ProjectLeonida#494's translation_plan /
matching_shard_plan, and translation_plan calls translation_sources_digest(),
the name translator_digest() has on integration (it would raise NameError
otherwise). The fake index.json in test_shader_stage_resume names every
disassembly listing (ProjectLeonida#494) and gives each a stage (ProjectLeonida#497's native-pipeline
index needs one); test_make_game_translator_flags keeps the staged entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…ectLeonida#497's step reads

ProjectLeonida#387's test_exe_shaders_stage (on integration only) stands in for the
translation with an empty spirv/index.json. ProjectLeonida#497, which came with the upstream
fold, added make_game's native PSO step after the translation; it loads that
index and fails on an empty file. ProjectLeonida#497 changed the same fixture line in
test_bvh_shaders_stage (1740e09); this applies that change to ProjectLeonida#387's copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
demoz53 added a commit to demoz53/leonida that referenced this pull request Nov 24, 2026
…ame does

ProjectLeonida#494 (on integration) keeps a UTF-8 BOM translation index reusable and tests
it (test_utf8_bom_index_remains_reusable); make_game.py reads that index with
utf-8-sig everywhere. ProjectLeonida#497's native PSO step, from the upstream fold, read it
as plain utf-8 and failed on the BOM ("could not index native graphics
pipelines"). The test passed alone only when the step's timestamp check
skipped the read, and failed under load in the parallel stdlib run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Dezmonius

Copy link
Copy Markdown
Contributor

Follow-up validation of the #497 catalog against measured Xbox device slot 57 requests. Windows 10 22H2, Core i7-7700K, RTX 5070 / NVIDIA 610.88. DadaCap prototype 9173e790, Vulkan, with local Intel CLZERO and shader fixes from the preceding checks.

All 1,669 console calls requested the pipeline-state IID and matched distinct graphics records in the local library by the state, input layout, and PS/VS program identities. The existing catalog resolved every required stage link to a present SPIR-V module: 714 PS, 296 VS, and 16 MS, with zero missing digests, stage mismatches, or missing modules. The nine stock native catalog tests in this tree also passed.

The slot was still forwarded to the PC lifetime tracker in this run, so the measurement verifies catalog coverage for the slot-57 work. It does not validate native graphics pipeline creation. The captured startup frames were black and the run reproduced the prior title stop.

No game data, hashes, binaries, captures, or raw logs attached. AI-assisted (Codex).

aslan2142 pushed a commit that referenced this pull request Nov 25, 2026
@aslan2142

Copy link
Copy Markdown
Collaborator

@Rain156 a question about the rest of your claim RT-SLOT57-NATIVE-GRAPHICS-PSO (this PR was its index part). Asking here because #14 has reached GitHub's 2,500-comment limit.

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

@Rain156

Rain156 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

@aslan2142 I'm continuing RT-SLOT57-NATIVE-GRAPHICS-PSO. The fix is ready for review in #1592. It builds fspx_gfx/index.json and resolves exact pipeline-program hashes through the Vulkan factory from #939. It uses the reader and runtime already in Leonida.

On Windows with an RTX 5070 Ti (617.42), the normal retail startup trace recorded 25,450 / 25,450 successful slot-57 returns on unmodified c7e82e26e and 25,450 / 25,450 on the candidate. I also isolated the failure by withholding native_hashes.txt from a private copy. Main returned 0 / 25,450 successes. The candidate returned 9,958 / 9,958 using kind-6 only before its run hit a title breakpoint. These are observed calls in runs of different lengths. Separate vertex and mesh readback tests passed in both eager and on-demand modes.

Re-run make_game.py --stages shaders with your existing game, work and output paths and the original adapter options. The command backfills graphics while reusing the prior shader groups. Both wave64 settings validated 18,493 of 18,837 identified graphics programs. I haven't run the RDNA2 iGPU locally. If it still refuses requests, aggregate catalog / kind6 counts and HRESULTs from --trace-d3d12 will distinguish lookup from backend rejection.

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