runtime: fix the three compile breaks that stop main from building #243

Closed
github-bot wants to merge 3 commits from gh-pr/243/head into gh-pr/243/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:51 UTC · original
ubiquitarianism:old-pr/9978 → main · +43 −3 · 5 files · 3 commits · closed without merging

Carried over from old PR 9978 by icecreammule277-dot in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9978, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
This branch conflicts with the current main and needs a rebase.
icecreammule277-dot: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

main (d083a2cc3) does not compile the runtime (gta6rt). Three independent source-level breaks from recent merges, each fixed with one hunk. With them the target links; without them it fails with C2084, C2338, C3083, C2248, C2665.

1. runtime/shims/d3d12_xs_device.cpp — missing declaration.
Xbox slot 14's console descriptor-heap path (3630610ca) calls rt::d3d12::create_console_descriptor_heap (declared in d3d12_com.h:221, defined in d3d12_vulkan_device.cpp) but this translation unit never sees the declaration. Fixed with a forward declaration, not #include "d3d12_com.h": that header pulls in gfx10_descriptors.h and vulkan_backend.h, and this TU is also compiled by root_sig_test, device_proxy_test and xs_proxy_mock_test, which do not carry the Vulkan include path — including the header breaks those three tests instead (verified: adding the include reintroduces a vulkan/vulkan.h C1083 in those targets).

2. runtime/shims/d3d12_vulkan_device.cpp — the same commit's helper.
create_console_descriptor_heap needs a non-const DeviceState& (Device::state() returns a const reference) and the private Device::identity(). Added a non-const state() overload and used the existing public holder() (which returns identity()). Behaviour-neutral.

3. runtime/shims/acphal.cpp — SHAPE context sizes (ccd36246f).
sizeof(SHAPE_XMA_CONTEXT) is 60 against the asserted 64, and sizeof(SHAPE_PCM_CONTEXT) is 28 against 32. The repo's own ABI test (tests/test_acphal_abi.py) asserts 64/32 are the GDK sizes, so the structs are one trailing dword short: reserved[10] -> reserved[11], reserved[1] -> reserved[2]. Padding only; no named field moves. (The shim never reads a field of either context — it only allocates sizeof(...) zeroed arrays — so only the size matters to it. Where the true GDK puts the byte is still the author's to confirm.)

Verified: cmake --build runtime/build --config RelWithDebInfo --target gta6rt links on d083a2cc3 with these hunks.

Not fixed here (separate, and its author's to rewrite): runtime/test/d3d12_console_descriptor_heap_test.cpp, added by the same 3630610ca, does not compile — it uses a Ref<T> template this tree does not have and calls IID_PPV_ARGS on a void*.

Method: Windows 11 26300, MSVC 19.52, RelWithDebInfo, Vulkan SDK 1.4.363.0. AI-assisted (OpenCode).

**@⁠Andretuta** on GitHub · 2026-11-24 02:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/243) `ubiquitarianism:old-pr/9978` → `main` · +43 −3 · 5 files · 3 commits · closed without merging > Carried over from **old PR 9978** by `icecreammule277-dot` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9978`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > This branch conflicts with the current `main` and needs a rebase. > `icecreammule277-dot`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `main` (`d083a2cc3`) does not compile the runtime (`gta6rt`). Three independent source-level breaks from recent merges, each fixed with one hunk. With them the target links; without them it fails with `C2084`, `C2338`, `C3083`, `C2248`, `C2665`. **1. `runtime/shims/d3d12_xs_device.cpp` — missing declaration.** Xbox slot 14's console descriptor-heap path (`3630610ca`) calls `rt::d3d12::create_console_descriptor_heap` (declared in `d3d12_com.h:221`, defined in `d3d12_vulkan_device.cpp`) but this translation unit never sees the declaration. Fixed with a forward declaration, *not* `#include "d3d12_com.h"`: that header pulls in `gfx10_descriptors.h` and `vulkan_backend.h`, and this TU is also compiled by `root_sig_test`, `device_proxy_test` and `xs_proxy_mock_test`, which do not carry the Vulkan include path — including the header breaks those three tests instead (verified: adding the include reintroduces a `vulkan/vulkan.h` C1083 in those targets). **2. `runtime/shims/d3d12_vulkan_device.cpp` — the same commit's helper.** `create_console_descriptor_heap` needs a non-const `DeviceState&` (`Device::state()` returns a const reference) and the private `Device::identity()`. Added a non-const `state()` overload and used the existing public `holder()` (which returns `identity()`). Behaviour-neutral. **3. `runtime/shims/acphal.cpp` — SHAPE context sizes (`ccd36246f`).** `sizeof(SHAPE_XMA_CONTEXT)` is 60 against the asserted 64, and `sizeof(SHAPE_PCM_CONTEXT)` is 28 against 32. The repo's own ABI test (`tests/test_acphal_abi.py`) asserts 64/32 are the GDK sizes, so the structs are one trailing dword short: `reserved[10] -> reserved[11]`, `reserved[1] -> reserved[2]`. Padding only; no named field moves. (The shim never reads a field of either context — it only allocates `sizeof(...)` zeroed arrays — so only the size matters to it. Where the true GDK puts the byte is still the author's to confirm.) **Verified:** `cmake --build runtime/build --config RelWithDebInfo --target gta6rt` links on `d083a2cc3` with these hunks. **Not fixed here** (separate, and its author's to rewrite): `runtime/test/d3d12_console_descriptor_heap_test.cpp`, added by the same `3630610ca`, does not compile — it uses a `Ref<T>` template this tree does not have and calls `IID_PPV_ARGS` on a `void*`. Method: Windows 11 26300, MSVC 19.52, RelWithDebInfo, Vulkan SDK 1.4.363.0. AI-assisted (OpenCode).
main a60e5eab5 does not compile the runtime. Three source-level breaks, all from the merge train:
- d3d12_xs_device.cpp: Xbox slot 14's proxy calls rt::d3d12::create_console_descriptor_heap but the TU never sees it. Declared out of line rather than including d3d12_com.h, which pulls gfx10_descriptors.h/vulkan_backend.h into the standalone proxy tests that lack the Vulkan include path.
- d3d12_vulkan_device.cpp: the helper needs a non-const DeviceState& (Device::state() is const) and the private Device::identity(); added a non-const state() overload and used the existing public holder().
- acphal.cpp: sizeof(SHAPE_XMA_CONTEXT) was 60 (assert 64) and sizeof(SHAPE_PCM_CONTEXT) 28 (assert 32). The repo ABI test asserts the GDK sizes 64/32, so the structs are one trailing dword short: reserved[10]->[11], reserved[1]->[2].

Verified: gta6rt and the whole target set build, except d3d12_console_descriptor_heap_test (separate break in the same commit: 2-arg create_device_proxy vs 3-arg, undefined Ref<>), left to its author.
AI-assisted (OpenCode).

(cherry picked from commit 100229ff16028803262b4cd8741f874a721c9b92)
The build fix turns the d3d12_xs_device.cpp compile error into a link error for root_sig_test/device_proxy_test/xs_proxy_mock_test (LNK2019). They compile d3d12_xs_device.cpp but do not link d3d12_vulkan_device.cpp where the slot-14 console helper lives. Add an inert E_NOTIMPL definition to those three targets only; the runtime links the real one.
Five more targets compile shims/d3d12_xs_device.cpp and do not link gta6rt_d3d12_com
(the TU that defines the slot-14 console helper), so they hit the same LNK2019:
pe_loader_test, test_pe_loader_bounds, pe_loader_fuzz, and d3d12_xs_root_signature_test
(behind LEONIDA_D3D12_SHIM_TESTS). fsr_dispatch_test and bvh_builder_test already link
gta6rt_d3d12_com, so they must NOT get the stub (it would be LNK2005) - verified both ways.
With this, every configured consumer links.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:50:12 +00:00
github-bot closed this pull request 2026-11-26 08:50:12 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:50 UTC · original

Thank you for this fix. The diagnosis was right, and current main already has it, so I'm closing this draft as superseded:

  • acphal.cpp: the SHAPE XMA/PCM contexts are 64 and 32 bytes (#2, db761be31, and the XMA context was reworked since then), so both static_asserts hold.
  • Slot 14: the proxy reaches the Vulkan layer through set_console_descriptor_heap_handler, the same way slot 133 does. Every Vulkan Device registers it, and a Device member builds the heap (#2, a7ffc53c1). #4 (37246f11d) takes the console layout only when the trailing size equals NumDescriptors * 32, so PC callers are no longer caught by the stack bytes after their desc.
  • d3d12_console_descriptor_heap_test compiles and passes (operator->, the reference handling of create_device_proxy, the start read through heap_proxy_real_heap).

The Runtime windows job compiles all of these files with MSVC 14.52 again. The remaining slot-14 false positive (a stray 32 after a one-descriptor desc) is handled in #1148. If anything from this branch is still missing, please open a new PR from current main. The old-pr/* branch stays, and #17 lists the carried-over drafts.

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

**@⁠aslan2142** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/243#issuecomment-7142655410) Thank you for this fix. The diagnosis was right, and current `main` already has it, so I'm closing this draft as superseded: - `acphal.cpp`: the SHAPE XMA/PCM contexts are 64 and 32 bytes (#2, `db761be31`, and the XMA context was reworked since then), so both `static_assert`s hold. - Slot 14: the proxy reaches the Vulkan layer through `set_console_descriptor_heap_handler`, the same way slot 133 does. Every Vulkan `Device` registers it, and a `Device` member builds the heap (#2, `a7ffc53c1`). #4 (`37246f11d`) takes the console layout only when the trailing size equals `NumDescriptors * 32`, so PC callers are no longer caught by the stack bytes after their desc. - `d3d12_console_descriptor_heap_test` compiles and passes (`operator->`, the reference handling of `create_device_proxy`, the start read through `heap_proxy_real_heap`). The Runtime `windows` job compiles all of these files with MSVC 14.52 again. The remaining slot-14 false positive (a stray `32` after a one-descriptor desc) is handled in #1148. If anything from this branch is still missing, please open a new PR from current `main`. The `old-pr/*` branch stays, and #17 lists the carried-over drafts. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.