fix(shader): bind 2D textures to 3D samples with an LOD, bias or offset #23644
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23644"
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 MichonGoddijn231849 on 2026-11-19T11:38:04Z.
What
A DIM 3D
image_sample,image_sample_l,image_sample_bor offset sample through a 2D or 2D-array T# threwimage descriptor is incompatible with the static runtime image interface. The 2D and 2D-array modes for such accesses (#2023,70d190cdd5) took onlyimage_sample_lz,image_loadandimage_get_resinfo, because nothing else was measured.ResourceTracker.cpp:flatVolumeSampleaccepts samples whose flags combine only level-zero, LOD, bias and offset. Samples with derivatives, comparison or an LOD clamp still keep the image out of these modes, and so do gathers, which a DIM 3D gather sends to the 3D gather emulation.3D image accesses bound to a 2D or 2D-array T#entry gains these samples. It is rewritten gap-first to stay under 1000 characters, with the same facts.No cache format change:
flatVolumeCompatibleis an existing field.Measurement:
tools/hw-oracleon gfx1036, 64 rows per case:On a 2D T# (8x8 32_FLOAT, four levels, texel = level·1000 + row·10 + column):
image_sample_l, point / trilinearimage_sample, point / trilinearimage_sample_b, point / trilinearimage_sample_lz_o, point / trilinearimage_gather4_lz,image_gather4_l,image_gather4Against the hardware, the translated DIM 3D samples differ only where the translated DIM 2D ones already do:
image_sample_lon NVIDIA, 58/64 (NVIDIA's mip blend weights, already recorded indocs/dev/debt/shader.md);image_sampleandimage_sample_bin compute, 0/64 on both GPUs (implicit LOD in compute shaders).On a 2D-array T# (64x64 32_FLOAT, three layers,
BASE_ARRAY0 and 1, point and bilinear),image_sample_l,image_sample_b,image_sample,image_sample_lzandimage_sample_lz_owith DIM 3D equal DIM 2D-array on hardware on 64/64 rows each. The translation matches the hardware on 64/64 on both GPUs in all 20 cases.Tested
Windows 11 Pro 10.0.26200, MinGW Release build.
ctest --test-dir build -R '^agc_driver_image_volume|^agc_driver_image_sample|^agc_driver_image_gather|^agc_shader_memory$|disk_cache' -VwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, onmainand on this branch. The GPUs were an NVIDIA GeForce RTX 5080 (610.74) and an AMD Radeon(TM) Graphics iGPU (gfx1036, 32.0.21045.16010).mainNVIDIAmainAMDInsert instance layer "VK_LAYER_KHRONOS_validation"was not found but was requestedVUID-The two NVIDIA failures on both sides are
agc_driver_image_sample_lod_clampandagc_driver_image_sample_lod_clamp_shader_lane, theimage_sample_d_clMIN_LOD failure of #23232.agc_driver_image_volume_address_on_plane:image_sample_lrefusal. It now samples a two-level 16x16 2D texture through that instruction.main'sResourceTracker.cpp, the test fails on both GPUs withimage descriptor is incompatible with the static runtime image interface.tools/pr_overlap.pycould not compareResourceTracker.cppwith 19 PRs that conflict withmain. Of those, #10193, #13928, #13929, #20519 and #22424 only hashflatVolumeCompatible, and none changes the conditions. #20792 (3D stores on 2D T#s) changes stores, not samples. Not tested on a PS5.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:47:36Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and its targeted regression test support merging.
What I ran
Reviewed head
61dbcdfc9e1d3f8f085e1ca4595d9eddd8dcd61a. Read the prepared diff and changed lines, then inspected the relevant resource mode selection and texture descriptor setup usingrepo_read.py. No build or test command was run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No build, automated test, or console run was performed. The author reports Windows 11 tests on NVIDIA RTX 5080 and AMD gfx1036; those results were not independently confirmed. Read:
ImageVolumeAddressOnPlane.cpp,ResourceTracker.cpp, andfix-volume-samples-on-2d-tsharp.md. No changed files were excluded;files.jsonwas not available through the reader.To get this to a good state
Nothing is required.