D3D12.X: CreatePlacedResource converts the clear value of a console format #1150

Manually merged
github merged 1 commit from gh-pr/1150/head into gh-pr/1150/base 2026-11-26 04:45:11 +00:00
Owner

@⁠emirduran707 on GitHub · 2026-11-24 12:34 UTC · original
emirduran707:placed-clear-value → main · +44 −0 · 1 files · 1 commits · merged 2026-11-24 15:58 UTC

CreatePlacedResource for console code (dev_create_placed_resource_x) makes the resource from the PC's description (pc_resource_desc: console format 118 becomes R24G8_TYPELESS, 116/117 R10G10B10A2, 86/115 R8G8B8A8), but passed the title's optimized clear value on in the console's format. D3D12 requires the clear value's format to fit the resource's and refuses the call with E_INVALIDARG on every route: memory of its own, the retry with the PC's description, and the committed fallback. CreateCommittedResource and CreatePlacedResourceX already convert the clear value with pc_clear; this path now does the same, once, for all its routes.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: convert the clear value with pc_clear before the routes. GPU test gpu_placed_console_depth_target_with_clear_value: a 256x256 depth target in console format 118 with a clear value.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on f4bbf26: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests
  • the new GPU test without the change: all three routes return 0x80070057; with it the resource is made as R24G8_TYPELESS

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19650 MB

this PR:

xcl-smoke v1
commit: f4bbf268d726d1ab30eabdf2fef2f26298e881a5
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1513 (PresentX 1514)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19499 MB

Not tested

  • Whether the smoke title takes this path with a clear value (its run is a regression check only).
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

**@⁠emirduran707** on GitHub · 2026-11-24 12:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1150) `emirduran707:placed-clear-value` → `main` · +44 −0 · 1 files · 1 commits · merged 2026-11-24 15:58 UTC `CreatePlacedResource` for console code (`dev_create_placed_resource_x`) makes the resource from the PC's description (`pc_resource_desc`: console format 118 becomes `R24G8_TYPELESS`, 116/117 `R10G10B10A2`, 86/115 `R8G8B8A8`), but passed the title's optimized clear value on in the console's format. D3D12 requires the clear value's format to fit the resource's and refuses the call with `E_INVALIDARG` on every route: memory of its own, the retry with the PC's description, and the committed fallback. `CreateCommittedResource` and `CreatePlacedResourceX` already convert the clear value with `pc_clear`; this path now does the same, once, for all its routes. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs`: convert the clear value with `pc_clear` before the routes. GPU test `gpu_placed_console_depth_target_with_clear_value`: a 256x256 depth target in console format 118 with a clear value. **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on f4bbf26: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests - the new GPU test without the change: all three routes return 0x80070057; with it the resource is made as `R24G8_TYPELESS` **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1541 (PresentX 1541) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19650 MB ``` this PR: ``` xcl-smoke v1 commit: f4bbf268d726d1ab30eabdf2fef2f26298e881a5 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1513 (PresentX 1514) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19499 MB ``` **Not tested** - Whether the smoke title takes this path with a clear value (its run is a regression check only). - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Device #29 CreatePlacedResource for console code (dev_create_placed_resource_x)
makes the resource from the PC's description (pc_resource_desc: 118 becomes
R24G8_TYPELESS, 116/117 R10G10B10A2, 86/115 R8G8B8A8) but passed the title's
optimized clear value on as it was, still in the console's format. D3D12
wants the clear value's format to match the resource's, and refuses it
(E_INVALIDARG) on every route: memory of its own, the retry with the PC's
description and the committed fallback. CreateCommittedResource and
CreatePlacedResourceX already convert it with pc_clear; this path now does
the same, once, for all its routes.

Measured with the new GPU test (a 256x256 D16_UNORM_S8_UINT depth target
with a 118 clear value): without the change all three routes return
0x80070057; with it the resource is made as R24G8_TYPELESS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:45:09 +00:00
github manually merged commit f4bbf268d7 into gh-pr/1150/base 2026-11-26 04:45:11 +00:00
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 12:41 UTC · original

