Recompiler: image_get_resinfo gives depth 0 for 1D, 2D and 2D MSAA #2054
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2054
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2054/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@upipibi on GitHub · 2026-11-25 02:13 UTC · original
upipibi:fix/resinfo-depth-zero→main· +137 −9 · 4 files · 3 commits · merged 2026-11-25 10:38 UTCimage_get_resinforeported 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 theirdocs/dev/debt/shader.md:(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 = 0uinstead of1u.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 inmsaa_tests.rs,gpu_direct_msaa_image_loads(2D MSAA) andgpu_direct_image_get_resinfo_d16. A newgpu_image_get_resinfo_dim_2d_of_an_msaa_tsharpcovers DIM 2D on a 4-sample T#. Onmainit gives[4, 2, 1, 1]on both paths.a334936: DIM 1D / 2Dimage_get_resinfoon an MSAA T# (TYPE 14 / 15) is queried throughTexture2DMS/Texture2DMSArray, giving(w, h, 0, 1)on every host. ATexture2Dhandle on the multisampled view left the level count to the host (RADV gave 3; reported by SlopTart). The test also covers DIM 1D and a 4-sample array T#.9fb040d: a newgpu_image_get_resinfo_past_last_levelqueries single-level 2D, 2D array, 3D and cube T#s at mips 0, 1, 2, 15 and 0xffffffff. Past the last level, RDNA2 gives(0, 0, 0, levels)(AnyPS5#22724, measured on gfx1036). D3D12 zeroes the sizes there too, so only the channels a translator fills in itself can differ. The 1D array case is left to #2046, which fixes its direct-path query.Tested
9fb040d, AMD Radeon RX 7900 XT (RDNA3, RADV / Mesa 26.2.5 under Proton with the pinned vkd3d-proton 3.1), run by SlopTart (comment): theresinfoGPU tests give 5 passed, 0 failed by default and 4 passed, 0 failed withXCL_SPLIT_WAVE64=1. WithXCL_DIRECT_DXIL=1(with or without split wave64) the only failure isgpu_image_get_resinfo_1d_array(#2046).gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharpnow gives 1 level there too, where it gave 3 beforea334936.9fb040d, RTX 3070 (616.56): the new test passes withXCL_DIRECT_DXIL=0and1. With this PR'semit.rsandlower_image.rsreverted to the base, it fails on both paths (2D at mip 1:[0, 0, 1, 1]). TheresinfoGPU tests: 3 passed withXCL_DIRECT_DXIL=0; with1, 2 passed and 1 failed,gpu_image_get_resinfo_1d_array(#2046).a334936, RTX 3070 (616.56):gpu_suite 133 passed withXCL_DIRECT_DXIL=0; with1, 132 passed and 1 failed:gpu_image_get_resinfo_1d_array, which fails onmaintoo (#2046);dxil::units 123 passed. CI Build and test: passing. Not tested on AMD at this head.main5ce558f:gpu_tests (--skip gpu_sparse_vram): 133 passed withXCL_DIRECT_DXIL=0; with1, 132 passed and 1 failed,gpu_image_get_resinfo_1d_array, which fails the same way onmain(#2046 fixes it; the two PRs merge cleanly).dxil::,resinfoandmsaaunits: 140 passed.Regression run
Run by Toons29 on an AMD Radeon RX 9070 (comment),
mainand this head, pasted unedited:Not tested
AI use
🤖 Generated with Claude Code
@JJAutoCompare on GitHub · 2026-11-25 02:32 UTC · original
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
32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation26200.9974, Rust1.100.0(x86_64-pc-windows-msvc), DXC and DXIL1.9.2609.5, unoptimized test profile.cargo test --locked -p xcl --lib -j 2 --no-run --message-format=json. SetCARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0,CARGO_TARGET_DIR=L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target, andTEMPandTMPtoL:/XclTooling/pr2054.crates/xclwithXCL_ADAPTER=A770,XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64, andXCL_REQUIRE_GPU=wave64. The GPU lock wrapped the following test commands.XCL_DIRECT_DXIL=0)XCL_DIRECT_DXIL=1)(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.(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
mainbaseline, 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 on GitHub · 2026-11-25 03:14 UTC · original
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
x86_64-pc-windows-gnu.71d94e7as it is (merge base withmain5ce558f), 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 skippedNot tested
AI use
@DavidM1911 on GitHub · 2026-11-25 04:41 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@SlopTart on GitHub · 2026-11-25 05:32 UTC · original
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_tsharpfails 4/4 runs (2 native, 2 underXCL_SPLIT_WAVE64=1, 2 of them solo with--nocapture):Notes:
get_resinfodepth fix itself holds on this generation and stack.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 changedget_resinfoassert 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.
@upipibi on GitHub · 2026-11-25 06:13 UTC · original
Thanks, this was a real bug, not a host difference in the test. A DIM 2D
image_get_resinfoon an MSAA T# was translated asTexture2D.GetDimensionson theTexture2DMSview that T# binds. D3D12 leaves that mismatch undefined, so the level count came from the host: NVIDIA gives 1, and your 3 probably comes from RADV deriving it from the MSAA image's sample count (log2(4) + 1; I haven't checked the Mesa source). The test's 1 is right: the T# has LAST_LEVEL 0, and RDNA2 returns 1 level for MSAA T#s (boykopovar/AnyPS5's gfx1036 measurement, 2 to 16 fragments).a334936queries an MSAA T# (TYPE 14 or 15) throughTexture2DMS/Texture2DMSArrayfor DIM 1D and 2D on both paths, which gives(w, h, 0, 1)on every host. The test now also covers DIM 1D and a 4-sample array T#. On an RTX 3070 thegpu_suite is unchanged: 133 passed withXCL_DIRECT_DXIL=0; with1, 132 passed and onlygpu_image_get_resinfo_1d_arrayfailed, as onmain. Could you re-rungpu_image_get_resinfo_dim_2d_of_an_msaa_tsharpon the 7900 XT?AI-assisted (Claude Code).
@Toons29 on GitHub · 2026-11-25 09:44 UTC · original
Regression run of
9fb040d3on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@SlopTart on GitHub · 2026-11-25 09:55 UTC · original
Re-run done on the 7900 XT against head
9fb040d3. The fix holds on RDNA3 under Mesa:gpu_image_get_resinfo_dim_2d_of_an_msaa_tsharpnow passes, including its new DIM 1D and 4-sample array variants.Rig and stack unchanged from the failing run: 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
cbc296ab+ head9fb040d3merged, pipeline cache removed before each run.resinfo set by mode:
XCL_SPLIT_WAVE64=1: 4 passed, 0 failed (tsharp included)XCL_DIRECT_DXIL=1: 4 passed, 1 failed, and the one failure isgpu_image_get_resinfo_1d_array, matching your RTX 3070 note that this one fails onmainwith the direct backend too; it is tracked in #2046 and is not introduced hereXCL_DIRECT_DXIL=1plusXCL_SPLIT_WAVE64=1: same, onlygpu_image_get_resinfo_1d_arrayfailsSo the mip count now comes back 1 on this stack too, which fits your reading that RADV was deriving the level count from the
Texture2DMSview rather than the T# (log2(sample_count) + 1= 3 for 4 samples is consistent with what we saw).Counts only, no game data.
AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@upipibi on GitHub · 2026-11-25 10:17 UTC · original
Thanks @SlopTart for the re-run on RDNA3 / RADV. I've added it to the description's Tested section. The direct-DXIL
gpu_image_get_resinfo_1d_arrayfailure is #2046's, as you say.@Diskuss on GitHub · 2026-11-25 10:55 UTC · original · edited 2026-11-25 10:58 UTC
gpu_image_get_resinfo_past_last_level(9fb040d) fails on native Windows AMD: RX 9070 XT (RDNA4), driver 32.0.32015.7029,main5478c4a, debug, default (HLSL) path. Single-level T#s, what the test prints:Cause: AMD's D3D12 driver answers
GetDimensions(mip, ...)past the view's last level withmax(1, size >> mip)and the unchanged array size; only mip 0xffffffff gives width/height 0, and the array size stays even then. The translators pass that through. The SM4/5resinfospec says an out-of-rangesrcMipLevelreturns xyz as for an unbound resource, i.e. 0, array size included (resinfo). So this is AMD driver behaviour against the spec, not the test. The RTX 3070 and RADV runs in the description pass with the same translators.Fix (local branch, not pushed): both translators zero the sizes themselves when
mip >= levels. Inrecomp/emit.rs,{t}_r = {mipv} >= {t}_n ? uint4(0u, 0u, 0u, {t}_n) : uint4(...). Indxil/lower_image.rs,cmp(UGe, mipv, n)and aselto 0 for w/h/d. It costs one compare per query. Hosts that follow the spec get the same values as before.Tested on the fix (
5478c4a+ 1 commit):cargo test -p xcl --lib resinfo -- --test-threads=1: 5 passed, 0 failed withXCL_DIRECT_DXIL=0, and 5 passed, 0 failed withXCL_DIRECT_DXIL=1.cargo test -p xcl --lib -- --test-threads=4: 1160 passed, 4 failed, 26 ignored. None of the 4 failures comes from this change, and each also fails onmain5478c4a:fuzz_validate_and_gpu_1/_3(#2115).pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa(#2233).rerouted_disk_entries_follow_the_direct_translator(left 68, right 1; also alone).Not tested: retail title /
scripts/smoke.ps1, release build.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this comment.
@upipibi on GitHub · 2026-11-25 11:19 UTC · original
@Diskuss Thanks. That reading of the AMD driver matches what the test was written to catch: the SM4/5
resinfopast the last level gives 0 for the sizes, and our NVIDIA driver already does that, so the test passed here. Since this PR is merged,mainnow fails the test on AMD, so your fix (zeroing the sizes in both translators whenmip >= levels) would be worth its own PR. I'll run it on the RTX 3070 withXCL_DIRECT_DXIL=0and=1once it's up, to check it doesn't change anything on NVIDIA.@upipibi on GitHub · 2026-11-25 13:01 UTC · original
@Diskuss Closing my offer from above. ivall fixed it in
main(ea088a58, both translators). On the RTX 3070,main1a0bbe3apassesgpu_image_get_resinfo_past_last_leveland the other four resinfo tests in a full lib run (default path), so the fix changes nothing on NVIDIA here.AI-assisted (Claude Code). Synthetic tests only.
@DavidM1911 on GitHub · 2026-11-26 07:13 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin