[PR #1592] shaders: build the graphics program index for device slot 57 (RT-SLOT57-NATIVE-GRAPHICS-PSO) #1610

Open
opened 2026-11-26 20:21:51 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1592
Author: @Rain156
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: rain/slot57-graphics-library


📝 Commits (2)

  • 446f3f9 shaders: build the native graphics library and resolve slot 57 by program identity
  • 817b4be tests: keep pipeline-library graphics separate in the full corpus check

📊 Changes

18 files changed (+489 additions, -168 deletions)

View changed files

📝 docs/fspx.md (+11 -5)
📝 docs/shader_library.md (+26 -1)
📝 make_game.py (+76 -23)
📝 runtime/CMakeLists.txt (+4 -1)
📝 runtime/shims/d3d12_vulkan_device.cpp (+9 -8)
📝 runtime/shims/d3d12_xs_device.cpp (+8 -5)
📝 runtime/shims/d3d12_xs_device.h (+2 -2)
📝 runtime/shims/d3d12_xs_native_pso.h (+84 -29)
📝 runtime/src/native_pso.h (+22 -16)
📝 runtime/src/shader_library.h (+15 -10)
📝 runtime/test/d3d12_mesh_test.cpp (+51 -37)
📝 runtime/test/d3d12_native_graphics_fixture.h (+34 -3)
📝 runtime/test/d3d12_translated_draw_test.cpp (+27 -5)
📝 runtime/test/device_proxy_test.cpp (+6 -0)
📝 runtime/test/shader_library_corpus_test.cpp (+7 -8)
📝 runtime/test/shader_library_test.cpp (+6 -0)
📝 runtime/test/xs_proxy_mock_test.cpp (+8 -0)
📝 tests/test_library_shaders_stage.py (+93 -15)

📄 Description

Claimed in the coordination issue as: RT-SLOT57-NATIVE-GRAPHICS-PSO. Original claim

Depends on: #497, #939, #984 and #974 (merged).

What and why

The normal shaders stage produced the compute pipeline library and the DXBC identity catalog. Device slot 57 could also look up raw graphics programs, but the build never populated that index. This follows up on the RDNA2 report in #497. Original report

  • Extract the pipeline-specific PS, VS and MS code with Leonida's existing reader, translate it and publish <shaders>/fspx_gfx/index.json. The graphics build has an independent resume marker that validates its index and module files.
  • The Vulkan factory first uses the container named by the stage records. It can resolve a missing identity by the full native program hash across all seven blocks, or retry a refused catalog PSO with indexed code of the same stage. It retains the decoded state, the input layout and the program bytes used by deferred binding. An ambiguous stage or an occupied block beyond the legacy fallback's two slots cannot silently produce an incomplete PSO.
  • The existing --trace-d3d12 switch reports catalog and kind-6 stage counts and the HRESULT. The full corpus test accounts for the new sub-index separately from carved DXBC containers.

Offline retail checks

Native Windows 11 x64, MSVC RelWithDebInfo, RTX 5070 Ti, NVIDIA 617.42, Xbox 1.0.2.1. The control runtime was unmodified c7e82e26e. The runs used a zero-capability AppContainer. The isolated control withheld only the DXBC identity catalog from the runtime inputs.

Build DXBC catalog Successful / observed slot-57 returns
main control present 25,450 / 25,450
follow-up present 25,450 / 25,450
main control withheld 0 / 25,450
follow-up withheld 9,958 / 9,958

The raw-only candidate trace attributed its successes to kind-6 lookups. The traces ended at title breakpoints after differing numbers of calls. They measure PSO creation during startup. World rendering and the reported RDNA2 iGPU still need their own verification.

Build and GPU validation

  • The standard make_game.py --stages shaders command backfilled the graphics library in an existing workspace. Its index was byte-identical to a separate full pass. A second standard invocation reused all six groups without changing any of their index bytes, index timestamps or module sizes/timestamps.
  • Native wave64 and wave64 emulation each passed spirv-val for 9,671/9,996 PS, 1,342/1,343 VS and 7,480/7,498 MS. All 18,493 published code hashes in each mode matched the complete extracted programs and had a module. The 344 remaining specialized programs were refused by the translator. Across 25,471 graphics records, raw keys alone supplied all stage links for 24,983. The DXBC catalog supplied all stage links for 25,450. Two records also refer to the unidentified slot 6.
  • The C++ corpus check loaded the 18,493 graphics entries and matched all 26,503 carved containers to their own primary entries, with zero failures. The primary and four pre-existing auxiliary indices matched the control byte for byte.
  • New synthetic VS+PS and MS+PS draws passed their GPU pixel checks in eager and on-demand compilation with synchronization validation. The VS case includes a PS reading its own code-base constants after the caller's buffers have been overwritten, a stale source container and a one-byte-wrong raw program. Fourteen related native CTests passed.
  • All 6,279 translator semantic tests passed across 487 files. The build regression sweep ran 661 checks with five skips and zero failures. The added graphics-only archive case, documentation links, compilation and repository game-data checks passed.

AI-assisted: Yes (Codex). The original claim is in #14. The successor tracker has the completion notice and the remaining specialized translation work.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1592 **Author:** [@Rain156](https://github.com/Rain156) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `rain/slot57-graphics-library` --- ### 📝 Commits (2) - [`446f3f9`](https://github.com/ubiquitarianism/leonida/commit/446f3f9bd08ae392333c41f3f1277548ee73061b) shaders: build the native graphics library and resolve slot 57 by program identity - [`817b4be`](https://github.com/ubiquitarianism/leonida/commit/817b4be0b9dbea4045a0a07470bd01f109fe3d67) tests: keep pipeline-library graphics separate in the full corpus check ### 📊 Changes **18 files changed** (+489 additions, -168 deletions) <details> <summary>View changed files</summary> 📝 `docs/fspx.md` (+11 -5) 📝 `docs/shader_library.md` (+26 -1) 📝 `make_game.py` (+76 -23) 📝 `runtime/CMakeLists.txt` (+4 -1) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+9 -8) 📝 `runtime/shims/d3d12_xs_device.cpp` (+8 -5) 📝 `runtime/shims/d3d12_xs_device.h` (+2 -2) 📝 `runtime/shims/d3d12_xs_native_pso.h` (+84 -29) 📝 `runtime/src/native_pso.h` (+22 -16) 📝 `runtime/src/shader_library.h` (+15 -10) 📝 `runtime/test/d3d12_mesh_test.cpp` (+51 -37) 📝 `runtime/test/d3d12_native_graphics_fixture.h` (+34 -3) 📝 `runtime/test/d3d12_translated_draw_test.cpp` (+27 -5) 📝 `runtime/test/device_proxy_test.cpp` (+6 -0) 📝 `runtime/test/shader_library_corpus_test.cpp` (+7 -8) 📝 `runtime/test/shader_library_test.cpp` (+6 -0) 📝 `runtime/test/xs_proxy_mock_test.cpp` (+8 -0) 📝 `tests/test_library_shaders_stage.py` (+93 -15) </details> ### 📄 Description Claimed in the coordination issue as: RT-SLOT57-NATIVE-GRAPHICS-PSO. [Original claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123093929) Depends on: #497, #939, #984 and #974 (merged). ### What and why The normal shaders stage produced the compute pipeline library and the DXBC identity catalog. Device slot 57 could also look up raw graphics programs, but the build never populated that index. This follows up on the RDNA2 report in #497. [Original report](https://github.com/ubiquitarianism/leonida/pull/497#issuecomment-7152662192) - Extract the pipeline-specific PS, VS and MS code with Leonida's existing reader, translate it and publish `<shaders>/fspx_gfx/index.json`. The graphics build has an independent resume marker that validates its index and module files. - The Vulkan factory first uses the container named by the stage records. It can resolve a missing identity by the full native program hash across all seven blocks, or retry a refused catalog PSO with indexed code of the same stage. It retains the decoded state, the input layout and the program bytes used by deferred binding. An ambiguous stage or an occupied block beyond the legacy fallback's two slots cannot silently produce an incomplete PSO. - The existing `--trace-d3d12` switch reports catalog and kind-6 stage counts and the HRESULT. The full corpus test accounts for the new sub-index separately from carved DXBC containers. ### Offline retail checks Native Windows 11 x64, MSVC RelWithDebInfo, RTX 5070 Ti, NVIDIA 617.42, Xbox 1.0.2.1. The control runtime was unmodified `c7e82e26e`. The runs used a zero-capability AppContainer. The isolated control withheld only the DXBC identity catalog from the runtime inputs. | Build | DXBC catalog | Successful / observed slot-57 returns | |---|---|---:| | main control | present | 25,450 / 25,450 | | follow-up | present | 25,450 / 25,450 | | main control | withheld | 0 / 25,450 | | follow-up | withheld | 9,958 / 9,958 | The raw-only candidate trace attributed its successes to kind-6 lookups. The traces ended at title breakpoints after differing numbers of calls. They measure PSO creation during startup. World rendering and the reported RDNA2 iGPU still need their own verification. ### Build and GPU validation - The standard `make_game.py --stages shaders` command backfilled the graphics library in an existing workspace. Its index was byte-identical to a separate full pass. A second standard invocation reused all six groups without changing any of their index bytes, index timestamps or module sizes/timestamps. - Native wave64 and wave64 emulation each passed `spirv-val` for 9,671/9,996 PS, 1,342/1,343 VS and 7,480/7,498 MS. All 18,493 published code hashes in each mode matched the complete extracted programs and had a module. The 344 remaining specialized programs were refused by the translator. Across 25,471 graphics records, raw keys alone supplied all stage links for 24,983. The DXBC catalog supplied all stage links for 25,450. Two records also refer to the unidentified slot 6. - The C++ corpus check loaded the 18,493 graphics entries and matched all 26,503 carved containers to their own primary entries, with zero failures. The primary and four pre-existing auxiliary indices matched the control byte for byte. - New synthetic VS+PS and MS+PS draws passed their GPU pixel checks in eager and on-demand compilation with synchronization validation. The VS case includes a PS reading its own code-base constants after the caller's buffers have been overwritten, a stale source container and a one-byte-wrong raw program. Fourteen related native CTests passed. - All 6,279 translator semantic tests passed across 487 files. The build regression sweep ran 661 checks with five skips and zero failures. The added graphics-only archive case, documentation links, compilation and repository game-data checks passed. AI-assisted: Yes (Codex). The original claim is in #14. The successor tracker has the [completion notice](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154337573) and the [remaining specialized translation work](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154337920). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1610
No description provided.