runtime: add layout helpers and unit test suite for Xbox resource desc cleaning (RT-XS-DESC-CLEAN-COVERAGE) #2049

Closed
leonida/mandy
abnalstlll-byte wants to merge 0 commits from feat/rt-xs-desc-clean-coverage into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

abnalstlll-byte commented 2026-11-25 19:02:01 +00:00

Claimed in the coordination issue as: RT-XS-DESC-CLEAN-COVERAGE (claim)

What and why

runtime/shims/d3d12_xs_desc_clean.h provides translation and sanitization of console D3D12_RESOURCE_DESC descriptions for PC device methods (slot 25 GetResourceAllocationInfo, slot 76 CreateCommittedResource, and slot 127).

  1. Console layout identification helper:

    • Added is_xbox_resource_layout(D3D12_TEXTURE_LAYOUT layout) identifying console-specific layout words (such as 0x101, 0x102, 0x105, 0x200) while preserving standard PC layouts (UNKNOWN, ROW_MAJOR, 64KB_UNDEFINED_SWIZZLE, 64KB_STANDARD_SWIZZLE).
  2. Unit test suite (runtime/test/d3d12_xs_desc_clean_test.cpp):

    • 63 assertions verifying:
      • PC flags mask (kPcResourceFlagsMask) retaining all 9 standard PC flags and masking out high console-only bits.
      • is_xbox_resource_layout accurately classifying console vs PC layouts.
      • is_depth_resource_format covering standard depth/stencil and typeless formats as well as console format 118 (D16_UNORM_S8_UINT), while rejecting color and typeless non-depth formats.
      • without_depth_stencil_uav stripping UAV on texture dimensions while preserving UAV on buffer dimensions.
      • pc_resource_desc normalizing console tiled layouts to D3D12_TEXTURE_LAYOUT_ROW_MAJOR for buffers and D3D12_TEXTURE_LAYOUT_UNKNOWN for textures, preserving PC layouts, stripping high console bits, and stripping UAV on depth-stencil and B5G5R5A1_UNORM formats while preserving all geometry, mip levels, and sample descriptions.

Registers d3d12_xs_desc_clean_test and CTest in runtime/CMakeLists.txt.

Tested

  • Unit test execution: 63/63 checks passed (0 failures).
  • python -I tests/test_ci_registration.py: 16/16 pass.
  • python -I tests/test_text_write_line_endings.py: 3/3 pass.
  • python -I scripts/check_no_game_data.py: clean (0 violations, no game data).

AI-assisted (Claude Code)

Claimed in the coordination issue as: RT-XS-DESC-CLEAN-COVERAGE ([claim](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171677935)) ### What and why `runtime/shims/d3d12_xs_desc_clean.h` provides translation and sanitization of console `D3D12_RESOURCE_DESC` descriptions for PC device methods (slot 25 `GetResourceAllocationInfo`, slot 76 `CreateCommittedResource`, and slot 127). 1. **Console layout identification helper**: - Added `is_xbox_resource_layout(D3D12_TEXTURE_LAYOUT layout)` identifying console-specific layout words (such as `0x101`, `0x102`, `0x105`, `0x200`) while preserving standard PC layouts (`UNKNOWN`, `ROW_MAJOR`, `64KB_UNDEFINED_SWIZZLE`, `64KB_STANDARD_SWIZZLE`). 2. **Unit test suite (`runtime/test/d3d12_xs_desc_clean_test.cpp`)**: - 63 assertions verifying: - PC flags mask (`kPcResourceFlagsMask`) retaining all 9 standard PC flags and masking out high console-only bits. - `is_xbox_resource_layout` accurately classifying console vs PC layouts. - `is_depth_resource_format` covering standard depth/stencil and typeless formats as well as console format 118 (`D16_UNORM_S8_UINT`), while rejecting color and typeless non-depth formats. - `without_depth_stencil_uav` stripping UAV on texture dimensions while preserving UAV on buffer dimensions. - `pc_resource_desc` normalizing console tiled layouts to `D3D12_TEXTURE_LAYOUT_ROW_MAJOR` for buffers and `D3D12_TEXTURE_LAYOUT_UNKNOWN` for textures, preserving PC layouts, stripping high console bits, and stripping UAV on depth-stencil and `B5G5R5A1_UNORM` formats while preserving all geometry, mip levels, and sample descriptions. Registers `d3d12_xs_desc_clean_test` and CTest in `runtime/CMakeLists.txt`. ### Tested - Unit test execution: `63/63 checks passed` (0 failures). - `python -I tests/test_ci_registration.py`: 16/16 pass. - `python -I tests/test_text_write_line_endings.py`: 3/3 pass. - `python -I scripts/check_no_game_data.py`: clean (0 violations, no game data). AI-assisted (Claude Code)
MoonEyes commented 2026-11-28 02:48:57 +00:00

