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

Open
opened 2026-11-26 21:19:52 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2049
Author: @abnalstlll-byte
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: feat/rt-xs-desc-clean-coverage


📝 Commits (1)

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

📊 Changes

3 files changed (+214 additions, -0 deletions)

View changed files

📝 runtime/CMakeLists.txt (+8 -0)
📝 runtime/shims/d3d12_xs_desc_clean.h (+8 -0)
➕ runtime/test/d3d12_xs_desc_clean_test.cpp (+198 -0)

📄 Description

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)


🔄 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/2049 **Author:** [@abnalstlll-byte](https://github.com/abnalstlll-byte) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/rt-xs-desc-clean-coverage` --- ### 📝 Commits (1) - [`853c9ac`](https://github.com/ubiquitarianism/leonida/commit/853c9ac70b6d715a8435d3b6f0e909858b694f54) runtime: add layout helpers and unit test suite for Xbox resource desc cleaning (RT-XS-DESC-CLEAN-COVERAGE) ### 📊 Changes **3 files changed** (+214 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+8 -0) 📝 `runtime/shims/d3d12_xs_desc_clean.h` (+8 -0) ➕ `runtime/test/d3d12_xs_desc_clean_test.cpp` (+198 -0) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2055
No description provided.