Skip to content

Recompiler: image_get_resinfo gives depth 0 for 1D, 2D and 2D MSAA - #2054

Open
upipibi wants to merge 1 commit into
xcl-dev:mainfrom
upipibi:fix/resinfo-depth-zero
Open

upipibi wants to merge 1 commit into
xcl-dev:mainfrom
upipibi:fix/resinfo-depth-zero

Conversation

@upipibi

@upipibi upipibi commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

image_get_resinfo reported a depth (third component) of 1 for a DIM without layers: DIM 1D and 2D on both paths, and the direct translator's 2D MSAA query. RDNA2 reports 0 there. The sources are boykopovar/AnyPS5's measurements, recorded in their docs/dev/debt/shader.md:

  • thuanquang's gfx1031 measurement (AnyPS5 #7550): the third component is 0 for every DIM without layers (1D, 2D, 2D MSAA).
  • gfx1036 with their hardware oracle: a 2D MSAA T# with 2, 4, 8 or 16 fragments returns (width, height, 0, 1) under DIM 1D, 2D and 2D_MSAA, in wave32 and wave64 (AnyPS5 #25723).

What is in it

  • recomp/emit.rs: DIM 1D and 2D set {t}_d = 0u instead of 1u.
  • dxil/lower_image.rs: the same for DIM 1D and 2D, and the 2D MSAA query's depth is 0 (the MSAA array keeps its slice count).
  • Tests: the three assertions that encoded depth 1 now expect the measured 0: gpu_images_sample_load_store_atomic (2D), and in msaa_tests.rs, gpu_direct_msaa_image_loads (2D MSAA) and gpu_direct_image_get_resinfo_d16. A new gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharp covers DIM 2D on a 4-sample T#. On main it gives [4, 2, 1, 1] on both paths.

Tested

  • On an RTX 3070 (Ampere, driver 616.56), Windows 11, debug, on main 5ce558f:
  • gpu_ tests (--skip gpu_sparse_vram): 133 passed with XCL_DIRECT_DXIL=0; with 1, 132 passed and 1 failed, gpu_image_get_resinfo_1d_array, which fails the same way on main (Direct DXIL: image_get_resinfo of a 1D array gives the layers in y #2046 fixes it; the two PRs merge cleanly).
  • dxil::, resinfo and msaa units: 140 passed.

Regression run
I have no retail title here. Could someone with one post the xcl-smoke blocks for main and this head?

Not tested

  • AMD, titles.

AI use

  • AI-assisted (Claude Code, Claude Opus 5.5): wrote the change, the tests and this description, and ran the tests above. Synthetic tests only; no game files.

🤖 Generated with Claude Code

A DIM without layers reported depth 1: DIM 1D and 2D on both paths, and
the direct translator's 2D MSAA query. RDNA2 reports 0 there: AnyPS5's
measurements (gfx1031 #7550: the third component is 0 for every DIM
without layers; gfx1036: a 2D MSAA T# under DIM 1D, 2D and 2D_MSAA gives
(width, height, 0, 1)). The tests that encoded depth 1 now expect 0, and
a test of DIM 2D on a 4-sample T# is added.

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

Copy link
Copy Markdown

Independent Intel Arc A770 compatibility check for PR #2054 at 71d94e713bb799dbea2bf9e755c02b9bb69e3c7a. The checkout was clean before and after execution, and the PR was open at this exact head on both checks.

Tested

  • Intel Arc A770 (driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 26200.9974, Rust 1.100.0 (x86_64-pc-windows-msvc), DXC and DXIL 1.9.2609.5, unoptimized test profile.
  • Prebuilt outside the Arc lock with cargo test --locked -p xcl --lib -j 2 --no-run --message-format=json. Set CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0, CARGO_TARGET_DIR=L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target, and TEMP and TMP to L:/XclTooling/pr2054.
  • Ran the Cargo-emitted library test executable from crates/xcl with XCL_ADAPTER=A770, XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64, and XCL_REQUIRE_GPU=wave64. The GPU lock wrapped the following test commands.
$testExe = 'L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe'
$common = @(
    'gpu::recomp::tests::gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharp',
    'gpu::recomp::tests::gpu_images_sample_load_store_atomic'
)
$expectedTests = $common + @(
    'gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads',
    'gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16'
)
& 'L:/XclTooling/Invoke-ArcTest.ps1' -WaitMinutes 60 -Test {
    $env:XCL_DIRECT_DXIL = '0'
    & $testExe @common --exact --nocapture --test-threads=1
    $hlslExit = $LASTEXITCODE
    $env:XCL_DIRECT_DXIL = '1'
    & $testExe @expectedTests --exact --nocapture --test-threads=1
    $directExit = $LASTEXITCODE
    $global:LASTEXITCODE = if ($hlslExit -ne 0) { $hlslExit } else { $directExit }
}
Backend Passed Failed Ignored GPU skips Filtered out
HLSL/DXC (XCL_DIRECT_DXIL=0) 2 0 0 0 1118
Direct DXIL (XCL_DIRECT_DXIL=1) 4 0 0 0 1116
  • Both backends returned (4, 2, 0, 1) for the DIM 2D query of a 4-sample MSAA texture and (4, 4, 0, 1) for the ordinary 2D image query.
  • The direct-only MSAA fixture returned (4, 4, 0, 1) for the non-array texture and (4, 4, 3, 1) for the array. The packed D16 query preserved mip count 1, returned depth 0 for 2D and three layers for the MSAA array, and preserved the sentinel VGPRs.

Not tested

DIM 1D, the separate DIM 4 array case from #2046, the main baseline, other adapters and MSAA sample counts beyond the checked fixtures, the full workspace suite, and retail-title smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in tests, verified the logs, and wrote this report.

@JoaoPauluu

Copy link
Copy Markdown

A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, a different compiler from a native-Windows run: this PR's new test passes.

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 Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 71d94e7 as it is (merge base with main 5ce558f), no uncommitted changes. The lib test binary runs under Wine, one test per process.
    • gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharp: ok, not skipped

Not tested

  • the whole suite on this head, a retail title, native Windows, AMD.

AI use

  • Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

IvyNotFound added a commit to IvyNotFound/XCLM that referenced this pull request Nov 25, 2026
@SlopTart

Copy link
Copy Markdown

Heads up: this PR's new tsharp test fails deterministically on RDNA3 under Linux/Wine, but not on the depth field the PR fixes. The mip count is what differs.

Rig: RX 7900 XT (RDNA3, RADV NAVI31, Mesa 26.2.5), Proton Experimental (wine-11.0) + the xcl-pinned vkd3d-proton 3.1 build, DXC 1.9.2609.5, release build, tree main cbc296ab + this PR's head merged. Pipeline cache removed before each run. No Mesa/RADV run of this PR was posted before this one.

gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharp fails 4/4 runs (2 native, 2 under XCL_SPLIT_WAVE64=1, 2 of them solo with --nocapture):

assertion `left == right` failed: resinfo (w, h, d, mips) of DIM 2D on a 4-sample T#
  left: [4, 2, 0, 3]
 right: [4, 2, 0, 1]

Notes:

  • width, height and depth all match the new expectation: depth 0 on RDNA3 too, so the get_resinfo depth fix itself holds on this generation and stack.
  • the 4th component (mips) comes back 3 where the test wants 1. A full mip chain of a 4x2 texture is 3 levels, so the value looks like a real chain length rather than noise. If the RDNA2 reference (AnyPS5#25723) says 1 for this T#, either the test fixture's texture creation gives different mip counts across stacks, or the mips field is another generation/stack difference worth pinning in the same test.

The PR's other new resinfo/MSAA tests all pass here: gpu_direct_image_get_resinfo_d16, gpu_direct_msaa_image_loads, gpu_images_sample_load_store_atomic (including its changed get_resinfo assert with depth 0) are green on native and split.

Counts only, no game data.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

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.

5 participants