runtime: compile the shim registry once for compatible Windows targets #973

Closed
Kadamitas wants to merge 1 commit from upstream-pr/973 into main
Kadamitas commented 2026-11-24 16:07:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kadamitas on 2026-11-24T16:07:25Z.


Claimed in the coordination issue as: compile the shim registry once for compatible Windows targets (unlisted build work).

What and why

Many Windows runtime, test, and tool targets each list the same shims/registry.cpp. This change compiles the common implementation in a CMake object library. Each executable links its own copy, so process-local state and static shim registrations keep their original ownership.

The Nov 27 rebase shares this object across 37 matching target definitions. The XMem test keeps a private compilation because clang-cl enables asynchronous exception handling there. The loader fuzzer keeps a private compilation for its AddressSanitizer and STL annotation settings. The number of targets enabled depends on the installed libraries and generator options.

Tested

  • On the Nov 27 base 43a9d562d, MSVC built the shared registry and linked the DirectStorage and XG tests. Both passed with the static CRT.

Earlier verification:

  • Windows x64, Visual Studio 2022 MSVC 19.36, SDK 10.0.26100, RelWithDebInfo. In the generated CPU-only build, 36 executables referenced one shared object. The registry source compiled separately for the object library, XMem test and fuzzer.
  • Built and ran five cases with the static CRT: startup_trace, xmem, process_cmdline, bcrypt_rng, and bcrypt_rng_seeded. All five passed.
  • Generated a second configuration with the default dynamic CRT and LEONIDA_LOADER_FUZZ_ASAN=ON. Built the shared registry object and compiled the fuzzer's private registry source with /fsanitize=address and both STL annotation disables. The complete dynamic-CRT test build on this older toolset stops in main's separate crt_timed_wait.cpp; those full binaries were not tested in that configuration. clang-cl was not run.
  • git diff --check and the repository's no-game-data checker passed.

GPUs tested: N/A, CPU-only build change. No frame-rate claim.

AI-assisted: yes, OpenAI Codex.

Checklist

  • Based on current main.
  • One build-system change.
  • No game files, keys, or decryption content.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5475830921 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/973). Originally posted by [Kadamitas](https://github.com/Kadamitas) on 2026-11-24T16:07:25Z. --- Claimed in the coordination issue as: [compile the shim registry once for compatible Windows targets](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137069951) (unlisted build work). ### What and why Many Windows runtime, test, and tool targets each list the same `shims/registry.cpp`. This change compiles the common implementation in a CMake object library. Each executable links its own copy, so process-local state and static shim registrations keep their original ownership. The Nov 27 rebase shares this object across 37 matching target definitions. The XMem test keeps a private compilation because clang-cl enables asynchronous exception handling there. The loader fuzzer keeps a private compilation for its AddressSanitizer and STL annotation settings. The number of targets enabled depends on the installed libraries and generator options. ### Tested - On the Nov 27 base `43a9d562d`, MSVC built the shared registry and linked the DirectStorage and XG tests. Both passed with the static CRT. Earlier verification: - Windows x64, Visual Studio 2022 MSVC 19.36, SDK 10.0.26100, RelWithDebInfo. In the generated CPU-only build, 36 executables referenced one shared object. The registry source compiled separately for the object library, XMem test and fuzzer. - Built and ran five cases with the static CRT: `startup_trace`, `xmem`, `process_cmdline`, `bcrypt_rng`, and `bcrypt_rng_seeded`. All five passed. - Generated a second configuration with the default dynamic CRT and `LEONIDA_LOADER_FUZZ_ASAN=ON`. Built the shared registry object and compiled the fuzzer's private registry source with `/fsanitize=address` and both STL annotation disables. The complete dynamic-CRT test build on this older toolset stops in main's separate `crt_timed_wait.cpp`; those full binaries were not tested in that configuration. clang-cl was not run. - `git diff --check` and the repository's no-game-data checker passed. GPUs tested: N/A, CPU-only build change. No frame-rate claim. AI-assisted: yes, OpenAI Codex. ### Checklist - [x] Based on current main. - [x] One build-system change. - [x] No game files, keys, or decryption content.
PierreEbele commented 2026-11-25 22:06:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T22:06:09Z.


Reviewed 24ab90c: 39 targets now share a gta6rt_shim_registry OBJECT library; xmem_test (/EHa under clang-cl) and pe_loader_fuzz (ASan) keep their own copies, now with comments saying why. I ran the 8 stdlib tests that parse runtime/CMakeLists.txt on both trees (identical results; test_runtime_paths fails on both only because git was unavailable here). My probe found no double compilation, no guard leak and no EH/CRT mismatch among converted targets; registry.cpp has no #if gates, so per-target define deltas cannot change the object. One finding: the comments above xgameruntime_test (line 433) and d3d12_xmem_placed_test (line 2080) still say those targets compile their own registry.cpp like xmem_test; on this branch both consume the shared objects. I could not run the Windows build here, so CI is the remaining proof. AI-assisted review.

Recommendation: Fix first

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175937698 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/973#issuecomment-7175937698). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T22:06:09Z. --- Reviewed 24ab90c: 39 targets now share a gta6rt_shim_registry OBJECT library; xmem_test (/EHa under clang-cl) and pe_loader_fuzz (ASan) keep their own copies, now with comments saying why. I ran the 8 stdlib tests that parse runtime/CMakeLists.txt on both trees (identical results; test_runtime_paths fails on both only because git was unavailable here). My probe found no double compilation, no guard leak and no EH/CRT mismatch among converted targets; registry.cpp has no #if gates, so per-target define deltas cannot change the object. One finding: the comments above xgameruntime_test (line 433) and d3d12_xmem_placed_test (line 2080) still say those targets compile their own registry.cpp like xmem_test; on this branch both consume the shared objects. I could not run the Windows build here, so CI is the remaining proof. AI-assisted review. **Recommendation:** Fix first
MoonEyes commented 2026-11-28 18:01:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T18:01:58Z.


Hi @Kadamitas, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/CMakeLists.txt), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243475957 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/973#issuecomment-7243475957). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T18:01:58Z. --- Hi @Kadamitas, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/CMakeLists.txt`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 10:46:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:46:30Z.

Review: CHANGES_REQUESTED


Sharing the gta6rt_shim_registry CMake OBJECT library across compatible Windows targets (while keeping private compilations for xmem_test and pe_loader_fuzz) is clean and well-reasoned, but requesting changes for merge readiness:

  1. Merge conflict: Currently conflicts with main in runtime/CMakeLists.txt.
  2. Stale/failing CI: The Nov 27 CI run failed on an older base (windows, linux-gpu-tools).

Please rebase onto current main, update any newly added compatible targets that list shims/registry.cpp, and re-run CI to green.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129710439 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/973#pullrequestreview-6129710439). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:46:30Z. **Review:** CHANGES_REQUESTED --- Sharing the `gta6rt_shim_registry` CMake `OBJECT` library across compatible Windows targets (while keeping private compilations for `xmem_test` and `pe_loader_fuzz`) is clean and well-reasoned, but requesting changes for merge readiness: 1. **Merge conflict:** Currently conflicts with `main` in `runtime/CMakeLists.txt`. 2. **Stale/failing CI:** The Nov 27 CI run failed on an older base (`windows`, `linux-gpu-tools`). Please rebase onto current `main`, update any newly added compatible targets that list `shims/registry.cpp`, and re-run CI to green. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 16:32:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:32:41Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317782393 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/973#issuecomment-7317782393). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:32:41Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!973
No description provided.