runtime: build again on MSVC after #9576 (slot 14 console descriptor heap) #141

Closed
github-bot wants to merge 1 commit from gh-pr/141/head into gh-pr/141/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:26 UTC · original
ubiquitarianism:old-pr/9873 → main · +34 −5 · 4 files · 1 commits · closed without merging

Carried over from old PR 9873 by MiguelMatMar in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9873, 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.
MiguelMatMar: 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 2d53a8055 doesn't build the runtime on Windows/MSVC. This fixes the #9576 half; the #9515 half (acphal.cpp struct sizes) is left alone.

  • d3d12_xs_device.cpp called rt::d3d12::create_console_descriptor_heap, which isn't declared there and isn't linked into the tests that build the file without the Vulkan layer (device_proxy_test, bvh_builder_test, …). It now goes through a handler, set_console_descriptor_heap_handler, like slot 133's set_placed_at_va_handler.
  • The handler is opt-in. Slot 14 reads 16 bytes past a PC descriptor and takes any non-zero word there for a console address. When the handler was registered by default, d3d12_f16_halves crashed, because that stack word held garbage.
  • create_console_descriptor_heap used the private Device::identity() and passed a const DeviceState& to DescriptorHeap. Device::new_console_descriptor_heap now makes the heap.
  • The test now compiles: Ref<T> gets operator->, create_device_proxy gets its IID, and the test registers the handler.

Still open: d3d12_console_descriptor_heap fails on its own check: proxy CPU heap start mismatch: got <host pointer> want 0x556677880000. The console-address feature needs more work. This change only makes the build work again without changing behaviour for PC callers.

The SHAPE structs in acphal.cpp are 60 and 28 bytes as written, against static_asserts of 64 and 32, so each is one dword short of the GDK layout. Every compiler fails on that, not just MSVC. It needs the #9515 author.

Tested: Windows 11, MSVC 14.44, Ninja RelWithDebInfo, RTX 4080 SUPER (driver 621.24). With acphal.cpp still failing, every other target builds. device_proxy, device_proxy_trace and d3d12_f16_halves pass; fsr_dispatch, bvh_builder and d3d12_first_light skip. root_sig fails two all-zero-checksum cases, as it does on main without this change (unrelated).

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠Andretuta** on GitHub · 2026-11-24 02:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/141) `ubiquitarianism:old-pr/9873` → `main` · +34 −5 · 4 files · 1 commits · closed without merging > Carried over from **old PR 9873** by `MiguelMatMar` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9873`, 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. > `MiguelMatMar`: 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` 2d53a8055 doesn't build the runtime on Windows/MSVC. This fixes the `#9576` half; the `#9515` half (`acphal.cpp` struct sizes) is left alone. - `d3d12_xs_device.cpp` called `rt::d3d12::create_console_descriptor_heap`, which isn't declared there and isn't linked into the tests that build the file without the Vulkan layer (`device_proxy_test`, `bvh_builder_test`, …). It now goes through a handler, `set_console_descriptor_heap_handler`, like slot 133's `set_placed_at_va_handler`. - The handler is **opt-in**. Slot 14 reads 16 bytes past a PC descriptor and takes any non-zero word there for a console address. When the handler was registered by default, `d3d12_f16_halves` crashed, because that stack word held garbage. - `create_console_descriptor_heap` used the private `Device::identity()` and passed a `const DeviceState&` to `DescriptorHeap`. `Device::new_console_descriptor_heap` now makes the heap. - The test now compiles: `Ref<T>` gets `operator->`, `create_device_proxy` gets its IID, and the test registers the handler. **Still open:** `d3d12_console_descriptor_heap` fails on its own check: `proxy CPU heap start mismatch: got <host pointer> want 0x556677880000`. The console-address feature needs more work. This change only makes the build work again without changing behaviour for PC callers. The SHAPE structs in `acphal.cpp` are 60 and 28 bytes as written, against `static_assert`s of 64 and 32, so each is one dword short of the GDK layout. Every compiler fails on that, not just MSVC. It needs the `#9515` author. Tested: Windows 11, MSVC 14.44, Ninja RelWithDebInfo, RTX 4080 SUPER (driver 621.24). With `acphal.cpp` still failing, every other target builds. `device_proxy`, `device_proxy_trace` and `d3d12_f16_halves` pass; `fsr_dispatch`, `bvh_builder` and `d3d12_first_light` skip. `root_sig` fails two all-zero-checksum cases, as it does on main without this change (unrelated). AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- d3d12_xs_device.cpp called rt::d3d12::create_console_descriptor_heap, which is
  neither declared there nor linked into the tests that build the file without
  the Vulkan layer. It now goes through a handler (set_console_descriptor_heap_handler),
  as slot 133 does.
- The handler is opt-in. The slot reads 16 bytes past a PC descriptor and takes any
  non-zero word there for a console address. Registered by default, that made
  d3d12_f16_halves crash.
- create_console_descriptor_heap used the private Device::identity() and passed a
  const DeviceState to DescriptorHeap; Device now makes the heap itself.