Independent NVIDIA check of f4bbf26 against 47efa2e. Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug.

Tested. On the baseline, both the stock format-118 depth fixture and a scratch format-115 color fixture returned 0x80070057 from resource creation. On the PR, both succeeded. The color target was R8G8B8A8_UNORM and all 4,096 pixels matched after a native D3D12 clear, copy and readback. The device stayed healthy. Commands used cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1, with filters gpu_placed_console_depth_target_with_clear_value and scratch_console_format_115_color_clear_and_readback.

With Graphics Tools enabled for the color fixture, the baseline logged 599 on the initial format-115 attempt and 817 on each fallback. The PR removed both 817s. It still logged 599 because the initial attempt uses the console resource description, which native D3D12 interprets as B4G4R4A4_UNORM without render-target support on this device. The translated retry succeeded and the subsequent clear and copy added zero InfoQueue messages.

Not tested. Retail rendering and other formats.

AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch test and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-24 12:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1150#issuecomment-7131778236) Independent NVIDIA check of [`f4bbf26`](https://github.com/ivall/xcl/commit/f4bbf268d726d1ab30eabdf2fef2f26298e881a5) against [`47efa2e`](https://github.com/ivall/xcl/commit/47efa2ecea0a12934719ae69b81930cf02a4b1c3). Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. **Tested.** On the baseline, both the stock format-118 depth fixture and a scratch format-115 color fixture returned `0x80070057` from resource creation. On the PR, both succeeded. The color target was `R8G8B8A8_UNORM` and all 4,096 pixels matched after a native D3D12 clear, copy and readback. The device stayed healthy. Commands used `cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1`, with filters `gpu_placed_console_depth_target_with_clear_value` and `scratch_console_format_115_color_clear_and_readback`. With Graphics Tools enabled for the color fixture, the baseline logged 599 on the initial format-115 attempt and 817 on each fallback. The PR removed both 817s. It still logged 599 because the initial attempt uses the console resource description, which native D3D12 interprets as `B4G4R4A4_UNORM` without render-target support on this device. The translated retry succeeded and the subsequent clear and copy added zero InfoQueue messages. **Not tested.** Retail rendering and other formats. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch test and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 12:50 UTC · original

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

  • cargo test -p xcl --lib placed: 3 passed, 0 failed — placed_title_textures_share_vram_and_preserve_pixels and friends cover the placed-resource path on the real backend.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 12:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1150#issuecomment-7131984993) Independent verification on current `main` `384f7f7` (branch already contains it — clean). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug. - `cargo test -p xcl --lib placed`: **3 passed, 0 failed** — `placed_title_textures_share_vram_and_preserve_pixels` and friends cover the placed-resource path on the real backend. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 14:21 UTC · original

A regression run under Wine on Linux, on a retail title.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. f4bbf26 as it is (merge base 47efa2e) and main 47efa2e, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Twelve runs in a row, main first and last, other PRs in between.
  • A regression check: I did not check whether GTA VI reaches the changed code in these 60 s.

Regression run

main (first run):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1384 (PresentX 1384)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: f4bbf268d726d1ab30eabdf2fef2f26298e881a5
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1401 (PresentX 1401)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1425 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 14:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1150#issuecomment-7134240670) A regression run under Wine on Linux, on a retail title. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `f4bbf26` as it is (merge base `47efa2e`) and `main` `47efa2e`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Twelve runs in a row, `main` first and last, other PRs in between. - A regression check: I did not check whether GTA VI reaches the changed code in these 60 s. **Regression run** main (first run): ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1384 (PresentX 1384) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: f4bbf268d726d1ab30eabdf2fef2f26298e881a5 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1401 (PresentX 1401) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The last `main` run: 1425 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head; native Windows; AMD. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
This discussion has been locked. Commenting is limited to contributors.
No description provided.