GPU: rectangle vertices are read from title memory through the kernel at submission #2296

Open
github-bot wants to merge 1 commit from github-bot/gh-2296 into main AGit
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 10:05 UTC · original
denkencar-sketch:fix/draw-003 → main · +44 −11 · 1 files · 1 commits · open

Summary

Rectangle vertices were read from title memory with a raw slice at submission. The title may unmap the vertex buffer between the draw and the submission, and the slice then faulted. They are now read through the kernel and rectangles of unmapped vertices are skipped. The allocation is bounded by the earlier shadow::find.

Testing

Test rectangles_of_unmapped_vertices_are_skipped crashes (0xc0000005) with the old raw slice and passes with this change. cargo test --workspace --locked passes apart from known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a run in the game. Known nits: a failed read leaves stale scratch, and a Vec is made per draw.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 10:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2296) `denkencar-sketch:fix/draw-003` → `main` · +44 −11 · 1 files · 1 commits · open ## Summary Rectangle vertices were read from title memory with a raw slice at submission. The title may unmap the vertex buffer between the draw and the submission, and the slice then faulted. They are now read through the kernel and rectangles of unmapped vertices are skipped. The allocation is bounded by the earlier `shadow::find`. ## Testing Test `rectangles_of_unmapped_vertices_are_skipped` crashes (`0xc0000005`) with the old raw slice and passes with this change. `cargo test --workspace --locked` passes apart from known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a run in the game. Known nits: a failed read leaves stale scratch, and a `Vec` is made per draw. AI-assisted.
The title may unmap the vertex buffer between the draw and the submission;
the raw slice over it faulted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:21 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 14:53 UTC · original · edited 2026-11-26 03:20 UTC

Automated triage for the maintainers.

Thanks for the rebase. Reviewed at e3e9124, which merges cleanly. CI: passing.

In crates/victory-gpu/src/draw.rs, State::rectangles used to read the title's vertices with a raw slice in its deferred closure. It now calls the new expand_title_rects, which copies them through host::read_into (ReadProcessMemory) first. A vertex buffer the title unmapped before submission therefore skips the expansion instead of faulting. The size is still bounded by the shadow::find and buffer-size checks made at record time. The new test protects a page with PAGE_NOACCESS to exercise the failing path.

One optional improvement, which you already list as a known nit: on a failed read the scratch keeps whatever it held before, possibly an earlier list's vertices. Zeroing dst would turn those rectangles into degenerate triangles rather than stale geometry.

Verdict: merge candidate (a recommendation to look, not an approval). CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 14:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2296#issuecomment-7165982712) · edited 2026-11-26 03:20 UTC <!-- victory-triage v1 head=e3e9124d59a5e55a7e384490ed52a5d9d94bff4a verdict=merge-candidate at=2026-11-26T03:20:14Z --> Automated triage for the maintainers. Thanks for the rebase. Reviewed at `e3e9124`, which merges cleanly. CI: passing. In `crates/victory-gpu/src/draw.rs`, `State::rectangles` used to read the title's vertices with a raw slice in its deferred closure. It now calls the new `expand_title_rects`, which copies them through `host::read_into` (`ReadProcessMemory`) first. A vertex buffer the title unmapped before submission therefore skips the expansion instead of faulting. The size is still bounded by the `shadow::find` and buffer-size checks made at record time. The new test protects a page with `PAGE_NOACCESS` to exercise the failing path. One optional improvement, which you already list as a known nit: on a failed read the scratch keeps whatever it held before, possibly an earlier list's vertices. Zeroing `dst` would turn those rectangles into degenerate triangles rather than stale geometry. **Verdict: merge candidate** (a recommendation to look, not an approval). CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 10:19 UTC · original · reviewed

Rectangle vertices read from title memory through the copy (expand_title_rects). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

**@⁠catminou4** on GitHub · 2026-11-25 10:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2296#pullrequestreview-6055712684) · **reviewed** Rectangle vertices read from title memory through the copy (expand_title_rects). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 14:56 UTC · original · approved these changes

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Reading rectangle vertices from title memory through the kernel at submission and skipping unmapped ranges passes all draw tests cleanly.
  • cargo test -p victory-gpu draw::tests: 6/6 passed on RTX 5090, 6/6 passed on WARP (including rectangles_of_unmapped_vertices_are_skipped).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 14:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2296#pullrequestreview-6059984064) · **approved these changes** Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Reading rectangle vertices from title memory through the kernel at submission and skipping unmapped ranges passes all draw tests cleanly. - `cargo test -p victory-gpu draw::tests`: 6/6 passed on RTX 5090, 6/6 passed on WARP (including `rectangles_of_unmapped_vertices_are_skipped`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 15:22 UTC · original · approved these changes

Reviewed crates/victory-gpu/src/draw.rs at e3e9124d merged onto origin/main (63bcca43) and verified on RTX 5090 and WARP (VICTORY_D3D12_WARP=1) with VICTORY_D3D12_DEBUG=1.

Safety & bounds audit

  • State::rectangles (draw.rs:1636) now delegates submission-time expansion to expand_title_rects (draw.rs:2023), copying n * 3 * stride bytes through crate::host::read_into (ReadProcessMemory) and returning early if the title unmapped the vertex pages between record and submission instead of faulting on a raw slice dereference.
  • Record-time checks (stride > 0, u64::from(first + count) * stride <= u64::from(v.size), shadow::find(from, rects * 3 * stride), and list.scratch(rects * 6 * stride)) bound both the temporary buffer and scratch slice sizes cleanly.

Verification

  • cargo run -p xtask -- policy: 191 files ok.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • draw:: with VICTORY_D3D12_DEBUG=1: 21/21 passed on RTX 5090 and 21/21 passed on WARP (--features diagnostics), including rectangles_of_unmapped_vertices_are_skipped (draw.rs:2058).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 15:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2296#pullrequestreview-6076684782) · **approved these changes** Reviewed `crates/victory-gpu/src/draw.rs` at `e3e9124d` merged onto `origin/main` (`63bcca43`) and verified on RTX 5090 and WARP (`VICTORY_D3D12_WARP=1`) with `VICTORY_D3D12_DEBUG=1`. ### Safety & bounds audit - `State::rectangles` (`draw.rs:1636`) now delegates submission-time expansion to `expand_title_rects` (`draw.rs:2023`), copying `n * 3 * stride` bytes through `crate::host::read_into` (`ReadProcessMemory`) and returning early if the title unmapped the vertex pages between record and submission instead of faulting on a raw slice dereference. - Record-time checks (`stride > 0`, `u64::from(first + count) * stride <= u64::from(v.size)`, `shadow::find(from, rects * 3 * stride)`, and `list.scratch(rects * 6 * stride)`) bound both the temporary buffer and scratch slice sizes cleanly. ### Verification - `cargo run -p xtask -- policy`: 191 files ok. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - `draw::` with `VICTORY_D3D12_DEBUG=1`: **21/21 passed** on RTX 5090 and **21/21 passed** on WARP (`--features diagnostics`), including `rectangles_of_unmapped_vertices_are_skipped` (`draw.rs:2058`).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2296/head:github-bot/gh-2296'
git switch 'github-bot/gh-2296'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2296'
git switch 'github-bot/gh-2296'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2296'
git switch 'github-bot/gh-2296'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2296'
git switch 'main'
git merge --squash 'github-bot/gh-2296'
git switch 'main'
git merge --ff-only 'github-bot/gh-2296'
git switch 'main'
git merge 'github-bot/gh-2296'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2296
No description provided.