Skip to content

[BUNDLE] GPU host copies, descriptors, sampler heaps and footprints: 5 PRs, #322 #982 #409 #474 #1206 (rebuilt on main 70564ae) - #1426

Open
MamaLeVrai wants to merge 12 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/gpu-fixes-2
Open

MamaLeVrai wants to merge 12 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/gpu-fixes-2

Conversation

@MamaLeVrai

@MamaLeVrai MamaLeVrai commented Nov 24, 2026 •

Copy link
Copy Markdown

One PR in place of 5. After main moved, this bundle keeps the 5 of its earlier 15 PRs that still merge; the left-out ones are listed below. The earlier description follows, and may mention PRs or measurements that no longer apply. Fifteen GPU PRs on host memory copies, upload buffers, adapter selection, descriptor tables, sampler heaps, texture footprints and root signature validation. Every head is merged unchanged onto main (70564ae, after the maintainer's 28 commits of Nov 24, 22:36 CET), and the result is built and tested together.

For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a [BUNDLE] PR. The re-verification commands are below, so one run covers all of it.

What is inside

PR Author Head Title
#322 jsthope b58d198d9 GPU: copy into title memory without asking for its region first
#982 chemokita13 b4abe5db6 GPU: pool upload buffers across command list resets
#409 ToxicmaggotRP 340499c44 GPU: match D3D12 copyable texture footprints
#474 nathanbzrr e34cb5396 GPU: sanitize CreateSamplerX LOD range, bias clamp, and invalid enum values
#1206 geiyiliyabumo ef0c3e944 GPU: validate null args in create_deserializer to prevent d3d12 AV and add root.rs tests

Changes made while bundling

No PR was edited, and there is no hand resolution: a PR that does not merge as it is, is left out (below).

Left out, and why

Rebuilt on the new main. The earlier version of this bundle had 15 PRs; 5 merge here in order, each checked with clippy as it went in.

Verification

Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 490 passed, 0 failed, 7 ignored (one run; main: 476 passed, 7 ignored)

The title was not run, so this says nothing about in-game effect. No game data is used or committed.

Re-verify in one go

git fetch https://github.com/MamaLeVrai/VIctory.git bundle/gpu-fixes-2
git checkout FETCH_HEAD
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked

To confirm that no component PR moved since this was built, compare each Head above with gh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, the branch needs a rebuild: merge the new head in the same order.

If this lands

The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

jsthope and others added 7 commits November 24, 2026 03:15
Two copies into title memory asked the host about the destination before
every copy. copy_mapped's own comment tells what that costs: asking
VirtualQuery about the source took about 2 ms per copy in the title's big
pools, because the query walks the page tables to the end of the region
with the same state, whatever the size of the copy.

- A list's copy into title memory checked that the whole destination was
  committed first, with VirtualQuery. The destinations were private pools
  of about 600 MiB.
- The copy-back of what shaders wrote used WriteProcessMemory, which asks
  for the destination's region before it writes: the same walk for every
  64 KiB piece.

Both now rely on the kernel copy the other copies already use
(ReadProcessMemory on our own process). It fails on a destination page
that is not mapped writable as it does on a source page it cannot read,
without faulting. A title destination is asked for its region only after
its copy has failed, which keeps the page retries (they write their zeros
themselves) off unmapped memory. write_mapped does what it did: mapped
pages are written, unmapped and read-only ones are not.

One difference: a title destination that was not all mapped used to be
left alone, and the bytes before its first unmapped page may now arrive
(the kernel copy stops at that page). No title copy of the run below had
such a destination, and none failed.

Measured in the world (first mission's intro; i7-13650HX, RTX 4060
Laptop, diagnostics build), with the old and the new call timed on the
same copies of one run, 41 frames of about 1.15 s each:

  title copies, 80 per frame (0.45 MB): the check alone 59.5 ms per
  frame; the whole copy now 0.56 ms
  copy-back, 110 pieces per frame (4.9 MB): 38.6 ms per frame; now
  0.55 ms

That is 98 ms of a frame (8.6 %) down to about 1 ms. In stacks of the
submitting thread sampled at 10 Hz, VirtualQuery under these two calls
was 47 of 462 samples before and 0 of 189 after.

Two tests run both copies against reserved memory with a committed block
on each side of a hole (no GPU, no game data).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Transient upload buffers allocated during list recording (buffer copies, large scratch allocations) were previously created as new committed resources on every copy and dropped on list reset. They are now retained in a host-wide pool upon HostList::reset (bounded to 32 buffers, aligned to D3D12 64 KiB placement granularity) and reused by subsequent uploads with matching or compatible capacities.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 17:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@sinan-cmyk

Copy link
Copy Markdown

Runtime boot check on real hardware with a retail dump

Result: no difference from main in this test.

I merged head 3fc262e onto main ffe310e (clean merge), built it (release), and ran victory run <title exe> --execute with an empty data folder for 100 s, without any input. I compared the run with main built and run the same way.

main ffe310e this PR
Reaches the first-boot screens yes yes
Caption at 100 s (one sample) 30 fps, 12 draws/frame 30 fps, 12 draws/frame
Frames presented 2,048 2,048
crashes.log entries 0 0
Committed memory 11.1 GB 11.1 GB

Warnings: 7, the same kinds as on main with one exception. The two 2560×1440 render targets that log "no host texture" (creation fails with 0x80070057) on main now log "host texture without a use the host refuses" and are dropped. That looks like the intended change.

Limits. Without input, the title stays on the first-boot screens. This run does not exercise saves, the intro video, the start screen, loading or the world. It shows only that the change does not break startup or the first menus on this machine. I did not run the PR's tests.

Machine: Ryzen 7 7800X3D, RTX 4070 SUPER, Windows 11 25H2, game 1.0.2.1. AI-assisted (Claude Code).

MamaLeVrai added a commit to MamaLeVrai/VIctory that referenced this pull request Nov 24, 2026
…erlaps with the GPU bundles

Marvisak#189 (wave64 on 32-lane hosts) and the GPU bundles Marvisak#1426 and Marvisak#1439 overlap
in three places:

- host.rs, where the host is built: Marvisak#208 (Marvisak#1426) logs the capabilities
  summary, Marvisak#189 chooses the Wave64 mode. Both lines are kept.
- host.rs, after the device helpers: Marvisak#208's adapter and capability probe and
  Marvisak#189's recommended_wave64_mode are two new functions at the same spot.
  Both are kept.
- shader_cache.rs: Marvisak#189 prefixes the translation input with a mode byte
  (input[33..]), Marvisak#358 (Marvisak#1439) records that a translation ran
  (self.translated). Both are kept; the two tests of Marvisak#358 that call
  cached() pass Wave64Mode::Native, as Marvisak#189's own tests do.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(725 passed, 11 ignored, two runs).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…ps, footprints) onto Marvisak#1418 + shader stack

Conflicts in crates/victory-gpu/src/descriptor/host.rs:
1. `dynamic`: the warning for a full dynamic-slot heap; Marvisak#1426 adds the free-slot
   counts (`free_space`, which it brings). Took Marvisak#1426's.
2. buffer SRV views off a host copy: the stack (Marvisak#704) clamps NumElements to what the
   host copy holds and refuses an empty view; Marvisak#1426 refuses a raw view whose first
   element is not on 16 bytes. Independent guards: both kept, clamp first. The UAV
   function, merged without conflict, already has both.
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…e, frame wait) onto Marvisak#1426 + Marvisak#1418 + shader stack

Conflict in crates/victory-gpu/src/pipeline/host.rs, mesh pipeline stream: the stack
only reformatted the blend and sample-mask subobjects; Marvisak#1439 passes the blend through
`host_blend(&g.blend, &g.targets)` (which it brings and already uses for the other
pipeline kinds). Took Marvisak#1439's blend, kept the formatting.
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…+ Marvisak#1418) + shader stack

No textual conflict; checked with cargo check --workspace --all-targets and the full
test suite (RTX, WARP, all features) when first merged on the previous Marvisak#1511
head (289f241); this replay with cargo check --workspace --all-targets
--all-features, and the full suite at the end of the line.
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…+ Marvisak#1418) + shader stack

No textual conflict; checked with cargo check --workspace --all-targets and the full
test suite (RTX, WARP, all features) when first merged on the previous Marvisak#1511
head (289f241); this replay with cargo check --workspace --all-targets
--all-features, and the full suite at the end of the line.
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…6B16A16_FLOAT) onto Marvisak#211 + Marvisak#1024 + Marvisak#346 + Marvisak#334 + integ/next

Conflicts, both in tests:
1. crates/victory-gpu/src/descriptor/host.rs: the stack's tests
   (`raw_views_start_on_16_bytes` and the raw/structured view tests after
   it, from Marvisak#1426/Marvisak#704) and Marvisak#492's four `rgb9e5_srv_*` tests at the same
   place; git interleaved them over shared lines (a resource description's
   `SampleDesc`, a closing brace), so the two hunks are not separable
   texts. Resolved by keeping the stack's tests exactly as they were and
   adding Marvisak#492's four tests whole, as Marvisak#492 has them, before
   `dynamic_slots_are_held_until_released` (where Marvisak#492 put them). The
   resulting diff of the file against the previous head equals Marvisak#492's own
   (+235/-5 against main).
2. crates/victory-gpu/src/resource.rs: the stack's
   `get_desc_reports_the_allocated_mip_chain` and Marvisak#492's
   `r9g9b9e5_target_format_substitutes_rgba16f` /
   `r9g9b9e5_render_target_and_uav_textures_create_on_host` at the end of
   the module. The shared text holds the `#[test]` before and the closing
   braces after: the stack's test is closed in the hunk and Marvisak#492's follow
   as separate tests (not nested).

The non-test changes (`target_format`, `fits` taking a resource
description, `fits_texture_srv`, RTV and pipeline formats) merged without
conflict. `fits` has no other caller in the stack. Uploads from title
memory still skip render-target/UAV textures (`texture::title_written`),
so no 4-byte RGB9E5 rows are detiled into a substituted 8-byte texture.
Known open point from the review, not fixed by Marvisak#492: a copy between a
substituted target and a sampled-only RGB9E5 texture would mismatch
formats on the host; no report shows the title doing that.
No non-textual fix needed (cargo check --all-targets --all-features).
@MamaLeVrai MamaLeVrai changed the title [BUNDLE] GPU host copies, descriptors, sampler heaps and footprints: 15 PRs, #202 #208 #322 #435 #982 #1217 #1283 #123 #251 #1032 #55 #409 #933 #474 #1206 [BUNDLE] GPU host copies, descriptors, sampler heaps and footprints: 5 PRs, #322 #982 #409 #474 #1206 (rebuilt on main 70564ae) Nov 24, 2026

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-gpu/src/host.rs, crates/victory-gpu/src/resource.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants