perf(agc): read depth planes into storage images in a compute pass #12120

Merged
meh7an merged 3 commits from upstream-pr/12120 into main 2026-11-03 16:43:41 +00:00
meh7an commented 2026-10-27 21:56:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by meh7an on 2026-10-27T21:56:04Z.


What

A depth surface's plane and the 32-bit color storage image that holds its texels are copied into each other whenever a shader reads or writes the plane as a storage image. On main (#11685) that is one vkCmdCopyImage between the depth aspect and the color image where VK_KHR_maintenance8 allows it, else a copy through a staging buffer. On an RTX 2080 Ti the copy costs about 1.4 ms per 4K plane. Sonic Origins Plus does two per frame on its main menu, 2.88 ms of GPU time per frame.

Where the device has VK_KHR_push_descriptor, this PR reads a D32 plane into the storage image in a compute pass instead (DepthToStorage.comp):

  • The pass fetches the depth aspect through a sampled view (OpImageFetch, no sampler) and stores the bits unchanged through an r32ui view of the storage image (StorageTexture::AtomicView).
  • It takes copyPlane's rectangles as push constants, one dispatch each, so partial unit stores (StoreDepthPlane) use it too.
  • Its two views are pushed (vkCmdPushDescriptorSetKHR), so a recorded pass holds no descriptor set. The pipeline and its layouts are made once per device on first use and released in ClearDepthSurfaces. Each surface keeps its depth-aspect view until it is released.

VulkanDevice enables VK_KHR_push_descriptor when the device has it, and the graphics Context carries it as pushDescriptors. The new agc_embedded_shader CMake function compiles a Graphics/shaders source into an embedded SPIR-V header.

Copies back into the depth plane keep main's copy. A fragment shader's depth write can't stand in for it: on the 2080 Ti it flushed subnormals to ±0 and turned every NaN into -inf, and without VK_EXT_depth_range_unrestricted it clamped to [0, 1]. Finite values outside [0, 1] survived with the extension only because the driver didn't clamp them: with a [0, 1] viewport the spec leaves them undefined, and a ±FLT_MAX viewport, which would make them defined, broke the store-back test on this driver. The round-trip results are under Tested.

These keep main's copies too: D16 planes, the stencil plane, multisampled surfaces, TakeStorage and the layered copies (LayeredDepthStorage::Copy). So does every plane when APS5_NO_DEPTH_TRANSFER_PASS=1 is set; the variable has its row in ENVIRONMENT.md. The copies still take #11685's direct path where it applies, and APS5_NO_DIRECT_DEPTH_COPY=1 still forces the staging buffer.

What the pass keeps, by device configuration:

  • With or without VK_EXT_depth_range_unrestricted: the pass gives back exactly what main's copy gives back, word for word. It reads the 32-bit texel without a sampler and stores its bits, and the spec defines no conversion for that read.
  • Tested on the 2080 Ti, in both configurations: all 16 test words come back unchanged through the pass and through the copy. Those are 0.25, 1, ±0, -0.5, 2.0, three subnormals, FLT_MAX, ±inf, and quiet and signalling NaNs with payloads.
  • Not claimed for other GPUs: NaN payloads and subnormals. The spec says nothing about flushing them on an image read; on a GPU that changes them, the round-trip test fails rather than passing silently.

Tests:

  • agc_driver_depth_storage stores the 16 words into a D32 plane and a D32S8 plane, then reads them back twice, copies only and with the pass. It requires word-for-word equal results and that the pass ran. It requires 0.25, 1 and +0 back in every configuration, and -0.5 and 2.0 back where the depth range is unrestricted. It reports which of the other words the copy changed: none on this GPU. Its device enables VK_KHR_push_descriptor when the queue can draw, and VK_EXT_depth_range_unrestricted unless --restricted-depth is given. The existing whole-plane data and stencil checks run through the pass as well.
  • New agc_driver_depth_storage_copies runs it with APS5_NO_DEPTH_TRANSFER_PASS=1 and requires zero passes, with the data and stencil checks unchanged. New agc_driver_depth_storage_restricted_depth runs it without the extension.
  • agc_driver_depth_plane_partial_store (partial stores) runs in three modes. The default requires the pass where the device has VK_KHR_push_descriptor. The new agc_driver_depth_plane_partial_store_image_copy (--image-copy) turns the pass off and requires direct copies where VK_KHR_maintenance8 is enabled. --buffer-copy turns both off.
  • DepthSurface gains SetDepthTransferPasses and DepthTransferPassCount for these tests, like #11685's SetDirectDepthCopy and DirectDepthCopyCount.

No open PR reads depth planes in a compute pass or enables VK_KHR_push_descriptor. tools/pr_overlap.py finds no other open PR that changes the same code. It could not compare 92 PRs that conflict with main and share a file with this one, and none of their diffs adds push descriptors or changes copyPlane or DirectDepthCopy.

Tested

Rebased onto main 2227f13661 (57d63ac306). The round trips and S3K numbers below were measured on main c02d287bd0, with this change as 05addcdbd1. The 120 commits between them change eight lines of the files this PR touches, in CMakeLists.txt and VulkanDevice.cpp, and nothing in the transfer path. On the rebased head the validation run below gives 18/18 again, with no VUID- line and no missing-layer line, and ctest passes 2815 of 2815.

Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 2080 Ti, driver 617.14, i9-9900K.

Round trips. These ran with a temporary build that could also turn on the fragment depth write, which the review asked about. They store the 16 words into a D32 plane and a D32S8 plane through the store-back, then read them back through a storage view. Both formats gave the same results.

Path VK_EXT_depth_range_unrestricted enabled not enabled (--restricted-depth)
main's copies, direct and through the staging buffer all 16 words kept all 16 words kept
compute pass, depth to storage (this PR) all 16 words kept all 16 words kept
fragment depth write, storage to depth, [0, 1] viewport (dropped) ±0, -0.5, 2.0, FLT_MAX and ±inf kept; subnormals flushed to ±0; every NaN came back as -inf ±0 kept; clamped to [0, 1]; subnormals flushed; NaN came back as 0
fragment depth write with a ±FLT_MAX viewport (dropped) the existing store-back test failed not valid without the extension

S3K. Sonic Origins Plus (PPSA05324) on the Sonic 3 & Knuckles page of the main menu, main's defaults. main c02d287bd0 against main with this PR (05addcdbd1), both built from the same tree; nothing else is applied. Each build got a warm-up boot and one APS5_PROFILE_GPU=1 boot. Then came two interleaved traced rounds (main, PR, main, PR; APS5_TRACE_SECONDS=200:15, six title FPS readings each).

main this PR
[gputime] copy class per present (2 transfers, 63.3 MiB) 2.76 ms 1.68 ms
[gputime] GPU time per present, all ranges, the same six blocks on the page 52.95 ms 51.90 ms
GPU busy per present (ms, round 1 / round 2) 53.6 / 62.1 52.6 / 60.7
frame p50 / p90 / p99 (ms), round 1 58.3 / 65.6 / 82.2 59.2 / 64.0 / 82.2
frame p50 / p90 / p99 (ms), round 2 63.9 / 72.2 / 88.0 64.5 / 74.1 / 94.4
title FPS, median of six readings (round 1 / round 2) 17.15 / 17.10 17.74 / 16.02
  • Of the two transfers per frame, one goes from the depth plane to its storage image and now runs in the pass. The other goes back and keeps main's copy, about 1.5 ms of the remaining 1.68 ms.
  • The frame times and title FPS move within the noise of these runs: other load averaged 5.1% CPU, with a 57.8% CPU peak and an 18.2% GPU peak.
  • All four traces show Driver.Draw.shader_compile_and_link inside the window, main's included, so the rounds compare like with like.
  • All four traces dropped events once the queue worker's event buffer filled. The phase totals still cover the whole window, and the frame and GPU times in the summary lines don't come from those events.

Tests.

  • ctest on main c02d287bd0 plus this PR: 2776 of 2777 pass. The failure, agc_driver_mesh_barycentric_emulation, was main's own and passes on the rebased head.
  • ctest --test-dir build -R "depth_plane_partial_store|depth_storage|depth_plane_sampling|depth_copy|native_depth" -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: 15/15 on main and 18/18 on this PR. The three extra tests are agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_storage_copies and agc_driver_depth_storage_restricted_depth. Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has a VUID- line. On this PR, the three depth_storage runs report that the pass matches the copy and that the copy changed none of the 16 words. The copies run reports zero passes.

