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

Open
github-bot wants to merge 1 commit from github-bot/gh-2049 into main AGit
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-25 19:02 UTC · original
abnalstlll-byte:feat/rt-xs-desc-clean-coverage → main · +214 −0 · 3 files · 1 commits · open

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)

**@⁠abnalstlll-byte** on GitHub · 2026-11-25 19:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2049) `abnalstlll-byte:feat/rt-xs-desc-clean-coverage` → `main` · +214 −0 · 3 files · 1 commits · open Claimed in the coordination issue as: RT-XS-DESC-CLEAN-COVERAGE ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608)) ### 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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:16:04 +00:00
This pull request has changes conflicting with the target branch.
  • runtime/CMakeLists.txt
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2049/head:github-bot/gh-2049'
git switch 'github-bot/gh-2049'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2049'
git switch 'github-bot/gh-2049'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2049'
git switch 'github-bot/gh-2049'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2049'
git switch 'main'
git merge --squash 'github-bot/gh-2049'
git switch 'main'
git merge --ff-only 'github-bot/gh-2049'
git switch 'main'
git merge 'github-bot/gh-2049'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.