fix(agc): build a partially committed sampled 3D view from its committed slices #10064
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10064"
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 EagleBearerYS on 2026-10-23T07:47:14Z.
What
Ghost of Tsushima Director's Cut (PPSA02225) binds this sampled view about 9 minutes in, during its opening (milescoviello, Linux, RTX 4070 Ti, first comment):
rsample.Why it costs that much:
mainalready defines the texels past the committed range.ReadCommittedreads uncommitted pages as zeros. But it materializes the zeros at full size, and holds them three times on the way into the image:For this view that's about 9.3 GiB of host memory.
The change: a sampled k3D view whose range isn't wholly committed keeps its full extent, and only the slabs with committed memory go through the upload.
Uncompressedkeys and no DCC, no depth comparison, no sRGB expansion. Everything else takesmain's path unchanged.committedSlabssplits the surface into its guest slabs. That's one slice in the per-slice Z/R 64KB_X branch or a linear volume, andblockDepthslices in a thick one.main's path runs.ReadCommittedper run of adjacent slabs. Uncommitted pages inside an uploaded slab still read as zeros.vkCmdFillBuffer-zeroed device buffer withvkCmdCopyBufferToImage. That isn't a clear, so block-compressed formats take the same path.covers … MiB, rate-limited the same way, says how many slabs were uploaded and how many zero-filled.DescribeCommittedwalk per lookup of an eligible k3D view (above), before the cache lookup, so hits pay it too, wholly committed views included. There's none when the lookup already holds the view's committed ranges.main's.#9318: this sits in the snapshot and upload path, not in #9318's view bound, so the two compose, and #9318 needs no k3D case. If
BoundArrayWindowever trimmed k3D views, it would run first and change the texels (a shallower volume).Tested
Not tested: Ghost of Tsushima Director's Cut with this fix. milescoviello has it on
test/ghost-9742-9717-3d(bc32434751), the base they ran plus this commit (offer). That branch passes^agc_driver_partiallyon Linux (run). On Windows, its older base fails to build a test thatmainhas since fixed. This PR's own Windows build is the run below.New modes of
tests/execution/PartiallyResidentSnapshot.cpp(agc_driver_partially_<mode>, lavapipe):Memory. Every volume is 64 deep, and each committed slab has its own pattern. The bytes read count the snapshot's guest reads; the bytes kept count what the upload holds (staging, tiled, linear and zeros):
main/ this PR)main/ this PR)committed-volumecommitted-volume-thickmain/ 3,178,496committed-volume-linearmain/ 2,293,760committed-volume-comparecommitted-volumemain/ 655,360committed-volume-whole(control)committed-volumecommitted-array(control)Rebuilds (
committed-volume):Compares (
committed-volume-compare): newly committed zero pages compare equal and keep the view, and a CPU write rebuilds it.Texels (guest compute shaders sampling at slice centres, with z = 0, 5, 21, 22, 23, 30, 40 and 63, point-filtered):
mainand with this PR in every mode:APS5_NO_TEXTURE_CACHE=1.Red/green ×10 (the same test binary against each tree's
libSceAgcDriver):main,committed-volume,-thick,-linearand-comparefail 10/10 with "read N bytes of guest memory at its first use, expected M".83c9480ec0added the mipmapped and BC1 cases.Existing tests:
agc_driver_partially_resident_snapshot,…_pending_storesandagc_driver_large_tracked_snapshotstill pass.GitHub's runners (run 39907685337, on this head,
main0db47b263d;^agc_driver_partially|^agc_driver_large_tracked|^agc_driver_image_sample|^agc_driver_texture):main's implementation: on its one run,agc_driver_partially_committed_volume,…_thick,…_linearand…_comparefail and the other 23 of the 27 tests pass. Green with this PR: all 27 pass ×10, none skipped.APS5_SKIP_TIMING_TESTS=1.Validation layer (run 39913316066, Khronos 1.3.275 on Linux, this head;
agc_driver_guest_memory_lifetime_copy,agc_driver_large_tracked_snapshotand^agc_driver_partially): no new VUID.VUID-VkDeviceCreateInfo-pNext-pNext, at device creation. It comes from an sType (1000574000) newer than the layer, andmain's tree shows it too.main's tree doesn't have this PR's new tests, so its arm passes; the red is the run above.On a cloud Linux machine:
Windows: MinGW syntax checks of
Texture.cpp,ShaderResources.cppand the test show 0 errors.check_conventions.py: passes. No comment lines are added.AMD Radeon 860M on Linux (RADV, Mesa 26.2.5, Fedora 44), by @Lander0606 (comment):
cd60c6916fagainst its parent0db47b263d, thepartially,snapshotanddcc_keystests, three runs each with and without the Khronos layer. The base passes 8 of 8 and this PR 21 of 21 in every run. The seven-samplesmodes sample on the 860M with no skips, and the bytes read and kept match the table above. Under the layer neither side logs aVUID-line.Windows on real GPUs, by @BKlaasWerkman (comment):
cd60c6916fmerged intomain938812df14(clean), Windows 11 Pro, WinLibs GCC 15.2.0, Release,ANYPS5_NO_SHADER_CACHE=1, with the Khronos validation layer (1.4.363) loaded. The 1,278 teststools/select_tests.pypicks for the PR's files, compared test by test with a full run of thatmainon the same GPU:main(theagc_driver_sample_ordertrio, #9056). NoVUID-message is added or removed.main(#10126, #8604). NoVUID-message is added or removed.agc_driver_alias_copy_label, which is intermittent on that device (#10199), failed in themainrun and passed with this PR.agc_driver_partially_committed_*tests pass on both GPUs, none skipped, the seven-samplesmodes,_volume_compareand_volume_thickamong them.Windows on an AMD Radeon RX 9070 XT, by @BunnyFl (review):
1de16256afmerged ontomain, Windows 11, WinLibs GCC 15.2.0, Release, all 20agc_driver_partially_*tests.main'sTexture.cpp,ShaderResources.cppandTexture.hpp, 8 of them fail (_committed_volume,_thickand_linearamong them).agc_driver_partially_committed_volume_page_samplesfailed 3 runs of 3 in its own setup, with "cannot release part of a host allocation".d66d426203below answers it.d66d426203(review, approved), merged ontomain, withANYPS5_REQUIRE_VULKAN=1, the same 20 tests: 19 pass, the page case skips with its new message, 0 fail. Withmain'sTexture.hpp,ShaderResources.cppandTexture.cpprestored, 7 fail (_committed_volume,_thick,_linear,_compare,_mips,_bcand_empty).4a90a1a1d0, two merges ofmain(4be3da2c6f, then990f45e17d). TwoShaderResources.cppconflicts, each kept both sides:createTexturelambda that holdssampledCacheReclaimable. This PR's packed upload goes through it:createTexture(*context.detiler, resource, components, entry.bytes, depthCompare, packedSlabs(entry.slabs)).snapshotBytes(slabs, bytes), which isbyteswhenever the view has no slabs.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.After thuanquang's review:
3871b5eb66,0fbea36bcc,c36790ee5eand83c9480ec0(review):0fbea36bcc,fix(agc): a cached slab view is no longer returned after a page inside a kept slab is decommitted (the cache entry change above). The newagc_driver_partially_committed_volume_page_samplescommits slabs 21 and 22, samples, decommits one 4 KiB page of slab 22, and samples again. Red with the fix'sShaderResources.cpphunk reverted: "sample of level 0 slice 22 (thread 96) reads (23.000000, 712.000000, 1.000000, 1.000000), expected the zeros of its decommitted page". Green with it.3871b5eb66,test(agc): each element of the pattern encodes its position in the slab, and the-sampleschecks compare each texel with the same samples of a fully committed copy, which takes the full-size path. With the slab path's packed offset shifted by 0x100 in a local build, 5 of the 7-samplescases fail (the other 2 don't take the slab path), where the earlier pattern passed all 7. An error shared by both paths, such as one in the common detile offset, still passes: these tests compare the two paths, and there's no CPU tiling oracle.c36790ee5e,test(agc):agc_driver_partially_committed_volume_emptyand_empty_samplescover a volume with no committed slab. It takes the slab path with an empty slab list ("uploads the 0 of its 64 slabs"), reads 0 of its 4194304 guest bytes, and samples zeros.83c9480ec0,test(agc):agc_driver_partially_committed_volume_mipsand_volume_bcare registered with ctest. The BC1 case's own device now enables BC texture compression when it has it, and skips otherwise.^agc_driver_partially_tests on lavapipe, on a Linux machine with CI's flags.^agc_driver_partially_): Linux: withmain's implementation of these files,agc_driver_partially_committed_volume_page_samplesfails, and with this PR 20 run, 20 pass ×10, 0 skip, 0 fail. Windows: 20 run, 0 pass, 20 skip (no Vulkan device), 0 fail. The libc and libkernel suites pass on both, run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.6dd0c32a58,docs(debt): the debt entry now gives the view's guest range (4781 MiB, tiled and padded) where it said the image takes 4.7 GiB.52826ee075, a merge ofmain2fade7ef4e. One conflict, in the includes oftests/execution/PartiallyResidentSnapshot.cpp:main(#9159) added<algorithm>and<span>there, which this PR also adds, so the merge keeps one of each and this PR no longer adds them. The PR's other added and removed lines are unchanged. On GitHub's runners (run),^agc_driver_partially_andagc_driver_large_tracked_snapshot:main's implementation of the changed files, 7 of the 21 fail, each on the guest bytes a partly committed volume reads at first use (for example, "the partially committed volume read 4194304 bytes of guest memory at its first use, expected 1507328 of its 4194304").APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.7cecc95f5e, a merge ofmain0a148be963(run). #12862 movedlibSceAgcDriver's test registrations intotests/cmake/; the conflict inCMakeLists.txtis resolved withtools/agc_test_split.py resolve, which moves this PR's registrations intotests/cmake/agc_driver_partially_resident_snapshot_tests.cmake(+8 lines). Nothing else conflicted, and apart from the move this PR's diff is unchanged. With-DBUILD_TESTING=ON,ctest -Ngives 3123 tests:main's 3105 plus its 18 tests, each listed once. The tests of this PR's verify set pass 10 runs in a row. Linux: 22 run, 22 pass, 0 skip, 0 fail. Windows: 22 run, 0 pass, 22 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (199 and 308) and on Windows (226 and 330). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Overlap (
tools/pr_overlap.py --branchagainstmain5255264b15; this branch merges cleanly withmain):Texture's constructor that this PR changes: each layer's guest offset now comes fromGuestOffset(layer, mip), which stores a PS4 surface with several layers and mip levels level by level (levelMajor). The mergee15613356dkeeps both: a full snapshot detiles fromGuestOffset, asmaindoes, and a packed slab from its offset in the snapshot. A level-major surface has no per-layer slabs, so a partially committed snapshot of one is refused, asmainrefuses its other unsupported level-major paths. #9842 is stacked on #9431, and its overlap with this PR is #9431's lines.CMakeLists.txt). #9253 has merged.Texture's constructor, and #9884 alsoTexture.hppandcachedTextureinShaderResources.cpp. Both have merged first, as agreed for #10845 (comment), and the mergescceb0e89fcand99be522b4cadapt this PR to them: a dropped packed-slab snapshot is read slab by slab into #9884's staging buffer (see99be522b4cbelow).Texture.cpplines and is much larger. Its author agreed that this one goes first (comment). Since then, #7085 no longer waits for this PR (comment) and has dropped it from its Depends on.git merge-treeof #7085's46b62eee09onto99be522b4cconflicts in twoTexture.cpphunks. After the snapshot size check, #7085's note for mip levels past the image's chain and this PR's two packed-slab checks are adjacent additions. In the upload's transfer barrier and copy regions, this PR'slayerRegionslambda takes #7085'sgeometry.imageLevelsin the barrier and in its level loop. If #7085 lands first, this PR takes that conflict in its next merge ofmain.maxImageArrayLayersas rows of a 2D image) adds alayerRowsparameter to the sameTextureconstructor andcachedTexturecalls, and its row copies to the same upload. It goes first, merge order only (B-Howell proposed the places in this comment; we offered #12246 first in reply), and this PR takes the merge.git merge-treeof the two heads, each merged ontomain2199ee0d47, conflicts inTexture.hpp,ShaderResources.cppandTexture.cpp, each time one PR's addition next to the other's. The merge keeps both parameters, the packed slabs stay gated on 3D views, and the row mode is only for sampled 1D arrays.849b8418e2, a merge ofmaine05ba6feeb(run).main's #7618 adds its swept write-only staging entry at the end of the debt file, where this PR adds its partially committed 3D textures entry; the merge keeps both, and nothing else conflicted. The tests whose names containpartiallyorsnapshot, and theagc_driver_sample_ordertests, pass 10 runs in a row. Linux: 31 run, 29 pass, 2 skip (agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations), 0 fail; the before arm fails seven of theagc_driver_partially_committed_tests. Windows: 34 run, 4 pass, 30 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (144 and 207) and on Windows (171 and 223). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.131bc657ca, a merge ofmain0cd07dc4ab(run).main'sagc_driver_copy_surface_bytesproperties and its no-alias test sit next to this PR's committed-volume test loop inlibSceAgcDriver/CMakeLists.txt; the merge keeps both, and nothing else conflicted. This PR's changed lines are the same. The partially resident and committed-volume tests withagc_driver_large_tracked_snapshot,agc_driver_alias_copy_label,agc_driver_copy_surface_bytesandagc_driver_sample_order, 24 tests: on Linux, withmain's implementation of the changed files, 7 fail (agc_driver_partially_committed_volumeand its_bc,_compare,_empty,_linear,_mipsand_thickvariants); with this PR all 24 pass 10 runs in a row, 0 skip. Windows: 24 run, 0 pass, 24 skip (no Vulkan device), 0 fail, on both trees. Suites: libc and libkernel pass on Linux (166 and 264) and on Windows (194 and 286). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.2ffbae8eb6, a merge ofmain3a2b919816(run). JJenkx's #8930 adds itsWriteChangedentry at the end ofdocs/dev/debt/libSceAgcDriver.md, where this PR adds its partially committed 3D textures entry. The merge keeps both,main's first, and nothing else conflicted. This PR's changed lines are the same. The tests are the partially resident and committed-volume ones withagc_driver_large_tracked_snapshot,agc_driver_alias_copy_label,agc_driver_copy_surface_bytesandagc_driver_sample_order, 24 in all:APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.e15613356d, a merge ofmainf7e84c4cf1after #9431 merged (×10 run,^agcsweep). The one conflict was the detile loop inTexture's constructor (see Overlap). The resolution keeps this PR's loop over the uploaded slabs, detiles a full snapshot fromgeometry.GuestOffset(slot.layer, mip)asmaindoes and a packed slab from its offset in the snapshot, and adds aRequirethat refuses a partially committed snapshot of a level-major surface. This PR's other changed lines are the same.^agc_driver_partially_,agc_driver_copy_surface_bytes_no_aliasandagc_driver_large_tracked_snapshot, 22 tests: on Linux all 22 pass 10 runs in a row (22 run, 22 pass, 0 skip, 0 fail), and the before arm withmain's implementation of the changed files fails; on Windows all 22 skip, with no Vulkan device: 22 run, 0 pass, 22 skip, 0 fail.^agctest, once: Linux 1,138 run, 1,065 pass, 73 skip, 0 fail; Windows 1,167 run, 337 pass, 830 skip, 0 fail.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.9e2c796766, a merge ofmain6d56eb813c(run), which brings thuanquang's #11740.ShaderResources.cpp, where #11740 addsPendingLookupand its lookup function at the place this PR addscommittedSlabs. The merge keeps both functions, one after the other.^agc_driver_partially_,agc_driver_copy_surface_bytes_no_aliasandagc_driver_large_tracked_snapshot, 22 tests.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.299171ba86, a merge ofmainc0fb4a6aad, which brings mrfelek's #13373 (run).docs/dev/debt/libSceAgcDriver.mdonly, where #13373's "Adaptive staging" bullet sits where this PR adds "Partially committed 3D textures". The merge keeps both,main's first, as this PR's earlier merges did. This PR's own diff is unchanged.agc_driver_partially_resident_snapshot,agc_driver_partially_resident_pending_stores,agc_driver_large_tracked_snapshotand every^agc_driver_partially_committed_test.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.ctest -R '^(agc|shader)'1,099 passed, 0 failed, 75 skipped.099305bfc1, a merge ofmainf5b82ff453, which brings JJenkx's #13648 (sampled textures with fast-cleared DCC keys are cleared on the GPU) (run, validation run).Texture.hpp,Texture.cppandShaderResources.cpp, where both PRs change theTextureconstructor, its snapshot check andcachedTexture. Three hand edits beyond keeping both sides:Texture.hpp:62andTexture.cpp:341: #13648'sclearis the seventh parameter and this PR'spackedSlabsthe eighth, somain's twoclearcallers are unchanged. This PR's two callers,ShaderResources.cpp:1024and:1144, passnullptrforclear.Texture.cpp:368: a new check, "a cleared texture takes no snapshot, so it has no committed slabs".layerBytesslab per packed index, and any other takes the whole surface.ShaderResources.cpp:1095-1099:main's cache entry for a cleared texture, sized with this PR'ssnapshotSizeinstead ofbytes.SampledClearColorclears only with fast-cleared keys. Both read the same keys.agc_driver_sampled_clear_keys:mainf5b82ff453against this head, the same tests, on GitHub's Linux runner (layer 1.3.275):mainand 22 with this head, and neither log haswas not found;VUID-VkDeviceCreateInfo-pNext-pNext, so the merge adds none.agc_driver_sampled_clear_keys10 of 10.ctest -R '^agc': 1,168 passed, 0 failed, 75 skipped.cceb0e89fc, a merge ofmain88e804b0a7.mainnow has fma-rc's #10773, which reuses one tiled and one linear upload scratch per recorded batch. The merge keeps both in this PR's committed-slices upload inTexture.cpp.UploadScratchBuffer); without one, they're newDeviceBuffers, as before.VK_PIPELINE_STAGE_HOST_BIT | Recorder::UploadScratchReuseStages.mainis otherwise unchanged.agc_driver_large_tracked_snapshot,agc_driver_sampled_clear_keysandagc_recorder_upload_scratch. Linux: 23 run, 23 pass, 0 skip, 0 fail. Windows: 23 run, 0 pass, 23 skip (no Vulkan device), 0 fail, so Windows only shows that it builds. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agctest, once (run): Linux: 1,236 run, 1,158 pass, 77 skip, 1 fail. Windows: 1,272 run, 379 pass, 893 skip (no Vulkan device), 0 fail. The one failure isagc_driver_pipeline_journal's 120-second timeout, whichmain88e804b0a7's own run of every test hits too (run).1de16256af, a merge ofmain4f64f81ef7, which brings B-Howell's #12246 (1D array layer rows), the PR this one's Depends on line put first. Both PRs changeTexture's constructor and its upload, and the merge keeps both.(…, depthCompare, layerRows, clear, packedSlabs): #12246'slayerRowsstays where it added it, afterdepthCompare, and this PR'spackedSlabsstays last, afterclear.main's two call sites passlayerRows, and this PR's passlayerRows, nullptr, packedSlabs(…).toTransferDsttakes #12246's range (one layer for rows, the full range otherwise), and the barrier stays this PR's.k1DArray, and packed slabs come only fromcommittedSlabs, which returns none unless the view isk3D. The zero fill and its barrier exist only with packed slabs, so they never meet the one-layer range.mainis otherwise unchanged.agc_recorder_upload_scratch. Linux: 48 run, 46 pass, 2 skip (agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations), 0 fail. Windows: 48 run, 2 pass, 46 skip (no Vulkan device), 0 fail, so Windows mostly shows that it builds. Suites: libc and libkernel pass on Linux (217 and 318) and on Windows (244 and 339). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agctest, once (run): Linux: 1,258 run, 1,179 pass, 78 skip, 1 fail. Windows: 1,294 run, 388 pass, 906 skip (no Vulkan device), 0 fail. The one failure isagc_driver_pipeline_journal's 120-second timeout, whichmain88e804b0a7's own run of every test hits too (run). #12246'sagc_driver_image_array_rows_past_layer_limitand the six 1D-array image tests pass on Linux.d66d426203,test(agc), after BunnyFl's review. The page case decommits one 4 KiB page inside a committed slab. On Windows, a host allocation is 64 KiB granular, andWindowsMappings::resetrefuses to release part of one.agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations), 0 fail. The page case passes all 10.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.1d41692ec6, a merge ofmain06a9092274, which brings SuarezPM's #14943 (draw names in device-lost fault reports).Texture.cpp, in the constructor's snapshot checks, where #14943 notes each texture in itsLiveResourceRingand this PR checks the snapshot's size against its committed slabs. The merge keeps #14943'sNoteline, then this PR'sslabBytesline and its two snapshot checks, whose size check already coversmain's (Texture.cpp:410-413on that merge). This PR's diff overmainis otherwise unchanged.agc_driver_large_tracked_snapshot,agc_driver_sampled_clear_keysandagc_recorder_upload_scratch. The merge's first ×10 (run) and validation run (run) left out the 18agc_driver_partially_committed_*cases, so these runs replace them.agc_driver_image_sample_lod_clamp,agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations), 0 fail. The 18 committed cases pass all 10, the page case included.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main06a9092274against this head, the same tests, on GitHub's Linux runner:mainand 50 with this head;VUID-VkDeviceCreateInfo-pNext-pNext, so the merge adds none.407189c96e, a merge ofmain1ff0fe98aa, which brings hugodearaujo's #13646 (the unmapped levels below a T# minimum LOD get no device memory).Texture.cpp. #13646 starts each layer's detile, repack and copy loops atskip, its count of unmapped levels below the T# minimum LOD, and this PR loops over its uploaded slices instead of every layer. The merge keeps this PR's loops and starts them atskip:Texture.cpp:377-454) stay above the constructor (:493), which keeps this PR'spackedSlabsparameter.uploadedstart atskip(Texture.cpp:713and:722).layerRegionsstarts atskip(Texture.cpp:758-759), both for the uploaded slices (:785) and for the zero slices (:790).skip(Texture.cpp:572-573) is nonzero only for a 2D or 2D-array view at base level 0 that isn't thick (:378). Zero slices come only from packed slabs, whichcommittedSlabsbuilds only for ak3Dview (ShaderResources.cpp:821), soskipis 0 wherever there are zero slices. Without packed slabs,uploadedholds every layer atmain's offsets (Texture.cpp:544-547), so #13646's textures take the same levels and layers as onmain.mainis otherwise unchanged. It merges cleanly withmain4c03784113.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main1ff0fe98aaagainst this head, the same tests, on GitHub's Linux runner:mainand 50 with this head, and neither log haswas not found;VUID-VkDeviceCreateInfo-pNext-pNext, so the merge adds none.agctest, once (run): Linux: 1,371 run, 1,283 pass, 87 skip, 1 fail. Windows: 1,411 run, 421 pass, 990 skip, 0 fail. The one failure isagc_driver_pipeline_journal's 120-second timeout, whichmain1ff0fe98aa's own run of every test hits too (run; Linux: 1,353 run, 1,265 pass, 87 skip, 1 fail; Windows: 1,393 run, 421 pass, 972 skip, 0 fail).skip. #13646'sagc_driver_texture_sparse_levelsskips on both arms there. It needs BC texture compression,VK_EXT_image_view_min_lodand sparse residency for 2D BC1 images, which the Linux runner's lavapipe doesn't all offer, and the Windows runner has no Vulkan device. Amoenus has since run it, with99be522b4cmerged intomain, on two GPUs that have them (below).aea05465be, a merge ofmain090f57166a(×10).Texture.cpp's constructor, against akkadbakkad89's #16294, which samples guest 8_24_UNORM depth as D24_UNORM_S8_UINT and addsdepthToFloatandbarrierAspect. The repack loop keeps this PR's per-slot offsets and takes #16294'sdepthToFloatargument, and the transfer barrier takes #16294'sbarrierAspectrange with this PR's barrier list. This PR's own lines are unchanged, and #15438's barrier range inStorageTexture::uploadmerged without a conflict.^agc_driver_image_depth24. Linux: 53 run, 49 pass, 3 skip (the same three), 1 fail; the 18 committed cases pass all 10, andagc_driver_image_depth24_floatpasses 10 of 10. The one failure,agc_driver_image_depth24("image_load of 8_24_UNORM reads the wrong depth for format 141: 0x3effe004 for texel 0x007ff001") also fails onmain090f57166a's own tree (run), and adriadam10's #16807 has since fixed it onmain. Windows: 53 run, 2 pass, 51 skip, 0 fail. The libc and libkernel suites run 327 and 344 tests on Linux and 358 and 371 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.99be522b4c, a merge ofmainb1f8766e5f, which brings thuanquang's #9884 (a dropped sampled snapshot is read straight into its upload staging buffer) (×10, validation run,^agcsweep).Texture.hpp,Texture.cppandShaderResources.cpp. #9884 adds aTextureconstructor that takes the staging buffer, and itscachedTexturedrops a large snapshot and reads it into that buffer. The merge keeps #9884's flow and changes these of its lines:Texture.hppandTexture.cpp: #9884's staging constructor, and the private delegate that both public constructors forward to, take this PR'spackedSlabslast. A partially committed snapshot that is dropped is then read slab by slab into the staging buffer.Texture.cpp: the snapshot size check, and the upload's tiled buffer (UploadScratchBuffer),Keep,DeviceBufferand copy, use the staging buffer's size when there is one (snapshotSize), since the snapshot span is then empty. The snapshot is copied into a new staging buffer only when there is none and a slice uploads (staging == nullptr && !uploaded.empty()).ShaderResources.cpp:cachedTexturesizes #9884's drop test, staging buffer, spare snapshot and snapshot vector by this PR's packed snapshot size (snapshotBytes(slabs, bytes)) instead ofbytes, reads through this PR'sreadSnapshot, and passespackedSlabson bothcreateTexturecalls.agc_driver_partially_committed_volume: 23 slabs of 64 KiB, 1,507,328 bytes, over the 256 KiB drop threshold. The cases that take the path areagc_driver_partially_committed_volumeand its_thick,_linear,_mips,_bc,_samples,_bc_samples,_thick_samples,_linear_samplesand_mips_samplesvariants. 8 textures, of 196,608 bytes or less, kept their snapshot, in the_compare,_page_samples,_emptyand_empty_samplesvariants.mainis otherwise unchanged. It merges cleanly withmain389c568e31.agc_snapshot_read_into_staging(#9884's test),agc_sampled_cache_device_selectionand the four^agc_driver_recover_tests, 59 in all.main's tree too), 0 fail.agc_snapshot_read_into_stagingand the 18 committed cases pass all 10.guest_kernel_resident_fmem_exportand its_patchedvariant, fail onmain's tree too (validation run). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.mainb1f8766e5fagainst this head, the same tests, on GitHub's Linux runner:mainand 57 with this head, and neither log haswas not found;VUID-VkDeviceCreateInfo-pNext-pNext, so the merge adds none.agctest, once: Linux: 1,551 run, 1,458 pass, 93 skip, 0 fail. Windows: 1,594 run, 474 pass, 1,120 skip, 0 fail.agc_driver_texture_sparse_levelson two GPUs with sparse residency, by @Amoenus (comment, report and logs):99be522b4cmerged intomainf01683380f, and thatmainon its own, three runs of each on each GPU. Windows 11 Enterprise (26200), GCC 15.2 UCRT, Release, with the Khronos validation layer (1.4.363) loaded.1002:13c0(32.0.21045.16010): 12 of 12 runs pass, 0 skip: 3 withmainand 3 with this PR on each GPU. None of the logs has aVUID-orSYNC-HAZARDline.skip(see407189c96eabove).agc_driver_partially_*tests weren't part of this run.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)1002:13c0, Windows 11, with the validation layer,agc_driver_texture_sparse_levelsonly (Amoenus)Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-24T08:10:33Z.
Review: COMMENTED
A read-through at
4a90a1a1d0; I built and ran nothing. The slab mapping and the packed detile offsets look consistent with main's geometry, and the head merges cleanly into currentmain. A few things a reviewer will likely ask about:Tests
PatternElement(PartiallyResidentSnapshot.cpp:499-504) depends only on the format and the slab, andCommitSlab(:516-521) repeats that one element across the whole slab. So the-sampleschecks can tell which slab a texel came from, or zero, but not where inside the slab it was read. The main new risk is the per-slab packed detile offset (slot.tiledOffset + mip.tiledOffset), and a misplaced offset inside a slab would still pass. An element value that encodes its position (for example x, y and z within the slab) would cover it.uploadedis empty (Texture.cpp:420-425,:443-447; no staging, tiled or linear buffers, zero snapshot bytes on the cache side) never runs.CommittedCaseForaccepts--committed-volume-mipsand--committed-volume-bc(:474-475), butCMakeLists.txt:2546registers only their-samplesvariants. So the mip and BC byte accounting is never run by ctest, and the body's "all 15 modes" doesn't match the 13 registered tests. The-samplesmodes also pass onmain; only the memory modes are red there.Behaviour
committedSlabs,ShaderResources.cpp:713-723), not by the view's allocation. If the range past the allocation is committed by neighbouring allocations, every slab has a committed page,:723returnsnulloptand the view takes main's full-size path unchanged. Has PPSA02225 been run with this head? The body's logs come from a stack with other open PRs, and the local cut that pointed at this view kept slices by allocation.SnapshotCompareBytes(256 KiB,:1067), it is kept for comparison where main's full-size snapshot was parked. A later lookup with the same slab set then goes throughequalsCommittedSlabs, which compares committed pages only. So if part of a slab is decommitted while the slab keeps other pages, is the cached texture returned with the old texels instead of rebuilt with zeros?Body
committedSlabsruns wheneverslabbedholds (:924), including wholly committed k3D views with write generation 0, and before the cache lookup, so hits pay it too.Depends on:lists #9253 (merged today) and #9884 (closed without merging); the Overlap section still describes composing with #9884.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T23:06:15Z.
Review: CHANGES_REQUESTED
The sampling change holds up on Windows, but one of the new cases can't run there.
Windows 11, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT, with this head merged onto current
main, all 20agc_driver_partially_*tests:main'sTexture.cpp,ShaderResources.cppandTexture.hpp, 8 of them fail (..._committed_volume,..._thick,..._linearamong them), so the new cases catch the bug.agc_driver_partially_committed_volume_page_samplesfails 3 runs out of 3, in the test's own setup, not in a sample check. After the level 0 sample (hash414e3bcd55dc4325every run) it stops withcannot release part of a host allocation.That message comes from
WindowsMappings::reset(core/libs/prx/libc/include/WindowsMappings.hpp:1194), which refuses to reset a resident run unless the range starts at the host allocation's base. On Windows the test'sDecommit(tests/execution/PartiallyResidentSnapshot.cpp:249-251) callsGuestArenaReseton one page inside a committed slab (surface.Decommit(2 * BlockBytes, BlockBytes),:332), which is exactly a part of an allocation. On Linux the same step is anmmap(MAP_FIXED). Your Tested section lists lavapipe only, and I haven't seen a Windows run of this case.Could the page case commit that page as its own allocation on Windows, or skip with code 77 there (with the gap in the debt entry)? Either would keep the Linux coverage. I haven't checked whether the arena could support a mid-allocation reset instead.
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T01:39:42Z.
Review: APPROVED
Re-review of
d66d426203: my change request is addressed with the second option.agc_driver_partially_committed_volume_page_samplesnow returns 77 on Windows before opening a device (core/libs/prx/libSceAgcDriver/tests/execution/PartiallyResidentSnapshot.cpp:987), anddocs/dev/debt/libSceAgcDriver.md:354records that the case runs on Linux only.Windows 11, AMD RX 9070 XT,
ANYPS5_REQUIRE_VULKAN=1, merged onto currentmain, the same 20agc_driver_partially_*tests as my first run:Texture.hpp,ShaderResources.cppandTexture.cpprestored: 7 fail (partially_committed_volume,_thick,_linear,_compare,_mips,_bc,_empty).