fix(shader): compare through 2D image_sample_c on 1D T#s #5456
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5456"
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 boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-13T20:08:51Z.
What
A depth-compare sample with DIM 2D through a 1D T# (
image_sample_c_lz, or plainimage_sample_c) now reads the 1D view, the same way #2237 handlesimage_sample_lzandimage_samplethrough that pair. Before this change the shader got no 1D runtime mode, and the first draw with a 1D T# threwimage descriptor is incompatible with the static runtime image interface: descriptor format 7 decodes to {class 1, dim 1, ...}; modes: {class 1, dim 3, ...}.The change is in
ResourceTracker: the compare flag no longer stops anImageSampleRawfrom beingflatLineCompatible. Only comparisons the runtime does natively (32_FLOAT, 16_UNORM) reach the 1D view. Comparisons it emulates for other color formats have no 1D mode, so they still throw. The technical debt entry for 2D accesses through a 1D T# is updated to match.Hardware semantics, measured on RDNA1 (gfx1010, AMD Radeon RX 5700 XT) with the
tools/hw-oracletemplate (template.sunchanged). The kernels were assembled with the Windows driver'samd_comgr_2.dlland launched with its HIP runtime (amdhip64_6.dll). Float modes were IEEE off, DX10 clamp on, denormals preserved and round to nearest even, in wave32 and in wave64 with byte-identical results.image_sample_c_lz,image_sample_candimage_sample_c_l(LOD 0) with DIM 2D (ref, u, v) equal the DIM 1D comparison with (ref, u) on every row. v is ignored, including v = 3 and -0.25 under border addressing, and bilinear blends only along u.image_sample_cin 2x2 compute quads takes its LOD from u alone. Steps of 1, 4 and 16 texels per lane select mips 0, 2 and 4. v steps of 16, 32 and 64 texels per lane change nothing.image_sample_lzandimage_loadon 1D T#s.The measurement tables are attached.
measurement-results-3d-compare-on-1d.md
Tested
agc_driver_image_plane_compare_on_line(image_sample_c_lzandimage_sample_cwith DIM 2D on a 16-texel 16_UNORM 1D T#, eight different v values) passes. Without theResourceTrackerchange it fails with the error above.ctest -R ^agc_: the same tests fail with and without this change. Those tests also fail on unchangedmain(dacd78525) on this machine, includingagc_driver_image_plane_address_on_lineandagc_driver_image_plane_address_on_line_implicit_lod. No test changes result.python3 tools/check_conventions.py --base origin/mainpasses.02638c00 00700000 00000000 81800924 ...). With this change, on top of #4474 and #5375, it gets to the menu with music and then stops at a separate, unrelated MSAA error.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)ResourceTracker.cpp, which merge cleanly, and adds a debt entry next to the one changed here; whichever PR merges second needs a rebase of that line indocs/dev/debt/shader.md)Imported from boykopovar/AnyPS5. Originally posted by KauaSantos702 on 2026-10-14T13:37:55Z.
NVIDIA run at this head (
7bce94920), adding a vendor to the AMD results in the body: noagc_*test fails.BUILD_TESTING=ONctest -R '^agc_' -j2: 484 tests, 483 passed, 0 failed, 1 skipped. The skipped test isagc_driver_stencil_ref_export, because the device lacksVK_EXT_shader_stencil_export; it is also skipped onmain.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T17:18:35Z.
Run on an Apple GPU, since the PR was tested only on the RX 5700 XT.
GPUs tested: Apple M2 Max, MoltenVK 1.4.2 (Vulkan 1.4.357), macOS 27.2, x86-64 under Rosetta
maindoes not run the GPU tests on macOS yet, so I tested onmacos-portatb7eb6b6b(mugurc/AnyPS5) with this PR's diff applied, not onmain. Release build, LunarG Vulkan SDK 1.4.363.0. The suite isctest -R agc -E 'flip|display|lds_atomics64' -j1 --timeout 30. Without the PR, 22 tests fail on this branch, all of them known macOS failures listed in #1. Head7bce94920. The diff applies cleanly, exceptdocs/.agc_driver_image_plane_compare_on_linepasses. With only the new test added to the unchanged branch, it fails withimage descriptor is incompatible with the static runtime image interface: descriptor format 7 decodes to {class 1, dim 1, ...}, so the 1D compare path runs on this device. MoltenVK normally backs 1D images with 2D textures (itstexture1DAs2Dsetting).agc_driver_image_plane_address_on_lineandagc_driver_image_plane_address_on_line_implicit_lodpass here with and without the PR. The description says they fail on the 5700 XT.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:58:21Z.
Checked on the HW oracle (gfx1035, IEEE off, DX10 clamp on):
image_sample_c_lz,image_sample_candimage_sample_c_lwith DIM 2D on a 1D T# equal the DIM 1D comparison bit for bit over 63504 rows (32_FLOAT and 16_UNORM, HEIGHT 1 and 3, point/bilinear, wrap/clamp/border, several compare functions, v in {0, 0.5, 1, 1.5, -0.25, 3}), matching your gfx1010 measurements. The new test fails without theResourceTrackerchange and passes with it.Rebased onto main: the only conflict was the 2D-through-1D line in
docs/dev/debt/shader.md(#5375 edited it); kept main's text and added your comparison sentence. Tests on the rebased tree: onlyagc_driver_tessellationfails, as on main. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T20:17:14Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/shader/recompiler/Optimization/src/ResourceTracker.cppL1509-1510docs/dev/debt/shader.mdL71