Skip to content

fix(shader): point-filter direct samplers paired with unsigned integer images - #7707

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/uint-direct-point-sampler
Oct 20, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/uint-direct-point-sampler

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

agc_driver_image_table passes, but the Khronos validation layer reports VUID-vkCmdDispatch-magFilter-04553 once per process on every device @Amoenus checked (#7699). A sampled image with an R32_UINT view is used with a VK_FILTER_LINEAR sampler, and R32_UINT has no SAMPLED_IMAGE_FILTER_LINEAR support.

The dispatch is the test's direct-binding control RunDirect(device, LinearWrap, uintImage), a direct uint T# under a linear S#. A run with the validation layer and a marker before each of the test's dispatches puts the error right after that call, once per process on both NVIDIA and lavapipe.

Direct bindings choose which samplers get a point-filtered copy in DescriptorBindingBuilder.cpp (samplerMode). That rule covers signed integer, converted and depth views, but not unsigned integer ones. Image table entries already use the point-filtered copy for both integer classes (requiresPointSampler in ResourceMaterializer.cpp). #757 first made the direct rule cover unsigned images too, after lavapipe returned a non-point result for this pairing. The rule in main covers signed images only.

This PR adds the unsigned integer class to samplerMode, so a direct uint binding under a linear S# gets the point-filtered copy, as table entries and signed views do. On AMD hardware, integer formats aren't filtered either, so the point sample is what the guest sees. The test's control now expects PointWrap for the direct uint binding. Float bindings keep LinearWrap.

Tested

Ubuntu 24.04 (Linux 6.8), GCC 13.3, Release; NVIDIA GeForce RTX 4070 Ti (595.99.02) and lavapipe. The Khronos validation layer is Ubuntu's 1.3.275 package, loaded with VK_LAYER_PATH and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.

  • main 0c25997 under the layer: agc_driver_image_table passes but reports VUID-vkCmdDispatch-magFilter-04553 once, on NVIDIA and on lavapipe, right after RunDirect(device, LinearWrap, uintImage).
  • With this PR under the layer: no magFilter error on either device. The only report left is VUID-VkDeviceCreateInfo-pNext-pNext, which this older layer gives on main too for newer device extensions.
  • agc_driver_image_table passes 3 of 3. With main's DescriptorBindingBuilder.cpp under the updated test, it fails with image table: the direct bindings under a linear S# changed their sampler copies.
  • The 66 tests matching image|sampler|^agc_driver_graphics$ pass.
  • AMD hardware: @thuanquang measured native image_sample_lz on an RX 6700 XT (gfx1031, RDNA 2) through HIP. Under a bilinear S#, a 32_UINT T# returns the texel under the coordinate (floor(u)), the same as a point S#, while 32_FLOAT blends. That is what the point-filtered copy gives a direct uint binding. This is desktop RDNA 2, not a PS5, and covers unsigned 32-bit only.
  • Windows, RDNA 4: @savvaniss ran it on an AMD RX 9070 XT, merged into main 6b8228b. agc_driver_image_table passes 3 of 3, and fails with only this PR's test changes. An Intel UHD 770 can't run it either way, because main refuses its image tables before this code (fix(agc): bind image and sampler tables through update-after-bind limits #6647).
  • Windows, under the validation layer: @Amoenus ran it on main 97d5d7a with this change, on an RTX 5080 and an AMD Radeon iGPU (Khronos 1.4.363). On unmodified main, the test passes 3 of 3 with one magFilter-04553 per process. With only the test change, it fails 3 of 3 at the sampler-copy assertion. With this PR, it passes 3 of 3 with no validation errors.
  • Khronos validation, as CONTRIBUTING.md asks: Ubuntu's 1.3.275 layer loaded with VK_LAYER_PATH, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, RTX 4070 Ti, Linux. Neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS. ^agc_driver_image_table$: on main 017f215 it reports magFilter-04553 ×3 and VkDeviceCreateInfo-pNext-pNext ×3. With this PR it reports only pNext-pNext ×3, which this older layer gives for newer device extensions.
  • The same comparison under the LunarG SDK's 1.4.363 layer, the version Windows reviewers run: main 017f215 reports magFilter-04553 ×2, and this PR reports nothing.
  • AMD on Linux: @DavidAmsellem ran it on an RX 7900 XT (RADV NAVI31, Mesa 25.2.8), merged onto main c4708fa, under the 1.3.275 layer with VK_LOADER_DEBUG=layer confirming it loaded. magFilter-04553 goes from 1 to 0, the old layer's two noise VUIDs have the same counts with and without the PR, and the full suite is 1631/1633 on both, with the same two failures.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: AGC: image-table test passes with invalid linear filtering of R32_UINT #7699
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 595.99.02, Ubuntu 24.04 (Linux 6.8); lavapipe (Mesa, llvmpipe); AMD Radeon RX 9070 XT, Windows 11 (@savvaniss); NVIDIA RTX 5080 and AMD Radeon Graphics (1002:13c0), Windows 11 (@Amoenus); AMD RX 7900 XT, RADV Mesa 25.2.8, Linux (@DavidAmsellem)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

…r images

A direct sampled image of the unsigned integer class kept its sampler's
linear filter, while signed integer, converted and depth views got the
point-filtered copy. Vulkan formats like R32_UINT have no linear filter
support, so the sample was undefined (NVIDIA returned the point sample,
lavapipe did not) and the validation layer reported
VUID-vkCmdDispatch-magFilter-04553 for agc_driver_image_table. Unsigned
integer images now get the point-filtered copy too, as image table entries
already do.

Fixes boykopovar#7699

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 5371 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 5609 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 6280 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 6412 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 6539 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 6947 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 7085 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 7223 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 7395 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 7642 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 7689 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp

@thuanquang

Copy link
Copy Markdown
Contributor

Hardware data for "on AMD hardware, integer formats aren't filtered": RX 6700 XT (gfx1031, RDNA 2), native image_sample_lz through HIP on a 32x1 linear T# whose texels hold 10, 20, ..., 320, with an S# that has XY_MAG_FILTER and XY_MIN_FILTER set to bilinear, sampled at texel coordinates 8.0 to 11.875 in steps of 1/8:

T# format point S# bilinear S#
32_FLOAT the texel under the coordinate (floor(u)): 90 for 8.0-8.875, 100 for 9.0-9.875, ... blends: 85 at 8.0, 90 at 8.5, 93.75 at 8.875, ...
32_UINT the same as 32_FLOAT point identical to point: 90 for 8.0-8.875, 100 for 9.0-9.875, ...

So with a linear S#, the hardware returns the unsigned integer texel a point S# returns, the one containing the coordinate (floor(u)), not a blend and not the top-left texel of the bilinear footprint. That is what this PR's point-filtered copy gives a direct uint binding. Desktop RDNA 2, not a PS5; I measured 32_UINT only, not the signed formats.

@savvaniss

Copy link
Copy Markdown
Contributor

RDNA 4 data: agc_driver_image_table fails on main and passes with this PR on an AMD RX 9070 XT. On an Intel UHD 770 it can't run either way, for the reason #6647 fixes.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head 193c54016 merged into main 6b8228b2b. "Without" means this PR's test files on main 6b8228b2b, with none of its other changes.

Tests, ×3 UHD 770 RX 9070 XT
This head: agc_driver_image_table fails: sampler tables need runtimeDescriptorArray and descriptorBindingPartiallyBound, which the device lacks pass
Without same failure fails: image table: the direct bindings under a linear S# changed their sampler copies

The UHD 770's regular descriptor limits are 200 per stage, so main refuses its image tables before reaching this PR's code (#6647 binds them through the update-after-bind limits).

AI-assisted: yes (Claude Code)

@Amoenus

Amoenus commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

@milescoviello independent Windows validation on main 97d5d7a52a plus your 193c540162 change, composition 567c7ecc39. Original author retained; this is a current-main composition, not an unchanged old-head run.

Image-table check, three fresh processes per GPU RTX 5080 Radeon Graphics
Unmodified main 3/3 pass; 3 magFilter-04553 errors 3/3 pass; 3 same errors
Your assertion only, production unchanged 3/3 fail at the sampler-copy assertion 3/3 same expected failure
Your implementation + assertion 3/3 pass; 0 validation errors 3/3 pass; 0 validation errors

The failing control changes only the expected uint sampler copy. Full default and explicit relinker libs builds pass. Image-table, cache-bounds and prepared-graphics tests pass three times on each GPU, plus three CPU shader-memory tests: 21 passes, no VUID/errors/warnings, whole-test skips or timeouts. AMD's wave32-only per-wave-key subcases remain excluded on subgroup64, as on main.

ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, Khronos 1.4.363 confirmed loaded; verbose serial CTest, 30 s per process. Windows 11 Enterprise 26200 / GCC 15.2 r7; NVIDIA RTX 5080 (10de:2c02), driver 610.62 / 32.0.16.1062; AMD Radeon(TM) Graphics (1002:13c0), driver 32.0.21036.18. Actual selected-device output verified. Main has since advanced to f6eeca4f5f; that newer composition, Linux, title impact and performance are not tested here. #7699 updated in place.

AI-assisted validation/report: yes, Codex.

@milescoviello

Copy link
Copy Markdown
Contributor Author

@thuanquang @savvaniss @Amoenus thank you, all three are in the description now.

  • thuanquang's HIP measurement is the hardware data the "integer formats aren't filtered" sentence needed. A 32_UINT T# under a bilinear S# returns the same texel as a point S#, so the point-filtered copy matches RDNA 2.
  • savvaniss's run adds RDNA 4 on Windows.
  • Amoenus's run shows the layer's magFilter-04553 going away on two more vendors, with the test-only control failing as it should.

AI-assisted: yes (Claude Code)

@DavidAmsellem

Copy link
Copy Markdown
Contributor

First AMD-on-Linux (RADV) data for this PR. Merged onto main c4708fa20 (clean merge) and compared with the same main, on the same machine.

Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8. Khronos validation layer 1.3.275, confirmed loaded with VK_LOADER_DEBUG=layer.

Validation run, ANYPS5_NO_SHADER_CACHE=1 main with this PR
VUID-vkCmdDispatch-magFilter-04553 (R32_UINT under a linear sampler) 1, in agc_driver_image_table 0
agc_driver_image_table Passed Passed

The only other VUID- lines in these runs come from the old layer: VkDeviceCreateInfo-pNext-pNext, because it predates VK_KHR_maintenance8, and VkGraphicsPipelineCreateInfo-pLibraries-06681. Their counts are identical with and without the PR (4 and 26). The PR adds no new VUID-.

Full suite without the layer (ANYPS5_REQUIRE_VULKAN=1 ctest -j8): 1631/1633 on both main and with this PR. The two failures are the same on both: agc_driver_image_table_vouched_lookups (#7766, fix in #7916) and agc_driver_guest_memory_lifetime (#7784).

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

@milescoviello

Copy link
Copy Markdown
Contributor Author

@DavidAmsellem thank you, that fills the RADV-on-Linux cell. The error goes away on gfx1100 too, the old layer's noise counts match on both sides, and the full suite matches main. It's in the description now.

AI-assisted: yes (Claude Code)

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff against the description: samplerMode now point-filters unsigned integer direct bindings like signed, converted and depth ones (matching requiresPointSampler for table entries), and the updated control expects PointWrap for the direct uint binding, so it fails without the change. Hardware data from @thuanquang (RDNA 2, 32_UINT under a bilinear S# equals point) and the validation runs from @savvaniss, @Amoenus and @DavidAmsellem back it; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* fix error Closes an issue (Fixes #N) shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: image-table test passes with invalid linear filtering of R32_UINT

6 participants