[PR #87] [CLOSED] runtime/shims: fix acphal context sizes and guard Vulkan heap helper on non-Vulkan builds #139

Closed
opened 2026-11-26 20:16:55 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/87
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/9815


📝 Commits (2)

  • 213186e runtime/shims: fix SHAPE_XMA/PCM_CONTEXT sizes in acphal and guard Vulkan heap helper in d3d12_xs_device
  • 0285d16 runtime: fix Vulkan ConsoleDescriptorHeap compile errors on MSVC

📊 Changes

4 files changed (+12 additions, -7 deletions)

View changed files

📝 runtime/shims/acphal.cpp (+2 -2)
📝 runtime/shims/d3d12_vulkan_device.cpp (+2 -1)
📝 runtime/shims/d3d12_xs_device.cpp (+5 -0)
📝 runtime/test/d3d12_console_descriptor_heap_test.cpp (+3 -4)

📄 Description

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

Fixes two CPU-only Windows MSVC build regressions on main (2d53a8055):

Changes

  1. runtime/shims/acphal.cpp:
    • Fix SHAPE_XMA_CONTEXT padding (reserved[10] -> reserved[11]): the preceding 24-bit bitfield group followed by 26-bit currentByteOffset splits into separate 32-bit storage units under MSVC, making the struct 60 bytes and failing static_assert(sizeof(SHAPE_XMA_CONTEXT) == 64). Static analysis of game_scarlett_master.exe confirms shl r8, 6 (64-byte stride) when zeroing the XMA context array.
    • Fix SHAPE_PCM_CONTEXT padding (reserved[1] -> reserved[2]): 6 32-bit bitfield words + 1 reserved dword was 28 bytes, failing static_assert(sizeof(SHAPE_PCM_CONTEXT) == 32).
  2. runtime/shims/d3d12_xs_device.cpp:
    • Include "d3d12_com.h" and call rt::d3d12::create_console_descriptor_heap(...) only when LEONIDA_VULKAN_DEVICE is defined, so CPU-only gta6rt builds (without Vulkan headers/device) compile and link cleanly and fall back to standard CreateDescriptorHeap.

Verification

  • Full cmake -S runtime -B build_fix + cmake --build build_fix --config Release -j: built gta6rt.exe and all CPU test targets cleanly on MSVC 19.44 (10.0.26100.0 SDK).
  • ctest --test-dir build_fix -C Release -R "acphal|device_proxy|xs_proxy|com_shim|bcrypt_rng": 12/12 passed.
  • python tests/test_acphal_abi.py: 4/4 OK.
  • python tests/test_ctest_registration.py: 4/4 OK.
  • gta6rt.exe --dry-run game_scarlett_master.exe: resolves AcpHal.dll (9/9 exports via shim).
  • python scripts/check_no_game_data.py, git diff --check.
  • Claimed on #9677 (https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116626255).

AI-assisted: yes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/87 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/9815` --- ### 📝 Commits (2) - [`213186e`](https://github.com/ubiquitarianism/leonida/commit/213186e89fd938593d18eba60f7bb13c99592911) runtime/shims: fix SHAPE_XMA/PCM_CONTEXT sizes in acphal and guard Vulkan heap helper in d3d12_xs_device - [`0285d16`](https://github.com/ubiquitarianism/leonida/commit/0285d161d1008598cdc15caa0b41d235f5abd8ea) runtime: fix Vulkan ConsoleDescriptorHeap compile errors on MSVC ### 📊 Changes **4 files changed** (+12 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/acphal.cpp` (+2 -2) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+2 -1) 📝 `runtime/shims/d3d12_xs_device.cpp` (+5 -0) 📝 `runtime/test/d3d12_console_descriptor_heap_test.cpp` (+3 -4) </details> ### 📄 Description > Carried over from **old PR 9815** by `piyonchu` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9815`, 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. > `piyonchu`: 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): Fixes two CPU-only Windows MSVC build regressions on `main` (`2d53a8055`): ### Changes 1. [`runtime/shims/acphal.cpp`](runtime/shims/acphal.cpp): - Fix `SHAPE_XMA_CONTEXT` padding (`reserved[10]` -> `reserved[11]`): the preceding 24-bit bitfield group followed by 26-bit `currentByteOffset` splits into separate 32-bit storage units under MSVC, making the struct 60 bytes and failing `static_assert(sizeof(SHAPE_XMA_CONTEXT) == 64)`. Static analysis of `game_scarlett_master.exe` confirms `shl r8, 6` (64-byte stride) when zeroing the XMA context array. - Fix `SHAPE_PCM_CONTEXT` padding (`reserved[1]` -> `reserved[2]`): 6 32-bit bitfield words + 1 reserved dword was 28 bytes, failing `static_assert(sizeof(SHAPE_PCM_CONTEXT) == 32)`. 2. [`runtime/shims/d3d12_xs_device.cpp`](runtime/shims/d3d12_xs_device.cpp): - Include `"d3d12_com.h"` and call `rt::d3d12::create_console_descriptor_heap(...)` only when `LEONIDA_VULKAN_DEVICE` is defined, so CPU-only `gta6rt` builds (without Vulkan headers/device) compile and link cleanly and fall back to standard `CreateDescriptorHeap`. ### Verification - Full `cmake -S runtime -B build_fix` + `cmake --build build_fix --config Release -j`: built `gta6rt.exe` and all CPU test targets cleanly on MSVC 19.44 (`10.0.26100.0` SDK). - `ctest --test-dir build_fix -C Release -R "acphal|device_proxy|xs_proxy|com_shim|bcrypt_rng"`: `12/12` passed. - `python tests/test_acphal_abi.py`: `4/4` OK. - `python tests/test_ctest_registration.py`: `4/4` OK. - `gta6rt.exe --dry-run game_scarlett_master.exe`: resolves `AcpHal.dll` (9/9 exports via `shim`). - `python scripts/check_no_game_data.py`, `git diff --check`. - Claimed on `#9677` (`https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116626255`). AI-assisted: yes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:55 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#139
No description provided.