feat(agc): copy depth planes to and from color storage images directly where maintenance8 allows #11685
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11685"
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 oneandonlydean on 2026-10-27T02:41:59Z.
What
A depth plane and the color storage image that holds or receives its texels are copied with one
vkCmdCopyImagewhereVK_KHR_maintenance8allows it, in place of the image to buffer to image round trip through a staging buffer.With
VK_KHR_maintenance8, which the device already enables,vkCmdCopyImagecopies the depth aspect directly to and from a single-component color format of its size (D32 with R32, D16 with R16):copyPlaneandLayeredDepthStorage::Copyrecord one image copy and two barriers where the staging path records an image-to-buffer copy, a buffer-to-image copy and three barriers.TakeStoragerecords three barriers with one image copy when it keeps the discard (no stencil plane), against four on the staging path, and two against three when a stencil plane is present. The graphicsContextnow carries themaintenance8flag the device already had. Used bycopyPlane,TakeStorageandLayeredDepthStorage::CopyinDepthSurface.cpp.TakeStoragekeeps its discard of the new depth surface before the copy (#10681). 24-bit depth, the stencil plane, every format that is not a single component of the aspect's size and a device withoutmaintenance8keep the buffer path, as doesAPS5_NO_DIRECT_DEPTH_COPY=1(documented indocs/dev/ENVIRONMENT.md; it covers depth planes only). No performance claim is made and none was measured.Main had no depth to color image copy; its only image-to-image depth copy is
CopyAspectFrom(depth to depth of one format). No open PR touches these copies.Tested
VK_LAYER_KHRONOS_validation(loader log: "Insert instance layer VK_LAYER_KHRONOS_validation").VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V -R 'depth|stencil|array_layer|public_headers'on this change rebased onmaine0b13f2990: 112 tests selected, 111 passed, 0 failed, 1 skipped (agc_driver_stencil_ref_export, which needs a device without native stencil export); 0VUID-lines. WithAPS5_NO_DIRECT_DEPTH_COPY=1the same 112 give 111 passed and the same 1 skipped. On the previous base (mainb82c33ef65) the same selection ran 111 tests with 110 passed and the same 1 skipped, against 112 and 111 passed with this change.agc_driver_depth_plane_partial_store_buffer_copy, runs the partial-store test with the buffer path forced and asserts 0 direct copies; the default run asserts at least one direct copy whenever the device'sContexthasmaintenance8(16 on this device), independent of the format selector. With the selector forced to refuse every pair, the default and unimported runs fail and the buffer-copy run stays green.copyPlane1 to 72 across 7 tests,TakeStorage5,LayeredDepthStorage::Copy4.TakeStoragekeeps the #10681 discard by construction; the flake it fixed was not rerun); speed or GPU time (no claim);maintenance8devices other than the RTX 4090.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 (none added).mdfiles or images added to the repository