runtime: main builds again (console descriptor heap handler, acphal context sizes) #330

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

@⁠Andretuta on GitHub · 2026-11-24 03:11 UTC · original
ubiquitarianism:old-pr/10065 → main · +86 −25 · 6 files · 1 commits · closed without merging

Carried over from old PR 10065 by Mumogg in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10065, 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.
Mumogg: 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):

What

main does not compile at de4c37383 (first seen at 2d53a8055), with clang-cl and by the look of the errors with any compiler. This makes it build and keeps the tests that were passing before green.

Error Fix
d3d12_xs_device.cpp: no member named 'd3d12' in namespace 'rt' at the call to rt::d3d12::create_console_descriptor_heap That file is also built without the Vulkan layer (the mock and COM tests), so it cannot name it. Slot 14 reaches the layer through a registered handler (set_console_descriptor_heap_handler), the way slot 133 does with set_placed_at_va_handler. With none registered it makes a plain PC heap.
d3d12_vulkan_device.cpp: no matching constructor for initialization of 'DescriptorHeap' (a const DeviceState), and 'identity' is a private member create_console_descriptor_heap built the heap from outside Device. Device::make_console_descriptor_heap does it now, with state_ and identity().
acphal.cpp: static_assert(sizeof(SHAPE_XMA_CONTEXT) == 64) and sizeof(SHAPE_PCM_CONTEXT) == 32 fail The fields add up to 60 and 28 bytes. One more reserved dword each; the named fields keep their offsets. I took the asserted sizes as the intended ones and did not check them against the GDK.
d3d12_console_descriptor_heap_test.cpp does not compile Ref had no operator->, and create_device_proxy and vktest::Device were called with signatures they do not have. The target also listed shims/d3d12_xs_device.cpp, which gta6rt_d3d12_com already holds.

One behaviour change, found once the path compiled

d3d12_descriptor_test faulted on a descriptor write. A PC caller passes a 16-byte description; the 16 bytes after it are its stack, and a non-zero value there was read as the console address. Slot 14 now takes the console path only when size == NumDescriptors * GetDescriptorHandleIncrementSize(type) as well. That is an assumption about the console call, marked as one in the code: I have not measured it on a retail call. If the title passes another size, the check is what to change; the test now covers "a tail that is not address/size makes a plain heap".

Two more things were wrong in the new test and are fixed: it read the heap proxy's slot 9 with the PC calling convention (the proxy returns the handle in RAX), and it released the device twice (create_device_proxy takes over one reference).

Tested

Linux (Nobara 44), clang-cl 22.1.8 + xwin SDK 10.0.26100, Wine 11.21 staging, RTX 5070 Ti (NVIDIA 615.78.08). No game files.

  • All runtime targets build (before: 3 translation units failed, so there is no baseline run of unmodified main to compare with).
  • d3d12_console_descriptor_heap: pass. d3d12_descriptor: pass (faulted with the path enabled and no size check). xs_proxy_mock (6 variants), acphal, queue_proxy, d3d12_set_descriptor_heaps: pass.
  • Full ctest -j 4 under Wine: 272 of 297 pass. The failures are Wine-side ones this machine also had on older main (device_proxy, file_system, gameinput_host, d3d12_clear, ...) plus present and DXGI tests that need a display that was asleep during the run; I did not triage each one against this change.
  • python -I scripts/check_no_game_data.py on the six files: clean.

Not run: MSVC, Windows CI.

Not claimed in the coordination issue: commenting is restricted to collaborators at the moment, so I could not post the claim line.

AI-assisted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt

**@⁠Andretuta** on GitHub · 2026-11-24 03:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/330) `ubiquitarianism:old-pr/10065` → `main` · +86 −25 · 6 files · 1 commits · closed without merging > Carried over from **old PR 10065** by `Mumogg` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10065`, 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. > `Mumogg`: 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): ### What `main` does not compile at `de4c37383` (first seen at `2d53a8055`), with clang-cl and by the look of the errors with any compiler. This makes it build and keeps the tests that were passing before green. | Error | Fix | |---|---| | `d3d12_xs_device.cpp`: `no member named 'd3d12' in namespace 'rt'` at the call to `rt::d3d12::create_console_descriptor_heap` | That file is also built without the Vulkan layer (the mock and COM tests), so it cannot name it. Slot 14 reaches the layer through a registered handler (`set_console_descriptor_heap_handler`), the way slot 133 does with `set_placed_at_va_handler`. With none registered it makes a plain PC heap. | | `d3d12_vulkan_device.cpp`: `no matching constructor for initialization of 'DescriptorHeap'` (a `const DeviceState`), and `'identity' is a private member` | `create_console_descriptor_heap` built the heap from outside `Device`. `Device::make_console_descriptor_heap` does it now, with `state_` and `identity()`. | | `acphal.cpp`: `static_assert(sizeof(SHAPE_XMA_CONTEXT) == 64)` and `sizeof(SHAPE_PCM_CONTEXT) == 32` fail | The fields add up to 60 and 28 bytes. One more reserved dword each; the named fields keep their offsets. I took the asserted sizes as the intended ones and did not check them against the GDK. | | `d3d12_console_descriptor_heap_test.cpp` does not compile | `Ref` had no `operator->`, and `create_device_proxy` and `vktest::Device` were called with signatures they do not have. The target also listed `shims/d3d12_xs_device.cpp`, which `gta6rt_d3d12_com` already holds. | ### One behaviour change, found once the path compiled `d3d12_descriptor_test` faulted on a descriptor write. A PC caller passes a 16-byte description; the 16 bytes after it are its stack, and a non-zero value there was read as the console address. Slot 14 now takes the console path only when `size == NumDescriptors * GetDescriptorHandleIncrementSize(type)` as well. **That is an assumption about the console call, marked as one in the code**: I have not measured it on a retail call. If the title passes another size, the check is what to change; the test now covers "a tail that is not address/size makes a plain heap". Two more things were wrong in the new test and are fixed: it read the heap proxy's slot 9 with the PC calling convention (the proxy returns the handle in RAX), and it released the device twice (`create_device_proxy` takes over one reference). ### Tested Linux (Nobara 44), clang-cl 22.1.8 + xwin SDK 10.0.26100, Wine 11.21 staging, RTX 5070 Ti (NVIDIA 615.78.08). No game files. - All runtime targets build (before: 3 translation units failed, so there is no baseline run of unmodified `main` to compare with). - `d3d12_console_descriptor_heap`: pass. `d3d12_descriptor`: pass (faulted with the path enabled and no size check). `xs_proxy_mock` (6 variants), `acphal`, `queue_proxy`, `d3d12_set_descriptor_heaps`: pass. - Full `ctest -j 4` under Wine: 272 of 297 pass. The failures are Wine-side ones this machine also had on older `main` (`device_proxy`, `file_system`, `gameinput_host`, `d3d12_clear`, ...) plus present and DXGI tests that need a display that was asleep during the run; I did not triage each one against this change. - `python -I scripts/check_no_game_data.py` on the six files: clean. Not run: MSVC, Windows CI. Not claimed in the coordination issue: commenting is restricted to collaborators at the moment, so I could not post the claim line. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
main at 2d53a8055 does not compile:

- d3d12_xs_device.cpp called rt::d3d12::create_console_descriptor_heap, which
  that file never declares: it is also built without the Vulkan layer (mock
  and COM tests). Slot 14 now reaches the layer through a registered handler,
  as slot 133 does (set_placed_at_va_handler); with none registered it makes a
  plain PC heap.
- create_console_descriptor_heap built the heap from outside Device with a
  const DeviceState and the private identity(). Device makes it itself now.
- acphal.cpp: SHAPE_XMA_CONTEXT and SHAPE_PCM_CONTEXT were 60 and 28 bytes
  against static_asserts of 64 and 32. One more reserved dword each; the named
  fields keep their offsets.
- d3d12_console_descriptor_heap_test did not compile (Ref has no operator->,
  create_device_proxy and vktest::Device were called with signatures they do
  not have) and linked d3d12_xs_device.cpp a second time.

With the path compiling, d3d12_descriptor_test faulted: a PC caller passes a
16-byte description, the next 16 bytes are its stack, and a non-zero "address"
there sent it down the console path. The path now also wants
size == NumDescriptors * increment (an assumption about the console call,
marked as one), and the test checks that a tail which is not address/size
makes a plain heap. The test also read the heap proxy's slot 9 with the PC
calling convention and released the device twice.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:53:44 +00:00
github-bot closed this pull request 2026-11-26 08:53:44 +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/330#issuecomment-7142661122) 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.