- d3d12_console_descriptor_heap_test: Ref<T> gets operator->, create_device_proxy
  gets its IID, and the test registers the handler. It still fails on its own check
  (the proxy's CPU heap start is the host pointer, not the console address).

AI-assisted (Claude Code). Windows 11, MSVC 14.44, RTX 4080 SUPER.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:46:11 +00:00
github-bot closed this pull request 2026-11-26 08:46:11 +00:00
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 04:40 UTC · original

What happens

The MSVC build fails in the slot-14 descriptor heap changes with C3083/C2039/C3861, C2665 and C2248. Independent reproduction of the build regression addressed by this PR.

Commit

First parent f5bcc679d0371f70795ddbe69a4ebaebdd2c3640: builds and all six xs_proxy_mock tests pass. Applying only the first-parent diff of 93b2551f8dac60102fe6ed701cc3b512f68d0768 introduces the failures. The same errors reproduced independently on f48adad76119c45aed89ab612e46d87b10463cec.

System

Windows 10 22H2 (19045.6466), Core i7-7700K, RTX 5070, NVIDIA 610.88, CPython 3.14, MSVC 19.51.36256, Windows SDK 10.0.26100.0, Vulkan-Headers 1.4.363. Ninja Release with static CRT, Vulkan enabled and SDL3 disabled. LLVM and the Vulkan validation layer were not used.

Where

runtime

Command and steps

Configure the runtime with CMake and Ninja on native Windows using the same flags for each tree. Build the two targets below on the first parent. Repeat after applying the merge's first-parent diff, or on the later snapshot above.

cmake --build <build-dir> --target gta6rt_d3d12_com xs_proxy_mock_test
ctest --test-dir <build-dir> -V -R '^xs_proxy_mock.*$'

Output

d3d12_xs_device.cpp:1602: C3083, C2039, C3861
  rt::d3d12::create_console_descriptor_heap is not declared in this translation unit.
d3d12_vulkan_device.cpp:9627: C2665
  Cannot convert const DeviceState to DeviceState& for DescriptorHeap.
d3d12_vulkan_device.cpp:9628: C2248
  Device::identity() is private.
ninja: build stopped: subcommand failed.

Locations are from the merge snapshot. They move to 1606 and 9995–9996 in the later snapshot. Public source and synthetic tests only. This result identifies the merge that introduced the build break; it does not test the fix in this PR. AI-assisted.

**@⁠Dezmonius** on GitHub · 2026-11-24 04:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/141#issuecomment-7122240831) **What happens** The MSVC build fails in the slot-14 descriptor heap changes with C3083/C2039/C3861, C2665 and C2248. Independent reproduction of the build regression addressed by this PR. **Commit** First parent `f5bcc679d0371f70795ddbe69a4ebaebdd2c3640`: builds and all six `xs_proxy_mock` tests pass. Applying only the first-parent diff of `93b2551f8dac60102fe6ed701cc3b512f68d0768` introduces the failures. The same errors reproduced independently on `f48adad76119c45aed89ab612e46d87b10463cec`. **System** Windows 10 22H2 (19045.6466), Core i7-7700K, RTX 5070, NVIDIA 610.88, CPython 3.14, MSVC 19.51.36256, Windows SDK 10.0.26100.0, Vulkan-Headers 1.4.363. Ninja Release with static CRT, Vulkan enabled and SDL3 disabled. LLVM and the Vulkan validation layer were not used. **Where** runtime **Command and steps** Configure the runtime with CMake and Ninja on native Windows using the same flags for each tree. Build the two targets below on the first parent. Repeat after applying the merge's first-parent diff, or on the later snapshot above. ```text cmake --build <build-dir> --target gta6rt_d3d12_com xs_proxy_mock_test ctest --test-dir <build-dir> -V -R '^xs_proxy_mock.*$' ``` **Output** ```text d3d12_xs_device.cpp:1602: C3083, C2039, C3861 rt::d3d12::create_console_descriptor_heap is not declared in this translation unit. d3d12_vulkan_device.cpp:9627: C2665 Cannot convert const DeviceState to DeviceState& for DescriptorHeap. d3d12_vulkan_device.cpp:9628: C2248 Device::identity() is private. ninja: build stopped: subcommand failed. ``` Locations are from the merge snapshot. They move to 1606 and 9995–9996 in the later snapshot. Public source and synthetic tests only. This result identifies the merge that introduced the build break; it does not test the fix in this PR. AI-assisted.
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 04:48 UTC · original

Follow-up to my earlier build regression report. I built unmodified main@d2cd6c0d, which includes the registered heap handler (a7ffc53c), the descriptor-size check (37246f11), and the SHAPE context fix (db761be31).

Native Windows 10 22H2 (19045.6466), RTX 5070 / NVIDIA 610.88, MSVC 19.51.36256, Windows SDK 10.0.26100, Vulkan-Headers 1.4.363, Ninja Release/static CRT. gta6rt.exe and all five selected test binaries built. 11/11 CTests passed, including d3d12_console_descriptor_heap, acphal, the two device_proxy tests, and all six xs_proxy_mock variants.

This is a verification of the current main tree. It did not build the draft PR head. Synthetic tests only. AI-assisted.

**@⁠Dezmonius** on GitHub · 2026-11-24 04:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/141#issuecomment-7122351031) Follow-up to my earlier build regression report. I built unmodified `main@d2cd6c0d`, which includes the registered heap handler (`a7ffc53c`), the descriptor-size check (`37246f11`), and the SHAPE context fix (`db761be31`). Native Windows 10 22H2 (19045.6466), RTX 5070 / NVIDIA 610.88, MSVC 19.51.36256, Windows SDK 10.0.26100, Vulkan-Headers 1.4.363, Ninja Release/static CRT. `gta6rt.exe` and all five selected test binaries built. **11/11 CTests passed**, including `d3d12_console_descriptor_heap`, `acphal`, the two `device_proxy` tests, and all six `xs_proxy_mock` variants. This is a verification of the current main tree. It did not build the draft PR head. Synthetic tests only. AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:49 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:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/141#issuecomment-7142646996) 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.