Skip to content

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

Closed
DadaCap wants to merge 1 commit into
ProjectLeonida:mainfrom
DadaCap:rgba8-srgb-unorm-rtv
Closed

DadaCap wants to merge 1 commit into
ProjectLeonida:mainfrom
DadaCap:rgba8-srgb-unorm-rtv

Conversation

@DadaCap

@DadaCap DadaCap commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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:

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

…TVs without a list (D3D-RGBA8-SRGB-UNORM-RTV)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Read the whole diff and tested bbf7c82c6 merged on main 66d4f5aa3 (clean), Windows 10 Pro 19045, VS 2022 RelWithDebInfo, LEONIDA_VK_VALIDATION=1. First run of it on Windows 10 and on a second NVIDIA card.

RTX 5060 Ti (NVIDIA 621.01):

d3d12_draw d3d12_clear d3d12_typeless_rtv d3d12_srgb_uav
main pass pass pass pass
this test, main's device code fails, line 1088 (Close, RTV format 28 refused) - - -
this PR pass, console block included pass pass pass

No VUID lines in any run.

Ryzen 7 7700 iGPU (AMD 31.0.22044.1, 128 push-constant bytes): no evidence for or against the new block. d3d12_draw_test stops at its first pipeline (144 bytes needed) before reaching it, on main as well. The other three fail there with and without the PR.

On the code: I checked the case where the title asks D3D12XboxCreateDevice for IDXGIDevice1. is_device_proxy is false for that pointer, but set_device_outer resolves it through device_proxy_primary before set_outer, so console is set there too.

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

@DadaCap

DadaCap commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing this one: main has the rule since #984.

  • Resource::create_texture on main gives an RGBA8 or BGRA8 render target without a castable list its UNORM/sRGB twin (under console_format_stand_ins()), so the movie's R8G8B8A8_UNORM RTV of the R8G8B8A8_UNORM_SRGB target is accepted. That is the draw this pull request was for.
  • One difference: main does it on every device unless LEONIDA_CONSOLE_FORMATS=0; this branch did it only on a device the Xbox-ABI proxy owns, and its d3d12_draw_test case checks that a device without the proxy refuses the view. That check does not hold on main, so the test cannot go in as it is.

If a draw test of main's rule is wanted (clear and draw through both casts, read the bytes back), say so and I will open it as a test-only pull request. The claim D3D-RGBA8-SRGB-UNORM-RTV can be dropped from the table. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants