Skip to content

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

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/9873
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/9873

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

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 2d53a80 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

…slot 14)

- 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 <noreply@anthropic.com>
@Dezmonius

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

@aslan2142

Copy link
Copy Markdown
Collaborator

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

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 aslan2142 closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants