fix(agc): sample S# filter mode 3 as a weighted average #22665
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22665"
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 JJenkx on 2026-11-18T00:56:46Z.
What
A sampler whose S# word 0
FILTER_MODE(bits 29-30) is 3 threwguest sampler descriptor uses an unknown reduction filter mode 3. Spirit of the North: Enhanced Edition (PPSA02306) and PPSA05595 have stopped on it.On RDNA2 mode 3 filters exactly like mode 0 (weighted average).
toVkReductionModenow maps 3 toVK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT.materializeBlendingReductionsclears mode 3 to 0 in the materialized S# of directly bound samplers, so the recompiler's min/max rules (reducesBetweenTexels, the converted-image and comparison refusals, the one-slice volume rule) treat it as the blend it is; samplers in descriptor tables are poisoned as reductions only for modes 1 and 2.Hardware measurement
tools/hw-oracleon an RX 6650 XT (gfx1032, RDNA2, Linux 7.2.14, hsa-rocr 10.1, clang 23.1.5; wave32, IEEE off, DX10 clamp on, denormals preserved, round to nearest even, FP16 overflow off). A 64x64 8_8_8_8_UNORM gradient,image_sample_lzDIM 2D at 32 coordinates 0.3 texel off the texel centres, bilinear sampler with word 00x92 | FILTER_MODE << 29and words 1-300fff000 06500000 00000000,FILTER_MODE0 to 3:FILTER_MODEMode 3 matched mode 0 bit for bit at every coordinate. This is an RDNA2 measurement, not PS5 evidence.
Tested
Linux 7.2.14, Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.7), GCC 16.2.1, Release,
ANYPS5_ENABLE_SPIRV_TOOLS=OFF.agc_driver_graphics(tests/GuestSamplerResource.cpp): the case that expectedunknown reduction filter mode 3now requires mode 3 with a point and a linear mip filter to decode toVK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, chain no reduction struct intovkCreateSamplerand not require min/max filtering. Modes 0 to 2 are unchanged.agc_driver_image_filter_mode_three: draws a two-texel 8_8_8_8_UNORM texture through a bilinear sampler withFILTER_MODE0, 1 and 3. Mode 0 and mode 1 must draw different images (so the draw filters between texels), and mode 3 must draw exactly what mode 0 draws. With the source change reverted it fails withunknown reduction filter mode 3.ctest -R "filter_mode_three|guest_sampler|agc_driver_graphics$|sampler|disabled_degamma|shader_memory|image_": 151 of 152 pass.agc_driver_image_table_packed_guardsfails (unrecoverable packed table format was not poisoned) here and identically in four of my other local builds without this change, so it is not caused by it.610ba140 00100010 00000004 0004dfac, passed the reduction check and then stopped onunnormalized guest sampler uses MC_COORD_TRUNC with an unimplemented clamp modefor the same sampler. Its word 3 looks like T# destination selects, so it is probably not a sampler the title meant to use. This PR therefore does not unblock PPSA05595; it removes the reduction-mode refusal the earlier runs stopped on.Independent NVIDIA Linux validation reported by @Doorriiaann: RTX 3070 test results at
1ec4059a1c; the contributor reports passing focused checks with no Vulkan validation errors.Additional GPU qualification (independent Intel report): Intel Arc B390, ANV Mesa 26.2.7, Linux 7.2.10; head
1ec4059a1con main8c254da48b. The graphics fixture andagc_driver_image_filter_mode_threepass (2/2), with actual validation-layer 1.4.341 insertion and no VUIDs reported. The same new fixtures on main fail and detect the targeted bug. These are peer-reported results, not tests run on this machine.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:17:33Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes contain no verified blocking defects and support approval at head
1ec4059a1c7e9d02121ed2afc9b901817c9c9fa5.What I ran
Read the prepared diff and changed-file context through
repo_read.py; no commands or tests were run by me. The author reports a 151/152 test result, with one failure said to reproduce on unrelated builds.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
I read the full changed sampler decoder and new rendering test, the changed hunks and relevant sections of the 631-line sampler test and 3041-line materializer, plus the full debt note. The remainder of those two long files was not read. The author-reported test results and hardware measurements were not independently confirmed; no local build, test run, or PS5 behavior was verified.
To get this to a good state
Nothing is required. The author-reported test results and hardware measurement are optional supporting evidence.