fix(shader): sample a 1D T# through a 2D implicit-LOD image_sample #3222
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3222"
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 fma-rc on 2026-10-11T01:59:39Z.
What
A plain
image_sample(implicit LOD, no bias, offset or compare) that says DIM 2D on a 1D T# had no runtime image mode and stopped the draw withimage descriptor is incompatible with the static runtime image interface. The 1D mode already existed forimage_sample_lzand mip-lessimage_load; this allows it for the plain sample as well, so the access becomes a 1D implicit-LOD sample on the first coordinate.Source: measured with the hardware oracle on RDNA2 gfx1036 (Radeon 610M), wave32 and wave64,
ieee 0,dx10_clamp 1, denormals preserved, round to nearest even. On a 16-texel, 5-mip 32_UINT 1D T# with point filters, DIM 2D picks the same mip and texel as DIM 1D for first-coordinate steps of 0, 1, 2, 4 and 8 texels per lane, whatever the second coordinate does; the same rows on a 16x16 2D T# move the mip with the second coordinate. The limits (point filters, gfx1036, and the LOD 0 every plain sample gets outside the pixel stage) are indocs/dev/TechnicalDebt.md.Astro's Playroom (PPSA01325) draws with such a pair: pixel shader
image_sample ... dim:SQ_RSRC_IMG_2Don a type 8 T#, format 71.Tested
Arch Linux, GCC 16.2.1. New test
agc_driver_image_plane_address_on_line_implicit_lodsamples a 16-texel, 5-mip 1D T# from a pixel shader with DIM 2D while the second coordinate advances 3 per pixel, and requires mip 0, 1 or 2 by the first coordinate's step and the right texel on every pixel;image_sample_bon the same pair must still be refused. It fails onmaind31b57a4cwith the error above and passes with the change, on an RTX 5080 and on RADV gfx1036. Full ctest: 753/753 on RADV; on the RTX 5080 onlyagc_driver_dcc_keys_first_writefails, which this change does not touch.tools/check_conventions.py --base origin/mainpasses.The title needs two changes that are not on
mainto get this far (#3186 and #3214), so the title runs used all three together: without this one it stops on the image error (2 of 2 runs), with it that error is gone and the title stops later on its ownOut of Global Heap Memoryassert (2 of 2 runs).Not tested: Windows, linear filtering through such a pair, the PS5's gfx1013.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T01:59:49Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T06:14:55Z.
Windows run, since the PR lists Windows as untested. Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, RTX 4070 Laptop GPU (driver 616.92), head
8132ac7amerged ontomain4be74d4f. I ran withVK_LOADER_DRIVERS_DISABLE=*dzn*because this machine's Dozen ICD crashes on its own (#3255).agc_driver_image_plane_address_on_line_implicit_lodpasses, as does the existingagc_driver_image_plane_address_on_line.ctest -R "^agc_|video_out|^shader|recompiler": 358/358 pass. The VideoOut flip tests skip as usual on this machine.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:16:26Z.
Checked on RDNA2 (gfx1035) with the hardware oracle, compute kernel with quad derivatives, IEEE 0 and 1: across 2880 lanes, plain
image_samplewith DIM 2D on a 16-texel, 5-mip 1D T# returns the same bits as DIM 1D for point and trilinear filtering, clamp and wrap, whatever the second coordinate does; the mip is round(log2(max |du|)) on every lane, and a 16x16 2D T# moves with the second coordinate as a control. So linear filtering matches too. The new test passes on RADV and fails without the change. Merging.Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T07:57:16Z.
agc_driver_image_plane_address_on_line_implicit_lodfails on lavapipe, so CI'slinuxjob is red onmainsince this merged: run 38121878271 (2bb78d2c) fails only this test of 790, and the pre-merge dispatch of this PR, run 38118105222 (06:27Z), failed the same way:Replica of the job (ubuntu 24.04, GCC 13.3, Mesa 25.2.8 llvmpipe LLVM 20.1.2, the driver CI logs,
ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx), onmainb6f649d9:Requirereplaced by a record of every wrong pixel reads the wrong mip at 88 of 1024 pixels for step 1 and 94 for steps 2 and 4, the same pixels in 10 of 10 runs; the same binary gives the same pixels on Mesa 26.0.8 (LLVM 21.1.8).agc_driver_image_plane_address_on_line(image_sample_lzon the same coordinate) passes, so the coordinate is right and what differs is the LOD llvmpipe computes for this sample.OpImageSampleImplicitLodon aDim1Dsampled image with a scalar float coordinate, in the entry block;spirv-val --target-env vulkan1.3passes. RADV, the RTX 5080 and the RTX 4070 pass per the PR and @AchrafReyani's run.Step 1 map: rows y = 0..15, 64 pixels each, `.` right, digit = mip level read
AI-assisted: yes (Claude Code Fable 5.1 xhigh)