Reuse automatic texture readbacks after list retirement #27

Closed
github-bot wants to merge 1 commit from gh-pr/27/head into gh-pr/27/base
Owner

@⁠rafaconvaitis on GitHub · 2026-11-26 18:05 UTC · original
rafaconvaitis:fix/reuse-fenced-texture-readbacks → main · +398 −12 · 2 files · 1 commits · closed without merging

What changes

Reuse the automatic texture readback destinations acquired by texback::record. Each device keeps its own bounded set of idle readback buffers. A closed recording retains exclusive use of its destination across executions. A completed fence and list reset or retirement are required before the resource can be acquired for another recording. Buffers outside the size classes and failed rounded allocations take the original exact-size path.

Enable with VICTORY_READBACK_POOL=1. Set the idle width cap in MiB with VICTORY_READBACK_POOL_MB. The default is 256 MiB once enabled. Creation, reuse, allocation duration, active widths, idle widths, and successful landings have separate counters.

This addresses the automatic path discussed in fxceless/victory-fork#1340. Marvisak/VIctory#2818 covers the explicit readback path and is a reference for list-owned lifetimes.

Validation

  • Four focused tests passed on Windows with WARP and on an RTX 4070 12 GB. The D3D12 test runs one closed recording twice and submits a second recording with distinct data. It checks both texels and confirms that the first buffer can be reused only after reset.
  • A Series S Windows run with the 128 MiB cap and an RTX 4070 recorded 3,967 completed texture reads between its first and 32nd counter samples. That interval contained 3,924 reuses and five new resources, after the initial 39 resources recorded before the first sample. There were zero allocation failures. These are allocation and lifetime results from the integrated build. The frame-rate comparison remains separate.

Boat comparison

The same Windows RTX 4070 Series S executable and checkpoint reached the bridge at the start of Follow the plane in both runs. Both runs used the async logger and loaded a warm host pipeline library. Over roughly 60 seconds, each logged 14,208 completed reads. The 128 MiB pool arm recorded 14,208 reuses and zero new allocations. The disabled arm recorded 14,200 new allocations and zero reuses. No allocation failed in either interval.

Median frame rates were 15.35 and 14.90 FPS. The draw counts and input timing differed slightly. Both captures showed the flat water, missing clouds, and a dark sun reflection. The shared visual defect still needs investigation. These results establish the lower allocation count. A reliable frame-rate comparison and a visually correct path remain open, so this PR is in draft.

fxceless/victory-fork#1359 now addresses the same class of allocation. The separate Windows live comparison and repeated-list test add validation for that approach.

**@⁠rafaconvaitis** on GitHub · 2026-11-26 18:05 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/27) `rafaconvaitis:fix/reuse-fenced-texture-readbacks` → `main` · +398 −12 · 2 files · 1 commits · closed without merging ## What changes Reuse the automatic texture readback destinations acquired by `texback::record`. Each device keeps its own bounded set of idle readback buffers. A closed recording retains exclusive use of its destination across executions. A completed fence and list reset or retirement are required before the resource can be acquired for another recording. Buffers outside the size classes and failed rounded allocations take the original exact-size path. Enable with `VICTORY_READBACK_POOL=1`. Set the idle width cap in MiB with `VICTORY_READBACK_POOL_MB`. The default is 256 MiB once enabled. Creation, reuse, allocation duration, active widths, idle widths, and successful landings have separate counters. This addresses the automatic path discussed in fxceless/victory-fork#1340. Marvisak/VIctory#2818 covers the explicit readback path and is a reference for list-owned lifetimes. ## Validation - Four focused tests passed on Windows with WARP and on an RTX 4070 12 GB. The D3D12 test runs one closed recording twice and submits a second recording with distinct data. It checks both texels and confirms that the first buffer can be reused only after reset. - A Series S Windows run with the 128 MiB cap and an RTX 4070 recorded 3,967 completed texture reads between its first and 32nd counter samples. That interval contained 3,924 reuses and five new resources, after the initial 39 resources recorded before the first sample. There were zero allocation failures. These are allocation and lifetime results from the integrated build. The frame-rate comparison remains separate. ## Boat comparison The same Windows RTX 4070 Series S executable and checkpoint reached the bridge at the start of **Follow the plane** in both runs. Both runs used the async logger and loaded a warm host pipeline library. Over roughly 60 seconds, each logged 14,208 completed reads. The 128 MiB pool arm recorded 14,208 reuses and zero new allocations. The disabled arm recorded 14,200 new allocations and zero reuses. No allocation failed in either interval. Median frame rates were 15.35 and 14.90 FPS. The draw counts and input timing differed slightly. Both captures showed the flat water, missing clouds, and a dark sun reflection. The shared visual defect still needs investigation. These results establish the lower allocation count. A reliable frame-rate comparison and a visually correct path remain open, so this PR is in draft. fxceless/victory-fork#1359 now addresses the same class of allocation. The separate Windows live comparison and repeated-list test add validation for that approach.
Keep each readback exclusive until its recording is reset or retired. Add a per-device bounded idle pool and separate allocation, reuse and landing telemetry.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 06:07:13 +00:00
github-bot closed this pull request 2026-11-27 06:07:13 +00:00
Author
Owner

@⁠DoubleGhosty on GitHub · 2026-11-26 22:55 UTC · original

Cherry-picked onto main in commit 67028e21. Verified with workspace clippy (-D warnings) and all 6 readback/pool tests passing. Thanks @⁠rafaconvaitis!

**@⁠DoubleGhosty** on GitHub · 2026-11-26 22:55 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/27#issuecomment-7205107680) Cherry-picked onto main in commit 67028e21. Verified with workspace clippy (-D warnings) and all 6 readback/pool tests passing. Thanks @⁠rafaconvaitis!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.