fix(agc): refresh a block-copied texture the fast lookup would reuse #5654
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5654"
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 milescoviello on 2026-10-14T04:19:40Z.
What
agc_driver_bc_block_copy, added with #4747, fails onmainon Linux with an NVIDIA GPU:The test stores blocks with a compute pass, samples the BC view while they are pending, stores the first pattern again and samples once more. The last sample reads the blocks of the previous copy.
That sample never reaches
cachedTexture. The build takes the stage-A record's texture throughfastTexture, which declines only depth surfaces (DepthSurfaceAt) and textures remade per use (RefreshedPerUse). The block copy is a copy refreshed on reuse (PerUseCopy::RefreshedOnReuse,IsDepthCopy()), like the depth copy, but its surface is not a depth surface. So the fast path hands it back withoutRefreshDepthCopy, although its storage image's version moved.fastTexturenow also declines copies refreshed on reuse. The lookup then takescachedTexture, whose cache hit callsRefreshDepthCopy, and that copies the image again when its version moved.IsDepthCopy()is true for the depth copy as well as the block copy, so both now take that lookup.This is the path #4747 added for Minecraft Dungeons II (PPSA16064), where a compute pass writes block-compressed surfaces that are then sampled. With the fast path, such a surface can be sampled with the blocks of an earlier pass.
Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, RTX 4070 Ti (NVIDIA 580.142), on
mainf40b6930f:On
main,agc_driver_bc_block_copyfails 3 of 3 runs with the line above; it also fails at #4747's merge commitaf991ac40. With the change it passes 10 of 10.With temporary prints (not part of this PR): on
mainthe failing sample calls neithercachedTexturenorRevalidate, andRefreshDepthCopyis not called for it. With the change it is called and copies the image at version 8 (copied at 7 before), for both the BC7 and BC1 cases.All 508 tests in
libSceAgcDriverpass;agc_driver_stencil_ref_exportis skipped, as onmain, because the device lacksVK_EXT_shader_stencil_export.A MinGW-w64 GCC 13
-fsyntax-onlycompile ofShaderResources.cpphas no errors.tools/check_conventions.py --base upstream/mainpasses, andtools/pr_overlap.py --branchfinds no overlap.@simonbbby validated it independently at this head on
mainf40b6930f, Release, GCC 13.3:agc_driver_bc_block_copyandagc_driver_graphicspass 3/3 on an RTX 3090 (NVIDIA 595.99.02) and on RDNA2 gfx1036 (RADV, Mesa 25.2.8). With onlyShaderResources.cpprestored tomain, the block-copy test fails 3/3 on NVIDIA at the same sample.Not checked on Windows, on a console or with a title.
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 simonbbby on 2026-10-14T04:27:38Z.
Independent Linux validation at exact head
cf9dd4f181c8274858167f253f4f2a14a8a8038f, standalone on parentf40b6930ff156834b786730771518b3bd7fe8648, no extra source changes.agc_driver_bc_block_copyagc_driver_graphics1002:13c0), RADV Mesa 25.2.8Release, GCC 13.3, bundled dependencies, SPIRV-Tools ON. Pinned each ICD, explicitly selected its GPU, required Vulkan execution, and disabled the application shader cache. Serial CTest, unchanged 30-second limit. The BC fixture completes both BC7 and BC1 on both GPUs. Matrix totals: NVIDIA 10.14 s, RADV 9.50 s; these are test totals, not performance comparisons.
Matched negative control: restored only
ShaderResources.cppfrom this head's exact parent, retaining the same test and build. NVIDIA fails 3/3, at the original third BC7 sample withread 1064168942, expected 1058905502. Restored the PR source byte-for-byte, rebuilt, and the BC fixture passes another 3/3 on NVIDIA. The checkout is clean at the tested PR head.This also agrees with our diagnostic on the earlier reported main
cd90ca50b: NVIDIA's failing third sample never enteredRefreshDepthCopy, whereas RADV refreshed the reused BC copy. The negative control here verifies the fix against its own current parent rather than relying on that older tree.Coverage limit:
agc_driver_graphicsreports its heap-mirror and imported-range heap-mirror subcases untested because the guest arena is unavailable/not write-watched; no BC-fixture skips were printed. No Windows, console, title run, or frame-time measurement here.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T04:29:02Z.
Thanks, @simonbbby. The negative control and the RADV run cover what I couldn't test here. I've added them to the description.
AI-assisted: yes