Hi @abnalstlll-byte, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/CMakeLists.txt), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

Hi @abnalstlll-byte, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/CMakeLists.txt`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
OreoFR commented 2026-11-29 11:36:39 +00:00

TAKEN by OreoFR (Windows, RTX 4070 8 GB)

TAKEN by OreoFR (Windows, RTX 4070 8 GB)
OreoFR commented 2026-11-29 12:38:10 +00:00

Verified by OreoFR — NO RED (test coverage plus an unused helper)

  • Base: main 8fb974878 + this PR (head 853c9ac70) merged with --no-ff (still no conflict with main cc0f662a7; the runtime/CMakeLists.txt conflict in the needs-rebase note is gone)
  • Red (main + this PR's test + its CMake registration): the test does not compile on main (is_xbox_resource_layout is new). With that section removed, it passes on main (55/55): the PR covers existing behaviour and changes none.
  • Green (merge): d3d12_xs_desc_clean 63/63; ctest in its own package (main + #2049 only): 502 tests, new failures vs main: none (xbox_present fails as on main). ctest settings: Ninja RelWithDebInfo, all targets, gta6rt launchers excluded; main alone 501 tests, 2 failures (xbox_present, dxgi_waitable_latency).
  • gta6rt.exe links without the XMA decoder (LEONIDA_CARGO=OFF, LEONIDA_XMA2_DECODER_LIB empty); imports unchanged vs main (25 DLLs, no WS2_32)
  • Diff read: no bug. is_xbox_resource_layout in runtime/shims/d3d12_xs_desc_clean.h is called only by the test and nowhere in the runtime, so a maintainer may want it dropped or wired in.
  • Other runs: none before this one.
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

**Verified by OreoFR** — NO RED (test coverage plus an unused helper) - Base: main 8fb974878 + this PR (head 853c9ac70) merged with --no-ff (still no conflict with main cc0f662a7; the `runtime/CMakeLists.txt` conflict in the needs-rebase note is gone) - Red (main + this PR's test + its CMake registration): the test does not compile on main (`is_xbox_resource_layout` is new). With that section removed, it passes on main (55/55): the PR covers existing behaviour and changes none. - Green (merge): `d3d12_xs_desc_clean` 63/63; ctest in its own package (main + #2049 only): 502 tests, new failures vs main: none (xbox_present fails as on main). ctest settings: Ninja RelWithDebInfo, all targets, gta6rt launchers excluded; main alone 501 tests, 2 failures (xbox_present, dxgi_waitable_latency). - gta6rt.exe links without the XMA decoder (`LEONIDA_CARGO=OFF`, `LEONIDA_XMA2_DECODER_LIB` empty); imports unchanged vs main (25 DLLs, no WS2_32) - Diff read: no bug. `is_xbox_resource_layout` in `runtime/shims/d3d12_xs_desc_clean.h` is called only by the test and nowhere in the runtime, so a maintainer may want it dropped or wired in. - Other runs: none before this one. - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
aslan2142 commented 2026-12-01 16:41:46 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.