Repository navigation
Conversation
kaayzouee
left a comment
There was a problem hiding this comment.
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.- Sorting and merging overlapping/adjacent ranges only at flush time is a reasonable trade-off; it avoids repeatedly sorting or shifting elements during recording.
- Both
flush_one()andflush()normalize ranges before updating, preserving the existing GPU-write and title-write barriers. - The parallel refresh path still assigns one job per shadow, rather than allowing multiple jobs to update the same shadow concurrently.
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 RefreshRanges logic can be tested without D3D12 initialization.
Please consider table-driven tests for:
- Disjoint ranges added in reverse order.
- Adjacent and overlapping ranges, including nested/duplicate ranges.
- A bridging range that merges two previously disjoint ranges.
- Multiple ranges with chained overlaps after promotion from
OnetoMany. - Idempotent normalization.
The current dedup_by implementation 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
- In
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. - Prefer the named
MEM_WRITE_WATCHbinding in the WARP test if available in the pinned Windows bindings. - The unchanged submission-wide
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=0 and 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.
0d22b38 to
3d5dc4a
Compare
Keep the union of overlapping and adjacent refresh ranges per shadow. Cover range normalization with CPU unit tests and preserve the WARP readback regression. Adapted from Aydan (aycow) in Marvisak/VIctory#1818. Thanks to pablogonz12 for the original reproduction in Marvisak/VIctory#185.
3d5dc4a to
494b315
Compare
|
There’s another place where a gap can disappear before a request reaches 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. |
|
I tested Three focused range-union tests passed. The asset-free D3D12 readback fixture passed on the physical RTX with Codex assisted with the integration and tests. |
|
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 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. |
When 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 c96b4f2 with candidate 0d22b38. 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.