Repository navigation
fix(shader): bind 1D textures to 2D bias, offset and mip-load accesses - #23701
Conversation
A DIM 2D image_sample_b, image_sample_lz_o, image_sample_l_o or image_sample_b_o through a 1D T# threw "image descriptor is incompatible with the static runtime image interface": the 1D mode of 2D accesses through a 1D T# took only loads, image_sample_lz, plain image_sample, image_sample_l and image_gather4_lz. Measured on gfx1036 with the hardware oracle, each of these equals the DIM 1D form with the same first coordinate, bias, x offset and LOD on 32 of 32 rows with clamp and wrap addressing, whatever the second coordinate and the y offset hold. They now take the 1D mode. The translated offset forms match the hardware on every row on NVIDIA and AMD; the bias forms equal the translated DIM 1D ones, which differ from the hardware in compute shaders because their implicit LOD is taken as 0. agc_driver_image_plane_offset_on_line samples a two-level 1D texture with DIM 2D image_sample_lz_o and image_sample_l_o, x offsets from -8 to 7, y offsets and second coordinates the result must ignore, and LOD 0 and 1. agc_driver_image_plane_address_on_line_implicit_lod required the DIM 2D image_sample_b refusal; it now draws that pixel shader with a bias of 0 and 1 and expects levels 0 and 1 of the first coordinate's footprint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A DIM 2D image_load_mip through a 1D T# was refused for the same reason: the 1D mode took only mip-less loads. Measured on gfx1036 with the hardware oracle, it equals DIM 1D image_load_mip with the same x and mip on 32 of 32 rows whatever y holds (0, 1, 2, 5 and -1), and a mip past the last level reads zero. It now takes the 1D mode, which matches the hardware on every row on NVIDIA and AMD. The 3D-on-1D mode keeps its mip-less loads. agc_driver_image_plane_offset_on_line adds a DIM 2D image_load_mip with x inside and past each level, y from 0 to -1 and mips 0 to 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ran the focused tests with the Khronos validation layer on Linux and an NVIDIA GPU, since CI runs the GPU tests only on lavapipe and the NVIDIA run in the Tested section is on Windows. Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
Run on the current head, which includes the second commit Negative control: with main's No new AI-assisted: yes (Claude Code) |
|
Ran this PR's tests on AMD hardware under RADV on Linux. The Tested runs used NVIDIA and AMD's Windows driver on gfx1036, and the run above used NVIDIA on Linux, so RADV and GCN5 had not been covered yet. Setup: head
AI-assisted: yes (Claude Code) |
|
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The reviewed change at head 96bfc118f9f90027235713ebd89c6a7cae82666d is 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
| Check | Result | Note |
|---|---|---|
| Source review | passed | Four changed files read |
| Tests | not run | Author-reported results only |
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.
|
Tested on Intel Arc B390 (Mesa 26.2.7 ANV, Linux 7.2.10), PR head
AI-assisted: yes (Claude Code) |
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