fix(agc): sample point-filtered clamp-half-border axes like clamp-to-last-texel #22753
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22753"
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-18T07:07:14Z.
What
An S# with clamp mode 4 (clamp, half border) on X or Y was always created as
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER. With point XY filters RDNA2 never reads the border in that mode: past an edge it returns the edge texel, exactly like clamp-to-last-texel. AnyPS5 returned the border colour there.GuestSamplerResource.cpp: when neither XY filter is bilinear or anisotropic (both 0, point), an X or Y axis in mode 4 maps toVK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE. With a bilinear or anisotropic filter it keepsCLAMP_TO_BORDER, which is still not what the hardware does: the hardware blends half the border at the edge. Z keepsCLAMP_TO_BORDERtoo, since that axis was not measured. Unnormalized samplers have their own path (#14964) and are unchanged.tests/GuestSamplerResource.cpp(run byagc_driver_graphics) checks that:main, so a## changefragment cannot name it yet (debt_fold --checkreports 0 matching entries). This PR therefore updates that fragment in place to record the new mapping, as #22579 did for a libc fragment. The rest of the entry (bilinear modes 4 and 5, mode 7) is unchanged.Source of the semantics: the hardware-oracle measurement in #22729 (gfx1036, AMD Windows driver 32.0.21045.16010): an 8×1 32_FLOAT texture,
image_sample_lzat 16 normalized x from −2.3 to 2.6, clamp modes 0 to 7, border colour types 0, 1 and 2. With point filters mode 4 returns the edge texel at every x past either edge, the same as mode 2.Tested
pr_overlap.py --branchfailed closed on one open PR that conflicts withmainand sharesGuestSamplerResource.cppor its test; its diff does not touch the address-mode mapping or the clamp-mode fragment.Windows 11 Pro 10.0.26200, validation layer 1.4.363,
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer:agc_oracle_runner. Before: mode 4 differed at 13 of 16 x for each border type on both GPUs. After: mode 4 matches on both GPUs for all three border types. Modes 0–3, 5 and 6 still match, and mode 7 differs as before (documented).agc_driver_graphics: passes on NVIDIA GeForce RTX 5080 (610.74) and AMD Radeon(TM) Graphics (gfx1036, 32.0.21045.16010), 0VUID-.ctest -R 'agc_driver_.*(sample|gather|unnormalized|cube|color_compare|border|clamp)'):image_sample_lod_clampandimage_sample_lod_clamp_shader_lanefail as they do onmainon this GPU;VUID-on both.Each log shows
Insert instance layer "VK_LAYER_KHRONOS_validation"and nowas not found but was requested.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-18T16:51:36Z.
Review: APPROVED
Reviewed — looks good
The reviewed change maps normalized point-filtered mode 4 on X and Y to clamp-to-edge, and I found no blocking defect in the changed code.
What I ran
Reviewed head
1052422828fabb44774a7cc38a90574e0c4fc554against the prepared diff; no tests or build commands were run. Read the description, commits, manifest, diff,GuestSamplerResource.cpp, andtests/GuestSamplerResource.cpp. All three changed files were marked included in the manifest; I also read the changed debt fragment from the diff.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author-reported hardware sweeps and test runs were not independently verified. The remaining lines of the sampler test file and repository context beyond the targeted code were not read.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:00:58Z.
Review: COMMENTED
The decode change requires both XY filters to be point and keeps Z outside the measured change. The mock verifies address-mode selection, while #22942 checks that the chosen mode affects actual sampling. Please retain the full-border control when landing the dependent fixture. The common graphics control and the combined behavior check are queued on lavapipe.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.