Repository navigation
fix(agc): sample S# filter mode 3 as a weighted average - #22665
oneandonlydean merged 1 commit into
Conversation
FILTER_MODE 3 filters exactly like mode 0 on RDNA2, so decode it as a weighted average, clear it to 0 in materialized direct samplers so the min/max rules do not apply, and poison table samplers only for modes 1 and 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
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
| Check | Result | Note |
|---|---|---|
| Diff and changed code review | passed | Relevant changes and call sites inspected |
| Automated checks | not run | Author-reported results only |
| Negative control | not run | No test mutation performed |
Findings
Blocking
None.
Non-blocking
None.
Sources
- Sampler reduction mode decoding
- Sampler descriptor materialization and table handling
- Filter-mode rendering regression test
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.
|
Correction to the title evidence in this PR's description. The PPSA02306 and PPSA02630 descriptors it cites (image words in buffer and sampler slots) appear to come from pixel programs the driver should not run (draws whose color write masks reach no formatted target); I have not traced each descriptor to its draw, but the stops disappear when those programs are skipped. With only #21747's one-line change to So these titles do not need this PR once #21747 is merged, and the description's "stops on it" no longer motivates it. What remains is the hardware behaviour this PR implements, measured as the description states; it applies only when a program really samples or loads through such a descriptor. I am leaving the PR open on that basis, and the maintainers may reasonably decide it is not worth the code without a title that needs it. AI-assisted: yes |
|
Pascal result for this one: Windows 11 (VM, NVIDIA GeForce GT 1030, R580 driver, WinLibs GCC 16.2 POSIX UCRT, Ninja, Release,
|
|
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.
|
|
NVIDIA run: the new filter-mode-3 test passes and the sampler tests do not regress. Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base 2c10195, head is 1ec4059.
Every run selects the RTX 3070; every Vulkan test's log shows the layer inserted, none reports it missing, and no log has a AI-assisted: yes |
|
AMD Windows driver run: the new Setup: Windows 10 22H2, AMD Radeon RX 9070 XT (RDNA4, AI-assisted: yes (Claude Code) |
|
Tested on Intel Arc B390 (Mesa 26.2.7 ANV, Linux 7.2.10), PR head
AI-assisted: yes (Claude Code) |
#22665 samples S# filter mode 3 as a weighted average and lets image-table samplers with mode 3 into the table, but ReducesBetweenTexels still counted any nonzero filter mode as a min or max reduction. The point-filtered variant of such a sampler, built for a sint, converted or depth-bits image, then threw 'a min or max reduction sampler that filters between texels or mip levels samples an image that needs point filtering'. Only modes 1 and 2 reduce; mode 3 now point-filters like mode 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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)