fix(shader): read explicit-LOD and level-zero 2D-array samples through 1D T#s as measured #5841
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5841"
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 simonbronk on 2026-10-14T13:30:01Z.
What
Onimusha: Way of the Sword (PPSA27836) samples a 1D T# (8_8_8_8 UNORM, from a bindless material table) through a 2D-array
image_sample_l, and preparation stops:#5583 (merged) gives 2D explicit-LOD samples through a 1D T# the 1D runtime mode. This extends that mode to 2D-array accesses, for
image_sample_landimage_sample_lzonly, as measured.Source: hardware measurement on RDNA2 (gfx1036, Ryzen iGPU),
tools/hw-oracle/template.sassembled by the AMD Windows driver'samd_comgr_2.dlland launched through itsamdhip64_6.dll(the runner posted in #1281, with the template's newer placeholders filled). Each row samples the same TYPE 1D T# with DIM 2D_ARRAY and with DIM 1D and compares the results bit for bit. 16-texel 8_8_8_8 UNORM T# filled with distinct words; 1 or 5 levels, the 5-level one also with HEIGHT 3 or DEPTH 3; u of 0.03125, 0.33125, 0.96875, 0, 1, -0.2, 1.3 and 0.6; v of 0, 0.5, 1, -0.25 and 3; slices 0, 1, 2.7, -1 and 5; LOD -1, 0, 1, 1.25, 2.75 and 6; point and linear filtering with point and linear mips under clamp, wrap and border addressing.image_sample_l: 24000/24000 rows equal.image_sample_lz: 24000/24000 rows equal.image_load(not enabled here): DIM 2D_ARRAY returns the DIM 1D texel only at slice 0 and zeros at slices 1, 2, 5 and -1, even with DEPTH 3 (600 rows). It keeps throwing, and the debt entry records it.The plain
image_sampleand the other 2D-array accesses through a 1D T# also keep throwing. The PS5's gfx1013 is not measured.Tested
main0afa6a607(#5583 merged; the line-sample condition keepsmain's comparison mask for non-array accesses):ctest -R "agc|shader|video_out"on the RTX 5070: 601/601 pass;mainon this GPU.agc_driver_image_plane_address_on_linegainsCheckArray:image_sample_landimage_sample_lzwith DIM 2D_ARRAY through the 5-level 1D T#, slices 0, 1, 2.7, -1 and 5, under the five sampler cases, compared bit for bit withimage_sample_lDIM 1D. It passes on the RTX 5070 and on the AMD iGPU. Without the change it fails with the title's message.python tools/check_conventions.py --base upstream/main: passes.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 — not applicable.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T13:30:14Z.
The probe and the raw output of the measurement. The runner is
hw_oracle_win.pyfrom #1281 with one change:assemblealso fills the template's newer placeholders (@DX10_CLAMP@1,@ROUND32@0,@ROUND16@0,@FP16_OVERFLOW@0,@LDS@4096). Run aspython probe_1d_as_2darray.py image_sample_l(orimage_sample_lz,image_load) next to it andtemplate.s.probe_1d_as_2darray.py
image_sample_l output
image_sample_lz output
image_load output
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T17:18:37Z.
Run on an Apple GPU, as a third device next to the RTX 5070 and the AMD iGPU.
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. Headafb8151ac, which includes #5583's commit. The diff applies cleanly, exceptdocs/.agc_driver_image_plane_address_on_linepasses, includingCheckArraythrough the 5-level 1D T#. With only the test file applied to the unchanged branch, it fails withdescriptor format 56 decodes to {class 1, dim 1, ...}, so the new cases do run here. This is relevant on MoltenVK because Metal 1D textures have no mip levels, and MoltenVK normally backs them with 2D textures (texture1DAs2D).a98b06534): same result, the test fails without the change and passes with it.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T19:57:36Z.
Rebased onto
main411e5e6d9(d4aeaf4a9).mainnow hasbd09862e5(3D accesses through 1D T#s), which changed the same lines:ResourceTracker.cpp:flatVolumeLineCompatiblefrommainis kept as it is. This PR's explicit-LOD and 2D-array cases still only widenflatLineCompatible.docs/dev/debt/shader.md: kept the new "3D image accesses bound to a 1D T#" entry beside this PR's updated 2D entry.Tested again on Windows 11 Pro 26200, Release:
ctest -R "agc|shader|video_out"576 of 576 pass.main.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:15Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppdocs/dev/debt/shader.mdImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:42:52Z.
Rebased onto
main(mechanical conflict inResourceMaterializer.cppwith the cube-face block; kept both). Measured on gfx1035 with the HW oracle (your probe, IEEE off):image_sample_landimage_sample_lzDIM 2D_ARRAY match DIM 1D on 24000/24000 rows each, and 2D-arrayimage_loadreturns zeros at slice ≠ 0, so keeping it throwing is right.agc_driver_image_plane_address_on_linefails without the change and passes with it on RADV; merging.