Recompiler: preserve explicit cubemap sampling gradients #773
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/778"
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?
Imported from ivall/xcl. Originally posted by AkshatPal2007 on 2026-11-24T05:09:55Z.
Fixes #767.
XCL reduced the two face-space gradients of a cubemap sample to one mip level. That lost the direction of the texture footprint. On a synthetic 32×32 texture with a single white column, an 8×1 texel footprint returned 1.0 through the old cube path and 0.125 through the equivalent 2D-array slice on the same GPU. The retail shader survey in HANDOFF.md records this instruction on cubemaps.
What is in it
TextureCubeArray.SampleGrad.image_sample_d_clpasses its minimum LOD directly to the sampler. This removes the cube path’s texture-size query and manual LOD calculation.Tested
527a2c9, debug build. Windows 11 build 26300.8376, i9-14900HX, RTX 4070 Laptop GPU, driver 32.0.16.1656, Rust 1.100.0 MSVC, DXC 1.8.2502.11.cargo build --workspacesucceeded.cargo test -p xcl --lib gpu_cube -- --nocapture— 4 passed, 0 failed, 0 ignored, 0 skipped. Off-centre samples matched the equivalent 2D-array slices on all six faces of two cubes for horizontal, vertical, and both diagonal anisotropic footprints.cargo test --workspace --no-fail-fast -- --test-threads=4— 701 reported passed, 3 failed, 41 ignored. The three failures match #718 on unchanged main. Existing texture-sampling regressions and the bundled end-to-end title passed.cargo test --workspace --no-fail-fast -- --test-threads=1— 704 reported passed, 0 failed, 41 ignored. Both workspace runs counted two native-wave64 skips among passes.Regression run
Pending. No unpacked retail title was available for the required main and PR-head smoke runs.
Not tested
Retail visual quality and performance, external sample files, AMD GPUs, and Intel GPUs.
AI use
Codex (gpt-6.2-astra) investigated the issue, implemented the change and regression tests, ran verification.
Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-24T05:20:05Z.
Independent native Windows NVIDIA RTX 5080 build/test run and code review at head
527a2c9cab49669e88d5d079ad63cd912f7a6216.Code Review
cube_dirviacube_face_vector(2.0f * dx, 2.0f * dy, 0.0f, face)across all 6 cube faces (+X/-X/+Y/-Y/+Z/-Z), matchingcube_dir's(s - 1.5) * 2,(t - 1.5) * 2parameterization with constant major axis.IMAGE_SAMPLE_D_CLmin-LOD clamp) pass directly on NVIDIA RTX 5080. No issues found.Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974),rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC from Windows SDK10.0.26100.0, debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4ok, executed on RTX 5080, not skipped):gpu::recomp::tests::gpu_cube_sample_grad_matches_face_texturegpu::recomp::tests::gpu_cube_sample_grad_edgesgpu::recomp::tests::gpu_cube_sample_grad_min_lodgpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Not tested
AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T05:22:48Z.
Hardware check of
527a2c9cab49669e88d5d079ad63cd912f7a6216(verified clean merge withmaind208e14): regression noted.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:-p xcl --libexited abnormally (0xc0000005,STATUS_ACCESS_VIOLATION) ingpu::recomp::tests::gpu_cube_sample_grad_min_lodaftergpu::recomp::tests::gpu_cube_sample_grad_matches_face_texturefailed; all other workspace targets passed (41 passed, 0 failed, 20 ignored). Rerunningcargo test -p xcl --lib -- --test-threads=4 --skip gpu::recomp::tests::gpu_cube_sample_grad_min_lodgave661 passed, 1 failed, 21 ignored(702 passed, 2 failed, 41 ignoredacross the workspace; GPU tests skipped on this adapter:none; baselinemainf4ce27c:701 passed, 0 failed, 41 ignored)cargo test -p xcl --lib gpu_cube:2 passed, 2 failedwhen run individually (gpu_cube_array_slices: ok;gpu_cube_sample_grad_edges: ok;gpu_cube_sample_grad_matches_face_texture: panicked atcrates/xcl/src/gpu/recomp/tests.rs:2355:5withthe reference must resolve the two footprint directions;gpu_cube_sample_grad_min_lod: process exited with0xc0000005,STATUS_ACCESS_VIOLATION)Regression run
main(f4ce27c):PR (
527a2c9):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T05:24:00Z.
AMD RDNA4 run of
527a2c9cab49669e88d5d079ad63cd912f7a6216: the new test fails here, every time. I merged it onto currentmaind208e14locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo test -p xcl --lib gpu_cube_sample_grad_matches_face_texture, 3 runs: 3 of 3 failed attests.rs:2355,the reference must resolve the two footprint directions.cargo build --workspace+cargo test --workspace -- --test-threads=4, 2 runs: the test fails, and afterwards thexcllib test binary stops with0xc0000005(STATUS_ACCESS_VIOLATION) before printing a result. The five other PRs I ran on the samemaind208e14right before and after (#782, #777, #491, #481, #514) finished their lib runs without a crash, so the crash goes with this failure.eprintln!before the failing assert (not committed), the values on this adapter are:reference(0) = reference(12) = reference(24) = reference(36) = 2.09375, and the cube lanes 0 and 12 read 2.09375 too.What that shows: it is the test's own precondition that fails, not the comparison with the cube path. 2.09375 is slice 2 + 3/32 of the synthetic texture, i.e. the same texel for every lane, whatever the gradients, and not at v = 19.5/32. So on this driver the 2D-array reference with
D3D12_FILTER_ANISOTROPICdoes not show the footprint direction at all (and the cube path returns the same value), which makes the test depend on how a driver implements anisotropic filtering on a one-mipR32_FLOATtexture. A texture with mips, or comparing against a CPU reference instead of the GPU's own 2D-array sample, would make it hold on AMD too. I have not looked into why the texel is the one at y = 3.Not tested: the retail shaders the description mentions (no game data), release build.
Run and report by Claude Code (Claude Opus 5.5) on this machine; the values come from the runs above.
Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T05:24:32Z.
Test report and regression run for
527a2c9(PR head, based on main64b3f35; main is nowd208e14, no conflict).Tested
x86_64-pc-windows-msvc, debugcargo test --workspace --no-fail-fast -- --test-threads=4on the PR head: 701 passed, 3 failed, 41 ignored. The 3 failures areplaced_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory; they also fail onmainhere (#718, #770) and are not from this PR. The 4 new tests (gpu_cube_array_slices,gpu_cube_sample_grad_edges,gpu_cube_sample_grad_matches_face_texture,gpu_cube_sample_grad_min_lod) pass.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)Regression run (the one this PR lists as pending; the same retail title, 60 s, release builds; the PR's run is on its own head, based on
64b3f35)main (
d208e14):this PR (
527a2c9):That is 92 % of main's frames and the same peak commit, with no crash and no device removal. Both runs are on an NVIDIA card, so they say nothing about AMD.
Not tested
AI use
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-24T05:59:24Z.
RDNA2 test results for the cubemap gradient changes
Tested clean PR head
527a2c9cab49669e88d5d079ad63cd912f7a6216, debug build, Windows 11 Home build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver30.0.13002.13003, Rust1.99.0MSVC and DXC1.8.2502.11. SetXCL_ADAPTER=6800M.I ran each test separately with
cargo test --locked -p xcl --lib gpu::recomp::tests::<name> -- --exact --test-threads=1 --nocapture.gpu_cube_array_slicesgpu_cube_sample_grad_edgesgpu_cube_sample_grad_matches_face_texturethe reference must resolve the two footprint directionsgpu_cube_sample_grad_min_lod0xc0000005inamdxc64.dll30.0.13002.13003, fault offset0x80B300On a separate diagnostic run with only a print added, both the cube and 2D reference were
2.09375for lanes 0, 12, 24 and 36. The first assertion compared two 2D reference values and failed before the cube-versus-2D comparisons. I removed the diagnostic print afterwards.Not tested
The full workspace suite at this PR head, release mode, other drivers, and retail titles.
AI use
OpenAI Codex (GPT-6 family, exact model variant unavailable) ran the tests, checked the Windows crash event, and drafted this report.
Imported from ivall/xcl. Originally posted by Abuudiii on 2026-11-24T06:59:44Z.
Independent exact-head synthetic checks at
527a2c9cab49669e88d5d079ad63cd912f7a6216: RX 9070 (RADV / Mesa 26.2.5), Arch Linux, GE-Proton 11-7 + vkd3d-proton 3.1, DXC/DXIL 1.9.2609.5, Rust 1.99.1 Windows GNU debug build.Tested: Each
gpu::recomp::tests::case below ran in a fresh process with--exact --test-threads=1 --nocapture. The cube-array slice and seam controls (gpu_cube_array_slices,gpu_cube_sample_grad_edges) passed.gpu_cube_sample_grad_matches_face_texturefailed at the 2D precondition, “the reference must resolve the two footprint directions.” Exact head: 2 passed, 1 failed, no skips.A separate scratch run changed only logging, not the assertions: lanes 0, 12, 24 and 36 all returned 2.09375 for both cube and 2D reference. The reference did not distinguish the inputs, so this run cannot validate or refute cube-gradient preservation. No runtime change is proposed from that result.
Not tested: Minimum-LOD pixel test, native Windows, or retail. No game data was used.
AI use: omp (GPT-6.2 Sol) ran the checks and drafted this report.
Imported from ivall/xcl. Originally posted by Xeltax on 2026-11-24T09:30:44Z.
Same result as
luckyteagirl(RX 6800M) and Abuudiii (RX 9070, RADV) above, on a third AMD setup: the Ryzen 9 9900X's RDNA2 iGPU, driver 32.0.21042.62, native Windows 11, PR head527a2c9merged ontomain077ce40.gpu_cube_sample_grad_matches_face_texturefails at the 2D precondition (2 of 2).For comparison, the RTX 4080 on the same machine passes all three tests, with the 2D reference at 0.78125 / 1.65625 / 1.0761719 / 0.80566406 and the cube equal to it on those lanes. So the precondition holds there and not on any AMD driver tried so far.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
Imported from ivall/xcl. Originally posted by AkshatPal2007 on 2026-11-24T10:56:03Z.
Thanks everyone for the feedback! Updated PR head to
1921924with changes addressing the AMD test failures and driver crash.Local tests: 738 passed, 0 failed, 41 ignored (2 wave64 skips counted as passes).
Could someone with AMD hardware retest the latest revision? Retail smoke tests are still pending.
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-24T13:40:35Z.
Retest of
1921924on AMD, as asked: the crash is gone, andgpu_cube_sample_grad_matches_face_texturestill fails, now at a later check.Tested
1921924merged intomain47efa2e(clean merge), debugcargo test --workspace --no-fail-fast -- --test-threads=4: 743 passed, 1 failed, 41 ignored, 0 GPU tests SKIPPED527a2c9onmain077ce401921924onmain47efa2egpu_cube_sample_grad_min_lod, 2 of 2 reruns at--test-threads=1gpu_cube_sample_grad_matches_face_texture, alone (--exact)the reference must resolve the two footprint directions(tests.rs:2355)lane 0: cube 0.6480392, 2D face 0.18431373(tests.rs:2378)gpu_cube_sample_grad_edges, alonegpu_cube_sample_grad_min_lod, aloneThe
lane 0values were the same in all 9 runs of1921924(the suite run and the 8 alone).Not tested
scripts/smoke.ps1): I have no retail title.AI use
Game run
Regression run of
556300f4on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 99 % 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; I checked the blocks before posting.Imported from ivall/xcl. Originally posted by AkshatPal2007 on 2026-11-24T17:39:10Z.
Could someone with AMD hardware retest the latest revision?
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:43:40Z.
Independent Intel Arc A770 test of #778 (fixes #767)
Tested
556300f4ecfa4bf507d9ec9e5f8df6e03b085d85, verified against the open PR. Intel Arc A770 driver32.0.101.9175, Ryzen 7 3800X, Windows 11 Enterprise Evaluation26200.9974, Rust1.100.0(x86_64-pc-windows-msvc), DXC/DXIL1.9.2609.5(DXC01b62ad4). SetXCL_ADAPTER=A770and pointedXCL_DXC_DIRat that DXC installation. Used the unoptimized test profile with debug info and incremental compilation disabled and two Cargo build jobs.cargo test --locked -p xcl --lib gpu_cube --no-run. RanL:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe gpu::recomp::tests::gpu_cube --test-threads=1 --nocaptureunder the Arc GPU lock.gpu_cube_array_sliceschecked face and slice selection and resource info.gpu_cube_sample_grad_matches_native_cubematched the native D3D12 cube reference for horizontal, vertical and diagonal anisotropic footprints across all six faces in two cubes, with off-center point samples checking orientation.gpu_cube_sample_grad_edgeschecked linear filtering from both incident faces of all 12 edges.gpu_cube_sample_grad_min_lodchecked gradient-selected mip levels and minimum LOD in a draw with pixel readback.Not tested
AI use
gpt-6.2-sol) in T3 Code ran the tests and wrote this report from the logs.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T11:08:58Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:41:29Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:06:50Z.
Triage (#1607) – head
556300fNo open or merged PR makes the same change. Main's
emit.rsstill turns every cubeimage_sample_d*intoSampleLevelwith a scalar LOD; this PR emitsSampleGradwith direction-space gradients (cube_face_vector) and keeps the old path only for the clamp (_cl) form.No problems found in the diff. The
PR descriptioncheck fails and the branch conflicts with main.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.