All four traces are attached, one zip per round with the main and PR traces.

depth-to-storage-s3k-c02d-round1.zip
depth-to-storage-s3k-c02d-round2.zip

Sonic 3 & Knuckles page, round 1, main

seconds 200:15 from present 4373: 250 presents, frame p50 58.3 / p90 65.6 / p99 82.2 / max 82.7 ms, GPU busy 53.6 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit c02d287bd0, dropped: yes

{"commit":"c02d287bd0eb","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":4373,"ms":15052.654},"presents":250,"frame_ms":{"p50":58.279,"p90":65.626,"p99":82.192,"max":82.663},"gpu_busy_ms_per_present":53.633,"worker_busy_pct":{"queue worker 0x0":97.349},"top_phases_ms_per_frame":{"Driver.Packet":57.742,"Graphics.Draw":46.63,"Driver.Packet.draw":44.825,"Driver.Draw":44.135,"Graphics.Draw.draw_and_resource_release":38.531,"Driver.Draw.shader_compile_and_link":27.402,"VideoOut.Flip":22.641,"Driver.Present":22.551},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.78,"events_lost":412503,"totals_full":false},"draw committer":{"events_full_after_s":12.591,"events_lost":50581,"totals_full":false}},"trace":"aps5-trace-c02d287bd0eb-25464.json.gz"}

Sonic 3 & Knuckles page, round 1, this PR

seconds 200:15 from present 4517: 248 presents, frame p50 59.2 / p90 64.0 / p99 82.2 / max 86.7 ms, GPU busy 52.6 ms per present
NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 05addcdbd111, dropped: yes

