fix(agc): clear the stencil shadow probe's destination before its copy #25608
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25608"
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 androidbaklava on 2026-11-22T11:24:30Z.
What
Refs #16883 and #16908.
ProbeStencilShadowCopydecides whether a multisampled D32S8 image keeps the shadow-copy path or falls back to direct sampling. It copies a stencil pattern into a freshly allocated shadow image and checks the result, but it never initialises the shadow first. On a driver whose copy drops part of the stencil plane, the bytes the copy misses keep whatever the allocation held before, and an earlier probe's images can hold that same pattern. So the probe passed or failed by chance, and when it passed, the surface took the shadow path that does not keep its samples.This change clears the shadow image (depth 0.25, stencil
0xa5, a value the pattern never uses) before the copy, with a transfer-to-transfer barrier. A copy that writes the whole stencil plane overwrites the clear, so on hosts whose copy works the probe result and the path do not change.On Intel UHD Graphics (Raptor Lake,
8086:a7a8, driver 101.7084) on Windows, with logging added locally to the probe: onmainthe probe answered "copy works" for 4, 7 and 8 of the 18 D32S8 probes (2, 4 and 8 samples) in three runs ofagc_driver_native_depth_other_identity, and every case that failed came straight after a probe that said "works" at 4 or 8 samples. With the clear it answered "does not work" for 18 of 18 in each of 3 runs. Forcing the shadow path on (local experiment) failed every 4- and 8-sample case of that test.Tested
Windows 11 Home 10.0.26300, i7-13620H, Intel UHD Graphics
8086:a7a8(Raptor Lake) driver 101.7084, Vulkan 1.4.323, WinLibs GCC 15.2.0 r7 UCRT, Release.main6c70b74203against this change from the same build tree.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer(Khronos validation 1.4.363).ctest -R ^agc_driver_native_depth -V(31 tests)mainnative_depth_other_identityfailednative_depth_other_identityfailednative_depth_other_identityfailedVUID-linesEvery log shows
Insert instance layer "VK_LAYER_KHRONOS_validation", and none showswas not found but was requested. Onmainthe test fails withthe last identity over the shared planes did not publish its samples over them at byte 2: the guest planes still hold the first identity's depth samples (0.3125 to 0.5) instead of the second's (0.5625 to 0.75).agc_driver_native_depth_publication, run alone 30 times without the layer:mainfailed 3 of 30 (native D32S8 publication lost live samples, HTILE, padding or guest writes), this change 0 of 30.Full suite on
mainon the same machine: the otheragcfailures are the known Intel ones (#20831, #21683, #21713, #21741, #21749, #24072), and the 4,626 non-agctests pass. Not tested on NVIDIA or AMD. There the copy keeps stencil and overwrites the clear, so the probe should still pass and keep the shadow path.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-22T11:29:09Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected code supports merging, and the author-reported results are consistent with the fix.
What I ran
Reviewed head
62dc63885c52962fe28801b7070406a2e17d8708usingrepo_read.pyto read the prepared diff, manifest, description, and both changed files. No tests were run by me; the Windows test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run in this review. The author-reported results were not independently verified. Other GPU vendors and console behavior were not tested by the author. Files read:
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppanddocs/dev/debt/changes/fix-agc-stencil-shadow-probe-cleared.md. Excluded files: none (files.jsonwas not provided in the prepared review folder).To get this to a good state
Nothing is required.