fix(agc): accept additional color comparison image forms #2092
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2092"
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 authurtabo-byte on 2026-10-09T08:11:30Z.
What
Accept the existing cube-to-2D-array runtime mode for color comparison, and classify 8-bit sRGB formats with the existing UNORM reference clamp. MiniGolf (PPSA03647) uses an sRGB cube comparison descriptor that previously had no matching prepared mode.
Anisotropic point/bilinear encodings 2/3 remain rejected. The previous revision incorrectly treated them as ordinary point/bilinear filtering; this revision restores main's guard rather than weakening the rejection test reported by rmz-24.
No new comparison instruction lowering is introduced. Cube coordinates use the existing
CubeAxis/CubeLayerconversion inSpirvImageEmitter.cpp. sRGB texels use Vulkan's image-format decode before comparison; the GPU regression uses the standard sRGB transfer function as its reference. Console reference-clamping behavior and cube-edge filtering remain unmeasured and are explicitly recorded in TechnicalDebt.Tested
Rebased onto main
0df342c6(PR head9cc55a13). Resolved theTechnicalDebt.mdconflict by retaining both main's ancillary-word entry and this change's color-comparison entry.git range-diffconfirms the executable code changes are unchanged by this rebase. The focused tests below were rebuilt from this PR checkout, separately from the MiniGolf integration branch. Windows, MinGW-w64 GCC 15.2.0, Release, NVIDIA RTX 3050 6GB Laptop GPU, SPIRV-Tools disabled.agc_shader_memory: passes, with an assertion that the captured cube descriptor selects a cube emulated-comparison mode.agc_driver_emulated_color_compare: passes, including new sRGB point/bilinear result checks and rejection of both anisotropic filter encodings. Existing address, border, offset, cache and reduction cases remain enabled.agc_driver_guarded_null_pointer: passes on the rebased main.python -I tools/check_conventions.py --base 0df342c6 --head 9cc55a13: passes.The earlier MiniGolf integration accepted anisotropic filtering incorrectly; that run is not evidence that anisotropic sampling works. Linux, validation layers and PS5 hardware equivalence were not tested locally.
Checklist
main; no other open PR implements the same fix.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T13:21:12Z.
214f75a5 cherry-picked onto current
maind70b8998breaks an existing test:agc_driver_emulated_color_comparefails 3 of 3 runs with this change and passes onmain(Windows 11, RTX 5060 Ti, MinGW-w64 GCC 15.2.0 r7, Release,-DANYPS5_ENABLE_SPIRV_TOOLS=ON; full ctest otherwise 509/510):The case is
tests/execution/EmulatedColorCompare.cpp:257,Reject(*device, Format8888UNorm, {ClampEdge, FilterAnisoBilinear}, "point or bilinear"). With this change an anisotropic-bilinear color comparison is accepted where the test expects theResourceMaterializerfilter rejection. It doesn't look Windows-specific, since it's a recompiler decision. If accepting that form is intended, the test needs updating along with the semantics source for it; otherwise the new path should keep rejecting anisotropic filters.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-09T20:31:01Z.
Thanks for catching that. The branch head has been updated to \2e2ec5d4:
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T05:59:25Z.
Review: CHANGES_REQUESTED
Thanks for restoring the anisotropic rejection. I measured both new forms on RDNA2 hardware (gfx1035,
image_sample_c_lz, IEEE=0), and they don't match what the hardware returns:ResourceMaterializer.cpp:507, test atEmulatedColorCompare.cpp:150). On 8_8_8_8_SRGB (and 8_SRGB, 8_8_8_8_UNORM, 8_UNORM, 16_FLOAT),image_sample_c_lzreturns 0 for every compare function, ALWAYS included, with point and bilinear filtering. Plainimage_sample_lzon the same T# reads the expected decoded texels. Only depth-capable formats (32_FLOAT, 16_UNORM) give a real comparison, andemulatedCompareStatealready sends exactly those to the native path. So "decode, then compare against a UNORM-clamped reference" is not what the GPU does for these formats. The expected values in the test come from the sRGB transfer function, not from hardware, which is why they pass. Please keep these formats throwing. If you want to model them, the measured result is a constant 0, but that is a separate change (see the note below).ResourceMaterializer.cpp:531,:696). On 32_FLOAT, face = layer and s/t in [1,2] match the cube-to-array conversion: all 192 point rows and all 54 in-face bilinear rows agree. With the default sampler (word0 bit 28DISABLE_CUBE_WRAP= 0), bilinear footprints that reach a face edge filter across into the neighbouring face. 46 of 90 edge rows differ from the per-face clamp that the emulation uses, and with bit 28 set all 90 match. Point sampling at the edges matches too. Please throw for bilinear cube comparison unless that bit is set (or model seamless filtering), and add an execution test on a cube view. The current cube test (ShaderMemory.cpp:2138) only checks which mode gets selected.docs/dev/TechnicalDebt.md:45) should then describe what is actually accepted.Note: the UNORM color-comparison emulation already on
mainhas the same mismatch with these measurements (the hardware returns 0 and the emulation compares). That will be raised separately and is not for this PR to fix. Measurements were taken on gfx1035, not on PS5's gfx1013; both are RDNA2.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:13:28Z.
Review: APPROVED
Checked on the PR merged onto current main:
agc_shader_memoryandagc_driver_emulated_color_comparepass, the AgcDriver/Agc ctest scope is green (333/333), and both tests fail without theResourceMaterializer.cppchange. sRGB and anisotropic forms are rejected again, bilinear cube comparison requiresDISABLE_CUBE_WRAP(matches my gfx1035 measurements: 90/90 edge rows), and the cube execution test covers it. Merging.