[PR #1204] [CLOSED] d3d12: RGBA8 render targets of a console device take UNORM and sRGB RTVs without a list (D3D-RGBA8-SRGB-UNORM-RTV) #1235

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

📋 Pull Request Information

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

Base: main ← Head: rgba8-srgb-unorm-rtv


📝 Commits (1)

  • bbf7c82 d3d12: RGBA8 render targets of a console device take UNORM and sRGB RTVs without a list (D3D-RGBA8-SRGB-UNORM-RTV)

📊 Changes

4 files changed (+123 additions, -5 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+9 -0)
📝 runtime/README.md (+2 -2)
📝 runtime/shims/d3d12_vulkan_device.cpp (+15 -2)
📝 runtime/test/d3d12_draw_test.cpp (+97 -1)

📄 Description

Claimed in the coordination issue as: D3D-RGBA8-SRGB-UNORM-RTV

What and why

The retail title draws its Bink movie through an R8G8B8A8_UNORM RTV of an R8G8B8A8_UNORM_SRGB 2D texture made with ALLOW_RENDER_TARGET and no castable list (measured on a retail boot, RTX 5080). CreateRenderTargetView refused the view (unsupported typeless or RGBA8 RTV format/subresource: 28), so the movie's draw had no target. The console allows the cast.

CreateRenderTargetView, the clear path and the draw path already handle this cast when the texture's castable list names the view. So the only change is which list the texture gets: on a device the Xbox-ABI proxy owns (set_device_outer, which D3D12XboxCreateDevice calls), a 2D R8G8B8A8_UNORM or _SRGB render target without a list of its own gets {UNORM, SRGB} in Resource::create_texture. That covers every creation slot (27, 29, 76, 127, 133) without touching the proxy or losing the initial state, and a device without the proxy behaves as before.

Limits:

  • Textures with unordered access, B8G8R8A8 and other families are left as they are: no such cast has been seen.
  • The list also limits SRVs of these textures to the two formats, as any castable list does. An SRV in another format of such a texture is not a valid D3D12 view; it now leaves a null descriptor.
  • The new clears through the sRGB view stay within 1 of the expected bytes, so #1179 (sRGB clear encoding) neither conflicts with nor changes this.

Tested

Built with MSVC (Ninja, RelWithDebInfo). d3d12_draw_test gained a block: for an sRGB texture with a UNORM RTV and the reverse, a clear and a draw are read back as raw bytes, and the same texture made while the device has no proxy must still refuse the RTV (Close fails). With the device change disabled the test does not get through this block; with it, it passes.

Run with and without LEONIDA_VK_VALIDATION=1, exit 0 in both and no VUID messages: d3d12_draw, d3d12_clear, d3d12_typeless_rtv, d3d12_vulkan_device, d3d12_method_variants, typeless_rtv, xs_proxy_mock, d3d12_descriptor, d3d12_present, d3d12_msaa_draw, d3d12_srgb_uav, d3d12_m2_textured, d3d12_m3_frame. d3d12_first_light skips (exit 77). scripts/check_no_game_data.py passes on the touched files.

Not run: the rest of ctest, another GPU, Linux/Wine, the translator suite (untouched), and the retail title with exactly this change (a local prototype with the same list and another gate showed the movie).

GPUs tested: NVIDIA GeForce RTX 5080, 621.24, Windows 11 build 26200

AI-assisted: yes

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.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (not applicable: 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/1204 **Author:** [@DadaCap](https://github.com/DadaCap) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `rgba8-srgb-unorm-rtv` --- ### 📝 Commits (1) - [`bbf7c82`](https://github.com/ubiquitarianism/leonida/commit/bbf7c82c656b7cc808f93ec7204ac92a6a2bebbe) d3d12: RGBA8 render targets of a console device take UNORM and sRGB RTVs without a list (D3D-RGBA8-SRGB-UNORM-RTV) ### 📊 Changes **4 files changed** (+123 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+9 -0) 📝 `runtime/README.md` (+2 -2) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+15 -2) 📝 `runtime/test/d3d12_draw_test.cpp` (+97 -1) </details> ### 📄 Description Claimed in the coordination issue as: D3D-RGBA8-SRGB-UNORM-RTV ### What and why The retail title draws its Bink movie through an `R8G8B8A8_UNORM` RTV of an `R8G8B8A8_UNORM_SRGB` 2D texture made with `ALLOW_RENDER_TARGET` and no castable list (measured on a retail boot, RTX 5080). `CreateRenderTargetView` refused the view (`unsupported typeless or RGBA8 RTV format/subresource: 28`), so the movie's draw had no target. The console allows the cast. `CreateRenderTargetView`, the clear path and the draw path already handle this cast when the texture's castable list names the view. So the only change is which list the texture gets: on a device the Xbox-ABI proxy owns (`set_device_outer`, which `D3D12XboxCreateDevice` calls), a 2D `R8G8B8A8_UNORM` or `_SRGB` render target without a list of its own gets {UNORM, SRGB} in `Resource::create_texture`. That covers every creation slot (27, 29, 76, 127, 133) without touching the proxy or losing the initial state, and a device without the proxy behaves as before. Limits: - Textures with unordered access, `B8G8R8A8` and other families are left as they are: no such cast has been seen. - The list also limits SRVs of these textures to the two formats, as any castable list does. An SRV in another format of such a texture is not a valid D3D12 view; it now leaves a null descriptor. - The new clears through the sRGB view stay within 1 of the expected bytes, so #1179 (sRGB clear encoding) neither conflicts with nor changes this. ### Tested Built with MSVC (Ninja, RelWithDebInfo). `d3d12_draw_test` gained a block: for an sRGB texture with a UNORM RTV and the reverse, a clear and a draw are read back as raw bytes, and the same texture made while the device has no proxy must still refuse the RTV (`Close` fails). With the device change disabled the test does not get through this block; with it, it passes. Run with and without `LEONIDA_VK_VALIDATION=1`, exit 0 in both and no VUID messages: `d3d12_draw`, `d3d12_clear`, `d3d12_typeless_rtv`, `d3d12_vulkan_device`, `d3d12_method_variants`, `typeless_rtv`, `xs_proxy_mock`, `d3d12_descriptor`, `d3d12_present`, `d3d12_msaa_draw`, `d3d12_srgb_uav`, `d3d12_m2_textured`, `d3d12_m3_frame`. `d3d12_first_light` skips (exit 77). `scripts/check_no_game_data.py` passes on the touched files. Not run: the rest of `ctest`, another GPU, Linux/Wine, the translator suite (untouched), and the retail title with exactly this change (a local prototype with the same list and another gate showed the movie). GPUs tested: NVIDIA GeForce RTX 5080, 621.24, Windows 11 build 26200 AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (not applicable: 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>
4ld0 2026-11-26 20:20:33 +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#1235
No description provided.