Skip to content

runtime: build on MSVC again after the 2026-11-23 merge round, and one root_sig checksum check - #208

Closed
Andretuta wants to merge 2 commits into
mainfrom
old-pr/9941
Closed

Andretuta wants to merge 2 commits into
mainfrom
old-pr/9941

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

Carried over from old PR 9941 by carlos-seiffert in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9941, 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.
carlos-seiffert: 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 at 0b3caaee, after the 2026-11-23 merge round, does not compile with MSVC. gta6rt_d3d12_com, acphal and every test that links them fail. This PR fixes the build, and with it the whole ctest suite runs again. A second commit fixes root_sig, which a merge between two PRs broke.

What was broken

error cause
d3d12_xs_device.cpp(1606): create_console_descriptor_heap is not a member of rt 3630610 calls it without the declaration. Including d3d12_com.h there doesn't work, because d3d12_xs_device.cpp is built into a dozen tests without the Vulkan layer.
d3d12_vulkan_device.cpp(9997/9998): C2665 / C2248 create_console_descriptor_heap passes the const state() to DescriptorHeap and calls the private identity()
acphal.cpp(146/167): static_assert ccd3624's SHAPE_XMA_CONTEXT and SHAPE_PCM_CONTEXT are 60 and 28 bytes with every compiler: the XMA context's third dword holds 24 bits, and a 26-bit field cannot straddle a dword
d3d12_console_descriptor_heap_test.cpp uses Ref's missing operator->, and IID_PPV_ARGS on a void**

The change

  • Slot 14 now calls a handler that the Vulkan layer can register (set_console_descriptor_heap_handler), the way slot 133 already does with set_placed_at_va_handler. The proxy no longer depends on the Vulkan layer.
  • create_console_descriptor_heap forwards to a new Device::create_console_heap member.
  • acphal: the padding now gives the GDK sizes, 64 and 32. Only sizeof is used, as the stride of the context arrays; the bit positions inside the first dwords are not verified.
  • The console heap test gets operator-> and passes the IID explicitly.

Why the handler is not registered by default

I first registered it in Device's constructor. That crashed or failed 8 ctest programs: d3d12_descriptor, d3d12_f16_halves, d3d12_translated_draw, d3d12_m2_textured, d3d12_m2_formats, d3d12_m3_frame, d3d12_m3_first_pass, d3d12_m4_compute, d3d12_buffer_uav.

The cause: slot 14 reads the 16 bytes that follow a 16-byte PC D3D12_DESCRIPTOR_HEAP_DESC. For a PC caller those bytes are whatever is next in memory, usually non-zero, so the heap is created at a garbage address.

So nothing registers it here; the console heap test registers it itself. How slot 14 should tell the console's 32-byte description from a PC one is left to the author of #9576.

Tested

Windows 11 (10.0.26300), MSVC 14.44 (VS 2022 Build Tools 17.14.45), Windows SDK 10.0.26100, Visual Studio 17 2022 generator, RelWithDebInfo, on an NVIDIA RTX 2060 (621.24).

  • Build: with this branch the whole runtime builds, warnings only. main fails with the errors above.
  • ctest: 268 of 273 pass, plus 12 skipped or disabled for missing optional inputs. The 5 failures:
    • On main before the merge round (5d74c272) too: d3d12_vulkan_device (slot 78; #8496 / #9175) and d3d12_depth_resolve.
    • d3d12_execute_indirect_validation: the 5 parity cases #9002 changed. Here WARP and the RTX 2060 both accept them (layer=0 warp=1 hw=1 expected=0; d3d12.dll/D3D12Core.dll 10.0.26100.10068, Windows 26300.10075). That is the same as the RTX 5060 / Arc reports on #9002 with 10.0.26100.9818, so the host answer depends on the D3D12 runtime.
    • d3d12_com (line 345, Close() == E_INVALIDARG after a depth clear of 2.0). The test is unchanged in the round; I'm bisecting the merge that changed it.
    • d3d12_console_descriptor_heap, #9576's own test, which never ran. It passes its direct checks, then calls GetCPUDescriptorHandleForHeapStart through the Xbox heap proxy with the PC calling convention. It gets a garbage handle (got 0x26a47b718b0 want 0x556677880000) and crashes after that. That needs its author.

The root_sig commit

#9492 (c297bb57) and #8959 (b95925cb) each added an incoming-checksum check to the RTS0 rewrite, and the merge kept both:

  • #9492's check runs first and refuses any mismatching checksum, including an all-zero one.
  • #8959's check accepts an all-zero checksum, as the host d3d12.dll does.

So two of #8959's cases fail. root_sig passes right before #8959's merge (be4a51f5) and on #8959's own branch, and fails right after the merge (1e029d6d). Keeping only #8959's check makes it pass in full: #9492's corrupted-blob cases still pass, because #8959's check also refuses any other mismatching checksum.

AI-assisted (Claude Code); no game files.

🤖 Generated with Claude Code

carlos-seiffert and others added 2 commits November 23, 2026 20:19
Main at 0b3caae does not compile with MSVC (gta6rt_d3d12_com, acphal and the
tests that use them):

- d3d12_xs_device.cpp called rt::d3d12::create_console_descriptor_heap
  without its declaration. Including d3d12_com.h there is not an option: the
  proxy is built into a dozen tests without the Vulkan layer. Slot 14 now calls
  a handler the Vulkan layer can register (set_console_descriptor_heap_handler),
  as slot 133 already does.
- create_console_descriptor_heap used Device's private identity() and passed
  the const state() to DescriptorHeap. It now forwards to a Device member.
- acphal.cpp's SHAPE_XMA_CONTEXT and SHAPE_PCM_CONTEXT were 60 and 28 bytes, so
  their static_asserts failed with every compiler. Only sizeof is used (the
  context array stride); the padding now gives the GDK sizes, 64 and 32.
- d3d12_console_descriptor_heap_test used Ref's missing operator-> and
  IID_PPV_ARGS on a void**.

The slot 14 handler is not registered by default: registered for every Vulkan
device, it crashed 8 ctest programs that create PC heaps through the proxy
(the slot reads 16 bytes past a 16-byte PC description). The console heap
test registers it itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…checksum

#9492 and #8959 both added an incoming-checksum check to the RTS0 rewrite, and
the merge kept both. #9492's, first in the function, refuses any checksum that
does not match, including an all-zero one; #8959's accepts an all-zero checksum,
as the host d3d12.dll does, and keeps it zero after the rewrite. With both, the
first refuses what the second is there to accept, so two root_sig cases fail:
"blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero
checksum" and "shim deserializer accepts an all-zero-checksum Xbox blob with
the high byte cleared".

#8959's check still refuses any other mismatching checksum, so #9492's
corrupted-blob cases keep passing: root_sig passes in full with MSVC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
@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.

3 participants