fix(shader): bind 1D textures to 2D bias, offset and mip-load accesses #23701
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23701"
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-19T13:38:15Z.
What
A DIM 2D
image_sample_b,image_sample_lz_o,image_sample_l_o,image_sample_b_oorimage_load_mipthrough a 1D T# threwimage descriptor is incompatible with the static runtime image interface. The 1D mode for 2D accesses through a 1D T# (flatLineCompatible, #2237) took only loads,image_sample_lz, plainimage_sample,image_sample_landimage_gather4_lz.ResourceTracker.cpp:image_load_mip. The 3D-on-1D mode keeps its mip-less loads. Through a 2D-array view of a 1D T#, only the measured_lzand_lforms are taken, as before.2D bias, offset and mip-load accesses through a 1D T#entry records the measurement.No cache format change:
flatLineCompatibleis an existing field.Measurement:
tools/hw-oracleon gfx1036. The source was a 64-texel, five-level 32_FLOAT 1D T# (texel = level·1000 + x) with clamp and wrap addressing. There were 32 rows per case, with u in [-0.3, 1.3], second coordinates 0, 0.5, 1, 3, -0.25 and 7, biases -1 to 3.5, x and y offsets -8 to 7, and LODs 0 to 3:mainDIM 2Dimage_sample_lz_o, clamp / wrapimage_sample_l_o, clamp / wrapimage_sample_b, clamp / wrapmain's DIM 1Dimage_sample_bimage_sample_b_o, clamp / wrapmain's DIM 1Dimage_sample_b_oimage_load_mip, x 0 to 70, y 0, 1, 2, 5 and -1, mips 0 to 7The bias forms take the same path as DIM 1D. Their translated results equal the translated DIM 1D ones on 32/32 rows on both GPUs. Both differ from the hardware in a compute shader only because the translation takes a compute shader's implicit LOD as 0, while the hardware uses the quad derivatives. In a pixel shader the bias works as the test below shows.
Tested
Windows 11 Pro 10.0.26200, MinGW Release build.
ctest --test-dir build -R '^agc_driver_image_(plane|volume|sample|gather|one_dimensional)|^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 three NVIDIA failures are the same on both sides:
agc_driver_image_plane_address_on_line(linear mip blending, see #6221),agc_driver_image_sample_lod_clampandagc_driver_image_sample_lod_clamp_shader_lane.agc_driver_image_plane_offset_on_line(compute):image_sample_lz_oandimage_sample_l_othrough a two-level 16-texel 1D texture;_l_o;image_load_mipwith x inside and past each level, y from 0 to -1 and mips 0 to 3;agc_driver_image_plane_address_on_line_implicit_lod(pixel shader) used to require the DIM 2Dimage_sample_brefusal. It now draws that shader with a bias of 0 and of 1 at one texel per pixel and expects levels 0 and 1 of the first coordinate's footprint. Passes on both GPUs.main'sResourceTracker.cpp, the new test fails on both GPUs with the refusal;image_load_mip.agc_driver_image_plane_address_on_line_implicit_lodfailed withimage_sample_b 2d on a 1D texture was not refused. That is the check this change replaces.tools/pr_overlap.pycould not compareResourceTracker.cppwith the PRs that conflict withmain; none of their diffs touches theflatLineconditions. My open #23644 and #23519 edit other conditions a few lines above. 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:40:37Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at head
96bfc118f9f90027235713ebd89c6a7cae82666dis internally consistent in the changed compatibility logic and tests; no checks were run during this review.What I ran
No commands or tests were run. I inspected the prepared diff and the changed files at the pinned head.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The hardware measurements and test results described by the author were not independently verified. Build and test execution were not performed. All four changed files listed in the manifest were read; no changed files were excluded.
To get this to a good state
Nothing is required.