[PR #588] d3d12: the Xbox D16_UNORM_S8_UINT depth format (118) and its plane views (RT-XBOX-D16S8) #632

Open
opened 2026-11-26 20:18:32 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/588
Author: @MrCloudy2
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: rt-d16s8


📝 Commits (1)

  • df1bb7c d3d12: the Xbox D16_UNORM_S8_UINT depth format (118) and its plane views (RT-XBOX-D16S8)

📊 Changes

4 files changed (+243 additions, -3 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+10 -0)
📝 runtime/CMakeLists.txt (+8 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+40 -3)
➕ runtime/test/d3d12_xbox_d16s8_test.cpp (+185 -0)

📄 Description

Claimed in the coordination issue as: RT-XBOX-D16S8 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7127190120)

What and why

DXGI_FORMAT 118, past B4G4R4A4_UNORM, is the console's D16_UNORM_S8_UINT. Its plane views are 119 R16_UNORM_X8_TYPELESS (depth) and 120 X16_TYPELESS_G8_UINT (stencil). #461's XG layout table treats 118–120 as one 2-byte depth family too.

The Vulkan-backed device knew none of them, so two things failed:

  • GetResourceAllocationInfo gave UINT64_MAX for a 118 depth buffer. The retail executable sizes one at start-up and asserts on that answer.
  • Pipelines with DSVFormat = 118 were refused (depth-stencil format not supported: 118).

Vulkan's D16_UNORM_S8_UINT is missing on NVIDIA and RADV, so a 118 texture is a D32_SFLOAT_S8_UINT image on every GPU. A 16-bit depth value is held as a float and read back through the depth view as the same [0, 1] value.

  • vulkan_format: 118 → D32_SFLOAT_S8_UINT, depth and stencil aspects.
  • format_family and depth_stencil_family: 118–120 form one depth-stencil family. Creation with ALLOW_DEPTH_STENCIL and a 118 clear value passes.
  • image_descriptor: 119 (or UNKNOWN) is 118's depth-plane SRV format, and 120 is its stencil-plane format.
  • CheckFeatureSupport: FORMAT_INFO gives two planes for all three formats. FORMAT_SUPPORT answers with the D32S8 family's answers and gives the caller its Format back.
  • docs/d3d12_vulkan.md: a paragraph next to the D24-as-D32 one.

Not done (documented): a footprint copy of the depth plane has the D32 texel size, 4 bytes instead of 2. There is no conversion pass as there is for D24, and nothing measured makes such a copy yet.

Tested

  • New d3d12_xbox_d16s8_test (CTest d3d12_xbox_d16s8): passes. It checks:
    • the format queries;
    • the allocation size of a 2560×1440 depth buffer;
    • creation with a 118 clear value;
    • depth-and-stencil clears through a typed and an UNKNOWN DSV, run to the fence.
  • d3d12_d24_support: passes.
  • d3d12_typeless_depth fails the same way with and without this change: it compares against WARP, which Wine lacks.
  • The Khronos validation layer is not installed here, so no validation run.
  • Merges cleanly with the overlapping open PRs #517, #461, #427 and #261 (checked with git merge-tree).
  • Retail boot on my own 1.0.2.1 copy (#321's integration branch plus this change): the start-up assert on the 118 allocation is gone and the boot continues past it.
  • Built with clang-cl 23.1.5 + xwin SDK 10.0.26100. Not built with MSVC.

GPUs tested: NVIDIA GeForce RTX 3060, driver 620.73.04, Linux (CachyOS, kernel 7.3), Wine 11.22 staging

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. scripts/check_no_game_data.py passes over every changed file.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with 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/588 **Author:** [@MrCloudy2](https://github.com/MrCloudy2) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `rt-d16s8` --- ### 📝 Commits (1) - [`df1bb7c`](https://github.com/ubiquitarianism/leonida/commit/df1bb7cd36e167cb366748988c1198897e0d149c) d3d12: the Xbox D16_UNORM_S8_UINT depth format (118) and its plane views (RT-XBOX-D16S8) ### 📊 Changes **4 files changed** (+243 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+10 -0) 📝 `runtime/CMakeLists.txt` (+8 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+40 -3) ➕ `runtime/test/d3d12_xbox_d16s8_test.cpp` (+185 -0) </details> ### 📄 Description Claimed in the coordination issue as: RT-XBOX-D16S8 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7127190120) ### What and why DXGI_FORMAT 118, past `B4G4R4A4_UNORM`, is the console's `D16_UNORM_S8_UINT`. Its plane views are 119 `R16_UNORM_X8_TYPELESS` (depth) and 120 `X16_TYPELESS_G8_UINT` (stencil). #461's XG layout table treats 118–120 as one 2-byte depth family too. The Vulkan-backed device knew none of them, so two things failed: * `GetResourceAllocationInfo` gave `UINT64_MAX` for a 118 depth buffer. The retail executable sizes one at start-up and asserts on that answer. * Pipelines with `DSVFormat = 118` were refused (`depth-stencil format not supported: 118`). Vulkan's `D16_UNORM_S8_UINT` is missing on NVIDIA and RADV, so a 118 texture is a `D32_SFLOAT_S8_UINT` image on every GPU. A 16-bit depth value is held as a float and read back through the depth view as the same [0, 1] value. * `vulkan_format`: 118 → `D32_SFLOAT_S8_UINT`, depth and stencil aspects. * `format_family` and `depth_stencil_family`: 118–120 form one depth-stencil family. Creation with `ALLOW_DEPTH_STENCIL` and a 118 clear value passes. * `image_descriptor`: 119 (or `UNKNOWN`) is 118's depth-plane SRV format, and 120 is its stencil-plane format. * `CheckFeatureSupport`: `FORMAT_INFO` gives two planes for all three formats. `FORMAT_SUPPORT` answers with the D32S8 family's answers and gives the caller its `Format` back. * `docs/d3d12_vulkan.md`: a paragraph next to the D24-as-D32 one. Not done (documented): a footprint copy of the depth plane has the D32 texel size, 4 bytes instead of 2. There is no conversion pass as there is for D24, and nothing measured makes such a copy yet. ### Tested * New `d3d12_xbox_d16s8_test` (CTest `d3d12_xbox_d16s8`): **passes**. It checks: * the format queries; * the allocation size of a 2560×1440 depth buffer; * creation with a 118 clear value; * depth-and-stencil clears through a typed and an `UNKNOWN` DSV, run to the fence. * `d3d12_d24_support`: passes. * `d3d12_typeless_depth` fails the same way with and without this change: it compares against WARP, which Wine lacks. * The Khronos validation layer is not installed here, so no validation run. * Merges cleanly with the overlapping open PRs #517, #461, #427 and #261 (checked with `git merge-tree`). * Retail boot on my own 1.0.2.1 copy (#321's integration branch plus this change): the start-up assert on the 118 allocation is gone and the boot continues past it. * Built with clang-cl 23.1.5 + xwin SDK 10.0.26100. Not built with MSVC. GPUs tested: NVIDIA GeForce RTX 3060, driver 620.73.04, Linux (CachyOS, kernel 7.3), Wine 11.22 staging AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. `scripts/check_no_game_data.py` passes over every changed file. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/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#632
No description provided.