Skip to content

D3D12.X: a resolve marks its destination and names the PC's format - #1787

Open
b3IKK wants to merge 1 commit into
xcl-dev:mainfrom
b3IKK:d3d12x/resolve-subresource-gpu-write
Open

b3IKK wants to merge 1 commit into
xcl-dev:mainfrom
b3IKK:d3d12x/resolve-subresource-gpu-write

Conversation

@b3IKK

@b3IKK b3IKK commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Addresses XCL-BT-031 from #1488.

resolve_subresource_x and resolve_subresource_region_x forwarded the console's format code to the PC's ResolveSubresource as it was, and neither marked the destination with title_textures::note_gpu_write, which CopyResource and the copy hooks already do. Two consequences:

  • the console's 116–120 are its depth family's codes and the PC reads them as video formats (116 = P208, …), so a resolve into such a view's target was refused or resolved as the wrong format;
  • a texture XCL keeps in step that the GPU resolved into was uploaded over by the next CPU write scan (the entry stayed "not GPU-written"), losing the resolved image.

This translates the format with device_x::pc_target_format (the resolve format is the target's view format, like an RTV's) and marks the destination GPU-written, as the copies do.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: resolve_format() (pc_target_format) and title_textures::note_gpu_write(dst) in both resolve hooks; test resolve_subresource_marks_the_destination_and_translates_the_format drives both hooks through a fake list vtable.
  • crates/xcl/src/hle/d3d12x/title_textures.rs: a #[cfg(test)] NOTE_GPU_WRITE_CALLS counter (no production change) so the hook's marking is observable.

Evidence it fails without the fix (each half independently):

  • without the format translation: assertion 'left == right' failed: the console's D16S8 family is the PC's D24S8 on a resolve left: [116, 116] right: [10, 10]
  • without note_gpu_write: assertion 'left == right' failed: both resolves mark the destination GPU-written left: 0 right: 2

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 893 passed, 0 failed, 42 ignored (SKIPPED: 2 no wave64; 1 no heap windows; 1 cannot disable the driver cache (Windows Developer Mode is required))
  • cargo test -p xcl --lib list_x: 29 passed, 0 failed

Regression run

main (e9e94ce, clean tree, no local changes):

xcl-smoke v1
commit: e9e94ce665d16bb0e2d2e4cb6b37e149f0d27721
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1646 (PresentX 1646)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14489 MB

PR (f47659a, clean tree, no local changes):

xcl-smoke v1
commit: f47659a701eb0b0ea23db9c08f6026e005064f4a
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1645 (PresentX 1645)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14482 MB

Not tested

  • a title that resolves into a texture XCL keeps in step and then writes its CPU view (the unit test drives the hooks; no game here did both in the smoke run)
  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: checked XCL-BT-031 against the resolve and copy hooks, wrote the fix and test (and confirmed each half fails without it), rebased onto e9e94ce, ran the test suite and scripts/smoke.ps1 regression runs with Scripts: smoke blocks print the game folder's name #677's title hashing, and drafted this PR description.

@b3IKK

b3IKK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto e9e94ce (which brought #677's anonymised itle: line into scripts/smoke.ps1) and re-ran both: 893 passed, 0 failed, 42 ignored; the blocks above are from the new script.

@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head f47659a (on its base e9e94ce).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 891 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: resolve_subresource_marks_the_destination_and_translates_the_format.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 893 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and there pso_measurement_compiles_an_exact_synthetic_record ran and passed.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

XCL PR #1787 verification

Head f47659a701eb0b0ea23db9c08f6026e005064f4a. Clean detached checkout before and after the run. The diff changes crates/xcl/src/hle/d3d12x/list_x.rs and crates/xcl/src/hle/d3d12x/title_textures.rs.

STOR-WINLAB ran Windows 11 Enterprise Evaluation x64 build 26200, AMD Family 23 Model 113 (~3.9 GHz), Intel Arc A770 (16,258 MiB reported VRAM) with driver 32.0.101.9175, DXC 1.9.2609.5, and rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). The dev and test profiles were unoptimized with debug info and incremental compilation disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both exited 0 outside the Arc mutex. Test compilation produced 19 executables.
  • cargo test -p xcl --lib hle::d3d12x::list_x::tests::resolve_subresource_marks_the_destination_and_translates_the_format -- --exact with XCL_ADAPTER=NONE_CPU_ONLY outside the mutex yielded 1 passed, 0 failed, 0 ignored, 0 skips. Fake COM callbacks received 10 from both resolve methods for input 116, and 28 for input 28 from ResolveSubresource. The GPU-write notification count increased by two for the first two calls. DXGI value 10 is R16G16B16A16_FLOAT. The assertion message calls it D24S8 (DXGI 45).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once inside Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. It exited 101. Summing all 20 result lines (19 executables and one doctest harness) gives 875 passed, 18 failed, 42 ignored. The resolve test passed again.

Workspace failures and skips

  • The library had 17 GPU failures. Compute PSOs returned 0x80070057, and assertions failed for FMA, sampled LOD, packed VALU and wave reductions. The e2e failure was the test title's dynamic depth-bias check, with blue read back where green was expected.
  • The log has 7 lines starting with SKIPPED . Reasons were missing wave64 (2), tiled tier below 2, driver cache control unavailable, debug layer or SDK layers unavailable (2), and heap windows unavailable. These skips provide no coverage. Optional fixture and audio paths also reported early returns outside that count.

Not tested

Matched main baseline, retail-title smoke, hardware resolve output and subsequent CPU upload behavior, AMD and NVIDIA. Failure attribution remains open.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1787-suite.log and published.

ResolveSubresource / ResolveSubresourceRegion forwarded the console's
format code as it was - its 116-120 are the console depth family's, and
the PC reads those codes as video formats - so a resolve into such a
view's target was refused (or resolved the wrong depth format). Neither
marked the destination with title_textures::note_gpu_write, which
CopyResource and the copies already do: a kept-in-step texture the GPU
had resolved into was uploaded over by the next CPU write scan, losing
the resolved image.

Translate the format with device_x::pc_target_format (the target's view
format) and mark the destination as written by the GPU.

Assisted-by: OpenCode (Gemini 4 Neon)
@b3IKK
b3IKK force-pushed the d3d12x/resolve-subresource-gpu-write branch from f47659a to cbc1a4f Compare November 25, 2026 16:11
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.

4 participants