Preserve disjoint shadow refresh ranges #591
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!591
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-591"
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?
@DoubleD17 on GitHub · 2026-11-25 02:44 UTC · original
DoubleD17:fix/disjoint-shadow-refresh-ranges→main· +263 −47 · 1 files · 1 commits · closed without mergingWhen a submission asks for two disjoint ranges of the same shadow buffer, the previous bounding interval can refresh a dirty page in the gap before any request includes it. Keep the union of overlapping or adjacent ranges and preserve the existing flush points. Adapted from Aydan (aycow) in Marvisak/VIctory#1818, with credit to pablogonz12 for the original reproduction in #185.
A synthetic D3D12 WARP submission and readback on Windows 11 compared base
c96b4f2b83with candidate 0d22b3808d0e5413dd845c771de5d6977cfbdc20. The base copied 192 KiB for two 64 KiB requests. The candidate copied 128 KiB, preserved the gap's previous contents, and copied its 64 KiB on the later request. The overlapping-range and GPU write declaration controls matched the base. The reported refresh volume in fxceless #543 sums requests before batching. Physical GPU and frame-time effects remain unmeasured.AI-assisted.
@UwUCammie on GitHub · 2026-11-25 22:21 UTC · original
There’s another place where a gap can disappear before a request reaches
Batch.State::heap_buffersfolds all the directly indexed views of one shadow intomin(start)..max(end). On a local build I kept their union through both the heap pass and the submission batch. One first-room pass covered 1,715 MiB of view ranges; bounding the same views would have included another 712 MiB. These are requested spans, before the write watch decides what actually needs copying.That experimental run lost the device before the timing window, so I don’t have a gameplay timing result or a cause for the loss. The byte counts do show where a caller of this change still requests the gaps.
@Filip722 on GitHub · 2026-11-26 01:53 UTC · original
I tested
494b315cin a local integration based ondc4c0fcwith the #256 Wine write path. Runtime was Bazzite 44 and GE-Proton11-14 on an RTX 5060 Laptop GPU (NVIDIA 615.78.08).Three focused range-union tests passed. The asset-free D3D12 readback fixture passed on the physical RTX with
VICTORY_REFRESH_ONCE=0and=1in separate processes. The fixture verified the two requested dirty ranges and read the intervening region later, after it was explicitly requested. The integration makes exact ranges opt-in for a later same-binary title comparison. These results cover range and readback correctness.Codex assisted with the integration and tests.
@Filip722 on GitHub · 2026-11-26 04:29 UTC · original
I followed up the D3D12 readbacks with two Series S opening-cinematic replays on an RTX 5060 Laptop GPU (615.78.08), Bazzite 44 and GE-Proton 11-14. The replays used the same executable containing
494b315cand started with identical isolated state and caches. Only exact refresh differed.Both rendered the opening cinematic after the FidelityFX fence. From the first to the 105th post-upscale Present, exact off took 523 s (3.81 s median interval), and exact on took 574 s (4.12 s median). The shots and draw counts differed at equal frame ordinals. These samples do not establish a throughput gain or a regression. The exact path's gap counter showed skipped address coverage and does not measure transferred bytes.
OpenAI Codex assisted with the integration and testing.
@kaayzouee on GitHub · 2026-11-25 02:46 UTC · original · approved these changes
Code review
Reviewed commit
0d22b380. The change is distinct from the existing target-branch implementation. The core range-union algorithm looks correct, and I found no blocking issue in the changed code during static inspection.What is good
RefreshRanges::Onepreserves the allocation-free common case. A plainVecfor every shadow would be simpler superficially, but would introduce unnecessary allocations on this hot path.flush_one()andflush()normalize ranges before updating, preserving the existing GPU-write and title-write barriers.Recommended: add ordinary unit tests for the range union
The new WARP test is valuable because it checks real readback contents and copied-byte counters, but it is ignored by default and requires diagnostics and an isolated WARP process. The pure
RefreshRangeslogic can be tested without D3D12 initialization.Please consider table-driven tests for:
OnetoMany.The current
dedup_byimplementation is correct: Rust passes the later element first and removes that element when the predicate returns true. A short comment documenting that argument order would improve readability, but I would not replace the algorithm with a larger abstraction.Minor simplifications
Batch::add(), usingself.index.entry(key).or_insert_with(...)could avoid a second hash lookup for new shadows, if it remains readable. The current match is also fine.MEM_WRITE_WATCHbinding in the WARP test if available in the pinned Windows bindings.ask_oncecode still constructs a bounding span per shadow. This is not the same as copying the gap: the write-watch journal records dirty pages separately fromShadow::copy_stale. Nevertheless, the change does not eliminate the potentially broad kernel write-watch query. Treat copied bytes and write-watch overhead as separate metrics.Verification and verdict
The supplied 192 KiB → 128 KiB synthetic result is useful evidence of the intended behavior. It is not evidence of physical-GPU frame-time improvement, which the PR correctly leaves unmeasured. Testing the WARP case with both
VICTORY_ASK_ONCE=0and the default enabled path would provide additional confidence, as would a multi-shadow wide-refresh test.Overall, good code quality and appropriately scoped. I would approve the implementation, with the ordinary range-union unit tests as a recommended nonblocking improvement.
Static review only: I inspected the diff and the surrounding batching, shadow-update and write-watch implementations, but did not independently build or run the Windows/WARP tests.
This is an automated message, if you believe this is incorrect, please reply with the relevant technical context or a reproducible counterexample so the finding can be reassessed.
Pull request closed