merge overlapping gpu write-back ranges and coalesce watch opens #991

Closed
matheusfrta wants to merge 5 commits from upstream-pr/991 into main
matheusfrta commented 2026-11-24 14:43:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by matheusfrta on 2026-11-24T14:43:56Z.


It merges overlapping shader write ranges per shadow buffer so each submission diffs and copies back every byte at most once instead of re-scanning overlapping views against the same snapshot, and uses 8-byte chunk fast paths during the merge. It also coalesces contiguous VirtualProtect calls in watch::open, drops a temporary Vec allocation in watch::writes, and ignores zero-length ranges so unaligned zero-byte calls do not unguard a block.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584385466 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/991). Originally posted by [matheusfrta](https://github.com/matheusfrta) on 2026-11-24T14:43:56Z. --- It merges overlapping shader write ranges per shadow buffer so each submission diffs and copies back every byte at most once instead of re-scanning overlapping views against the same snapshot, and uses 8-byte chunk fast paths during the merge. It also coalesces contiguous VirtualProtect calls in watch::open, drops a temporary Vec allocation in watch::writes, and ignores zero-length ranges so unaligned zero-byte calls do not unguard a block.
Zipettte commented 2026-11-24 15:04:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T14:55:04Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 00c1f57: cargo test -p victory-gpu does not compile:

error[E0425]: cannot find value `DXGI_FORMAT_B8G8B8A8_UNORM` in this scope
  --> crates\victory-gpu\src\host.rs:1444:25
1444 |         87 | 90 | 91 => DXGI_FORMAT_B8G8B8A8_UNORM,

Looks like a typo for DXGI_FORMAT_B8G8R8A8_UNORM (the line is added by this PR). main (ffe310e) builds and passes on the same machine.

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135159629 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/991#issuecomment-7135159629). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T14:55:04Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 00c1f57: `cargo test -p victory-gpu` does not compile: ``` error[E0425]: cannot find value `DXGI_FORMAT_B8G8B8A8_UNORM` in this scope --> crates\victory-gpu\src\host.rs:1444:25 1444 | 87 | 90 | 91 => DXGI_FORMAT_B8G8B8A8_UNORM, ``` Looks like a typo for `DXGI_FORMAT_B8G8R8A8_UNORM` (the line is added by this PR). main (ffe310e) builds and passes on the same machine. _Tested with AI assistance (Claude)._
matheusfrta commented 2026-11-24 16:05:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by matheusfrta on 2026-11-24T15:19:24Z.


Thanks for catching that! Fixed the typo back to DXGI_FORMAT_B8G8R8A8_UNORM in host.rs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135830014 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/991#issuecomment-7135830014). Originally posted by [matheusfrta](https://github.com/matheusfrta) on 2026-11-24T15:19:24Z. --- Thanks for catching that! Fixed the typo back to DXGI_FORMAT_B8G8R8A8_UNORM in host.rs.
upstream-sync closed this pull request 2026-11-25 01:05:10 +00:00
Marvisak commented 2026-11-25 01:07:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:29:36Z.


Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

Superseded by main: whole pieces are compared and copied back once per submission (shadow.rs compared), and the watch.rs functions it tunes (open over ranges, writes) were replaced by per-copy trackers.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148565627 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/991#issuecomment-7148565627). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:29:36Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Superseded by main: whole pieces are compared and copied back once per submission (shadow.rs `compared`), and the watch.rs functions it tunes (open over ranges, writes) were replaced by per-copy trackers. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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
Marvisak/VIctory!991
No description provided.