{"commit":"05addcdbd111","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":4517,"ms":15035.38},"presents":248,"frame_ms":{"p50":59.151,"p90":64.026,"p99":82.243,"max":86.691},"gpu_busy_ms_per_present":52.563,"worker_busy_pct":{"queue worker 0x0":97.386},"top_phases_ms_per_frame":{"Driver.Packet":58.162,"Graphics.Draw":46.448,"Driver.Packet.draw":45.247,"Driver.Draw":44.514,"Graphics.Draw.draw_and_resource_release":38.293,"Driver.Draw.shader_compile_and_link":27.879,"VideoOut.Flip":21.614,"Driver.Present":21.506},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.69,"events_lost":434140,"totals_full":false},"draw committer":{"events_full_after_s":12.691,"events_lost":49445,"totals_full":false}},"trace":"aps5-trace-05addcdbd111-12292.json.gz"}

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11 Pro 10.0.26300
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5041717309 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12120). Originally posted by [meh7an](https://github.com/meh7an) on 2026-10-27T21:56:04Z. --- ### What A depth surface's plane and the 32-bit color storage image that holds its texels are copied into each other whenever a shader reads or writes the plane as a storage image. On `main` (#11685) that is one `vkCmdCopyImage` between the depth aspect and the color image where `VK_KHR_maintenance8` allows it, else a copy through a staging buffer. On an RTX 2080 Ti the copy costs about 1.4 ms per 4K plane. Sonic Origins Plus does two per frame on its main menu, 2.88 ms of GPU time per frame. Where the device has `VK_KHR_push_descriptor`, this PR reads a D32 plane into the storage image in a compute pass instead (`DepthToStorage.comp`): - The pass fetches the depth aspect through a sampled view (`OpImageFetch`, no sampler) and stores the bits unchanged through an `r32ui` view of the storage image (`StorageTexture::AtomicView`). - It takes `copyPlane`'s rectangles as push constants, one dispatch each, so partial unit stores (`StoreDepthPlane`) use it too. - Its two views are pushed (`vkCmdPushDescriptorSetKHR`), so a recorded pass holds no descriptor set. The pipeline and its layouts are made once per device on first use and released in `ClearDepthSurfaces`. Each surface keeps its depth-aspect view until it is released. `VulkanDevice` enables `VK_KHR_push_descriptor` when the device has it, and the graphics `Context` carries it as `pushDescriptors`. The new `agc_embedded_shader` CMake function compiles a `Graphics/shaders` source into an embedded SPIR-V header. Copies back into the depth plane keep `main`'s copy. A fragment shader's depth write can't stand in for it: on the 2080 Ti it flushed subnormals to ±0 and turned every NaN into -inf, and without `VK_EXT_depth_range_unrestricted` it clamped to [0, 1]. Finite values outside [0, 1] survived with the extension only because the driver didn't clamp them: with a [0, 1] viewport the spec leaves them undefined, and a ±`FLT_MAX` viewport, which would make them defined, broke the store-back test on this driver. The round-trip results are under Tested. These keep `main`'s copies too: D16 planes, the stencil plane, multisampled surfaces, `TakeStorage` and the layered copies (`LayeredDepthStorage::Copy`). So does every plane when `APS5_NO_DEPTH_TRANSFER_PASS=1` is set; the variable has its row in `ENVIRONMENT.md`. The copies still take #11685's direct path where it applies, and `APS5_NO_DIRECT_DEPTH_COPY=1` still forces the staging buffer. What the pass keeps, by device configuration: - **With or without `VK_EXT_depth_range_unrestricted`:** the pass gives back exactly what `main`'s copy gives back, word for word. It reads the 32-bit texel without a sampler and stores its bits, and the spec defines no conversion for that read. - **Tested on the 2080 Ti, in both configurations:** all 16 test words come back unchanged through the pass and through the copy. Those are 0.25, 1, ±0, -0.5, 2.0, three subnormals, `FLT_MAX`, ±inf, and quiet and signalling NaNs with payloads. - **Not claimed for other GPUs:** NaN payloads and subnormals. The spec says nothing about flushing them on an image read; on a GPU that changes them, the round-trip test fails rather than passing silently. Tests: - `agc_driver_depth_storage` stores the 16 words into a D32 plane and a D32S8 plane, then reads them back twice, copies only and with the pass. It requires word-for-word equal results and that the pass ran. It requires 0.25, 1 and +0 back in every configuration, and -0.5 and 2.0 back where the depth range is unrestricted. It reports which of the other words the copy changed: none on this GPU. Its device enables `VK_KHR_push_descriptor` when the queue can draw, and `VK_EXT_depth_range_unrestricted` unless `--restricted-depth` is given. The existing whole-plane data and stencil checks run through the pass as well. - New `agc_driver_depth_storage_copies` runs it with `APS5_NO_DEPTH_TRANSFER_PASS=1` and requires zero passes, with the data and stencil checks unchanged. New `agc_driver_depth_storage_restricted_depth` runs it without the extension. - `agc_driver_depth_plane_partial_store` (partial stores) runs in three modes. The default requires the pass where the device has `VK_KHR_push_descriptor`. The new `agc_driver_depth_plane_partial_store_image_copy` (`--image-copy`) turns the pass off and requires direct copies where `VK_KHR_maintenance8` is enabled. `--buffer-copy` turns both off. - `DepthSurface` gains `SetDepthTransferPasses` and `DepthTransferPassCount` for these tests, like #11685's `SetDirectDepthCopy` and `DirectDepthCopyCount`. No open PR reads depth planes in a compute pass or enables `VK_KHR_push_descriptor`. `tools/pr_overlap.py` finds no other open PR that changes the same code. It could not compare 92 PRs that conflict with `main` and share a file with this one, and none of their diffs adds push descriptors or changes `copyPlane` or `DirectDepthCopy`. ### Tested **Rebased onto `main` 2227f13661 (57d63ac306).** The round trips and S3K numbers below were measured on `main` c02d287bd0, with this change as 05addcdbd1. The 120 commits between them change eight lines of the files this PR touches, in `CMakeLists.txt` and `VulkanDevice.cpp`, and nothing in the transfer path. On the rebased head the validation run below gives 18/18 again, with no `VUID-` line and no missing-layer line, and `ctest` passes 2815 of 2815. Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 2080 Ti, driver 617.14, i9-9900K. **Round trips.** These ran with a temporary build that could also turn on the fragment depth write, which the review asked about. They store the 16 words into a D32 plane and a D32S8 plane through the store-back, then read them back through a storage view. Both formats gave the same results. | Path | `VK_EXT_depth_range_unrestricted` enabled | not enabled (`--restricted-depth`) | |---|---|---| | `main`'s copies, direct and through the staging buffer | all 16 words kept | all 16 words kept | | compute pass, depth to storage (this PR) | all 16 words kept | all 16 words kept | | fragment depth write, storage to depth, [0, 1] viewport (dropped) | ±0, -0.5, 2.0, `FLT_MAX` and ±inf kept; subnormals flushed to ±0; every NaN came back as -inf | ±0 kept; clamped to [0, 1]; subnormals flushed; NaN came back as 0 | | fragment depth write with a ±`FLT_MAX` viewport (dropped) | the existing store-back test failed | not valid without the extension | **S3K.** Sonic Origins Plus (PPSA05324) on the Sonic 3 & Knuckles page of the main menu, `main`'s defaults. `main` c02d287bd0 against `main` with this PR (05addcdbd1), both built from the same tree; nothing else is applied. Each build got a warm-up boot and one `APS5_PROFILE_GPU=1` boot. Then came two interleaved traced rounds (`main`, PR, `main`, PR; `APS5_TRACE_SECONDS=200:15`, six title FPS readings each). | | `main` | this PR | |---|---|---| | `[gputime]` copy class per present (2 transfers, 63.3 MiB) | 2.76 ms | 1.68 ms | | `[gputime]` GPU time per present, all ranges, the same six blocks on the page | 52.95 ms | 51.90 ms | | GPU busy per present (ms, round 1 / round 2) | 53.6 / 62.1 | 52.6 / 60.7 | | frame p50 / p90 / p99 (ms), round 1 | 58.3 / 65.6 / 82.2 | 59.2 / 64.0 / 82.2 | | frame p50 / p90 / p99 (ms), round 2 | 63.9 / 72.2 / 88.0 | 64.5 / 74.1 / 94.4 | | title FPS, median of six readings (round 1 / round 2) | 17.15 / 17.10 | 17.74 / 16.02 | - Of the two transfers per frame, one goes from the depth plane to its storage image and now runs in the pass. The other goes back and keeps `main`'s copy, about 1.5 ms of the remaining 1.68 ms. - The frame times and title FPS move within the noise of these runs: other load averaged 5.1% CPU, with a 57.8% CPU peak and an 18.2% GPU peak. - All four traces show `Driver.Draw.shader_compile_and_link` inside the window, `main`'s included, so the rounds compare like with like. - All four traces dropped events once the queue worker's event buffer filled. The phase totals still cover the whole window, and the frame and GPU times in the summary lines don't come from those events. **Tests.** - `ctest` on `main` c02d287bd0 plus this PR: 2776 of 2777 pass. The failure, `agc_driver_mesh_barycentric_emulation`, was `main`'s own and passes on the rebased head. - `ctest --test-dir build -R "depth_plane_partial_store|depth_storage|depth_plane_sampling|depth_copy|native_depth" -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: 15/15 on `main` and 18/18 on this PR. The three extra tests are `agc_driver_depth_plane_partial_store_image_copy`, `agc_driver_depth_storage_copies` and `agc_driver_depth_storage_restricted_depth`. Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither has a `VUID-` line. On this PR, the three `depth_storage` runs report that the pass matches the copy and that the copy changed none of the 16 words. The copies run reports zero passes. All four traces are attached, one zip per round with the `main` and PR traces. [depth-to-storage-s3k-c02d-round1.zip](https://github.com/user-attachments/files/34076974/depth-to-storage-s3k-c02d-round1.zip) [depth-to-storage-s3k-c02d-round2.zip](https://github.com/user-attachments/files/34076990/depth-to-storage-s3k-c02d-round2.zip) **Sonic 3 & Knuckles page, round 1, main** **seconds 200:15** from present 4373: 250 presents, frame p50 58.3 / p90 65.6 / p99 82.2 / max 82.7 ms, GPU busy 53.6 ms per present NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit c02d287bd0eb, dropped: yes ```json {"commit":"c02d287bd0eb","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":4373,"ms":15052.654},"presents":250,"frame_ms":{"p50":58.279,"p90":65.626,"p99":82.192,"max":82.663},"gpu_busy_ms_per_present":53.633,"worker_busy_pct":{"queue worker 0x0":97.349},"top_phases_ms_per_frame":{"Driver.Packet":57.742,"Graphics.Draw":46.63,"Driver.Packet.draw":44.825,"Driver.Draw":44.135,"Graphics.Draw.draw_and_resource_release":38.531,"Driver.Draw.shader_compile_and_link":27.402,"VideoOut.Flip":22.641,"Driver.Present":22.551},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.78,"events_lost":412503,"totals_full":false},"draw committer":{"events_full_after_s":12.591,"events_lost":50581,"totals_full":false}},"trace":"aps5-trace-c02d287bd0eb-25464.json.gz"} ``` **Sonic 3 & Knuckles page, round 1, this PR** **seconds 200:15** from present 4517: 248 presents, frame p50 59.2 / p90 64.0 / p99 82.2 / max 86.7 ms, GPU busy 52.6 ms per present NVIDIA GeForce RTX 2080 Ti, NVIDIA 617.14, Windows 10.0.26300, 3840x2160, commit 05addcdbd111, dropped: yes ```json {"commit":"05addcdbd111","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"200:15"},"gpu":"NVIDIA GeForce RTX 2080 Ti","driver":"NVIDIA 617.14","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32684,"title_id":"PPSA05324","title":"Sonic Origins","content_version":"02.002.000","resolution":"3840x2160","window":{"spec":"seconds 200:15","first_present":4517,"ms":15035.38},"presents":248,"frame_ms":{"p50":59.151,"p90":64.026,"p99":82.243,"max":86.691},"gpu_busy_ms_per_present":52.563,"worker_busy_pct":{"queue worker 0x0":97.386},"top_phases_ms_per_frame":{"Driver.Packet":58.162,"Graphics.Draw":46.448,"Driver.Packet.draw":45.247,"Driver.Draw":44.514,"Graphics.Draw.draw_and_resource_release":38.293,"Driver.Draw.shader_compile_and_link":27.879,"VideoOut.Flip":21.614,"Driver.Present":21.506},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.69,"events_lost":434140,"totals_full":false},"draw committer":{"events_full_after_s":12.691,"events_lost":49445,"totals_full":false}},"trace":"aps5-trace-05addcdbd111-12292.json.gz"} ``` ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 2080 Ti, driver 617.14, Windows 11 Pro 10.0.26300 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-28 03:06:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T03:06:17Z.

Review: CHANGES_REQUESTED


I independently checked the two concerns raised in the discussion on exact head 2c401e31988c7b18308bade0e7ed3a81ba4ed0df. Both are confirmed from the code: the pass is selected for 32-bit depth/storage pairs without constraining stored values, while the store-back shader writes the integer payload as gl_FragDepth; and agc_driver_depth_storage asserts a pass ran even when APS5_NO_DEPTH_TRANSFER_PASS disables them. I also ran glslangValidator -V --target-env vulkan1.1 on both new shaders successfully, and rechecked git diff --check, current-main merge preview, the attached round-2 digest output, and the author's reported validation results. I am requesting changes for the two concrete issues below; the 16/16 focused GPU test result does not cover the arbitrary-bit round trip or the opt-out test configuration.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5677285614 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12120#pullrequestreview-5677285614). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T03:06:17Z. **Review:** CHANGES_REQUESTED --- I independently checked the two concerns raised in the discussion on exact head `2c401e31988c7b18308bade0e7ed3a81ba4ed0df`. Both are confirmed from the code: the pass is selected for 32-bit depth/storage pairs without constraining stored values, while the store-back shader writes the integer payload as `gl_FragDepth`; and `agc_driver_depth_storage` asserts a pass ran even when `APS5_NO_DEPTH_TRANSFER_PASS` disables them. I also ran `glslangValidator -V --target-env vulkan1.1` on both new shaders successfully, and rechecked `git diff --check`, current-main merge preview, the attached round-2 digest output, and the author's reported validation results. I am requesting changes for the two concrete issues below; the 16/16 focused GPU test result does not cover the arbitrary-bit round trip or the opt-out test configuration.
adriadam10 commented 2026-10-28 10:53:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T10:53:23Z.

Review: CHANGES_REQUESTED


Agreeing with the two points already raised at 2c401e3198, neither addressed yet:

  • DepthSurface.cpp:80-82: depthTransferPass gates on format and push descriptors only, while StorageToDepth.frag writes any stored word through gl_FragDepth and FromStorage fixes the viewport to 0..1. Values outside [0, 1] or NaN written through the storage alias are not kept bit for bit, and VK_EXT_depth_range_unrestricted is enabled where available. Either keep main's copy for values the pass can't reproduce exactly, or leave the pass opt-in until the equivalence is shown. Replace the blanket range claim with an argument per device configuration, and add enabled-versus-copy round-trip checks (-0.5, 2.0, signed zero, subnormals, NaN) stating bit preservation only as far as it holds.
  • DepthStorage.cpp:367 requires DepthTransferPassCount() > 0 whenever pushDescriptors is set, but APS5_NO_DEPTH_TRANSFER_PASS stops every increment, so the test fails with the switch. Honor the switch there (as DepthPlanePartialStore.cpp:135 does) and run agc_driver_depth_storage both ways, expecting zero passes in the off run.

Keep the copy fallbacks and the existing data, partial-rectangle and stencil checks.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5681472070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12120#pullrequestreview-5681472070). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T10:53:23Z. **Review:** CHANGES_REQUESTED --- Agreeing with the two points already raised at `2c401e3198`, neither addressed yet: - `DepthSurface.cpp:80-82`: `depthTransferPass` gates on format and push descriptors only, while `StorageToDepth.frag` writes any stored word through `gl_FragDepth` and `FromStorage` fixes the viewport to 0..1. Values outside [0, 1] or NaN written through the storage alias are not kept bit for bit, and `VK_EXT_depth_range_unrestricted` is enabled where available. Either keep `main`'s copy for values the pass can't reproduce exactly, or leave the pass opt-in until the equivalence is shown. Replace the blanket range claim with an argument per device configuration, and add enabled-versus-copy round-trip checks (-0.5, 2.0, signed zero, subnormals, NaN) stating bit preservation only as far as it holds. - `DepthStorage.cpp:367` requires `DepthTransferPassCount() > 0` whenever `pushDescriptors` is set, but `APS5_NO_DEPTH_TRANSFER_PASS` stops every increment, so the test fails with the switch. Honor the switch there (as `DepthPlanePartialStore.cpp:135` does) and run `agc_driver_depth_storage` both ways, expecting zero passes in the off run. Keep the copy fallbacks and the existing data, partial-rectangle and stencil checks.
MarcZX10 commented 2026-10-29 08:54:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:54:15Z.

Review: CHANGES_REQUESTED


Re-reviewed exact head 57d63ac306f22ea71b02075e0d738113c4728aa5. The earlier test concerns are addressed in this head: RunRoundTrips compares the pass with the copy path across the signed-zero, out-of-range, subnormal, infinity and NaN words, and its pass-count assertion now permits APS5_NO_DEPTH_TRANSFER_PASS; the pass-off case is separately selectable. The remaining blocker is the behavior limit raised in the latest review: depthToStoragePass is enabled by default for eligible format/push-descriptor devices, while the test only requires exact input preservation for [0,1] values and for out-of-range values when unrestricted depth is available. Please add the still-unmeasured bit-preservation scope and the APS5_NO_DEPTH_TRANSFER_PASS fallback to docs/dev/debt/libSceAgcDriver.md as requested, so the default behavior and its limits are explicit. Current-main merge preview is clean; exact-head Windows workflow passes, product Linux/GPU jobs are skipped. I did not run local GPU tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695078847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12120#pullrequestreview-5695078847). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T08:54:15Z. **Review:** CHANGES_REQUESTED --- Re-reviewed exact head `57d63ac306f22ea71b02075e0d738113c4728aa5`. The earlier test concerns are addressed in this head: `RunRoundTrips` compares the pass with the copy path across the signed-zero, out-of-range, subnormal, infinity and NaN words, and its pass-count assertion now permits `APS5_NO_DEPTH_TRANSFER_PASS`; the pass-off case is separately selectable. The remaining blocker is the behavior limit raised in the latest review: `depthToStoragePass` is enabled by default for eligible format/push-descriptor devices, while the test only requires exact input preservation for [0,1] values and for out-of-range values when unrestricted depth is available. Please add the still-unmeasured bit-preservation scope and the `APS5_NO_DEPTH_TRANSFER_PASS` fallback to `docs/dev/debt/libSceAgcDriver.md` as requested, so the default behavior and its limits are explicit. Current-main merge preview is clean; exact-head Windows workflow passes, product Linux/GPU jobs are skipped. I did not run local GPU tests.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12120
No description provided.