GPU: automatic texture mip-drop on E_OUTOFMEMORY and VICTORY_TEXTURE_MIP_DROP #1272

Open
github-bot wants to merge 3 commits from github-bot/gh-1272 into main AGit
Owner

@⁠ESAT586 on GitHub · 2026-11-24 16:59 UTC · original
ESAT586:gpu/auto-mip-drop → main · +1474 −97 · 5 files · 3 commits · open

AI Transparency Notice: This PR was authored, implemented, and hardware-tested by Gemini 4 Neon (High Mode) (an AI coding agent, not a human engineer), using zero game files or proprietary console SDK data.

Summary

Addresses #1226 and #737 by introducing automatic texture mip-drop recovery on E_OUTOFMEMORY alongside the opt-in VICTORY_TEXTURE_MIP_DROP (0..=3, default 0) quality switch, complete with end-to-end SRV re-basing, staging detile offsetting, and command-list subresource remapping/pruning so mip-dropped textures never invalidate host command lists.

On machines with sufficient VRAM/commit headroom (VICTORY_TEXTURE_MIP_DROP unset and no E_OUTOFMEMORY), mip_drop remains 0 and behavior is bit-identical to main. On 6 GB / 8 GB GPUs or 16 GB RAM hosts where world streaming hits E_OUTOFMEMORY (0x8007000E), the first failing pure-sampled texture automatically raises OOM_MIP_PRESSURE, drops top mip level(s), and retries instead of leaving a null host texture that causes device removal.

What Changed

  1. Mip-Drop Eligibility & Automatic OOM Retry (crates/victory-gpu/src/resource.rs)
    • compute_mip_drop: restricts mip dropping to pure sampled textures (dimension != BUFFER, flags & 0x7 == 0, sample_count <= 1, mip_count > 1), keeps a 64 px floor (avoiding the tiny/1×1 texture shrinkage issue observed in #737 testing), and verifies 4×4 block alignment for BC formats.
    • allocate_with_oom_retry: on E_OUTOFMEMORY, monotonically raises OOM_MIP_PRESSURE (up to MAX_MIP_DROP = 3), logs a warning, and retries CreateCommittedResource.
    • HostTexture: tracks title_mips, mip_drop, and is_3d, and exposes host_subresource(console_sub) -> Option<u32> for subresource remapping / dropped-mip pruning.
  2. Detiling & Staging Alignment (crates/victory-gpu/src/texture.rs)
    • Stores mip_drop on Staging and reads console mip host_mip + mip_drop during Staging::detile; staging footprints automatically shrink to match the host texture's reduced mip chain.
  3. Exact SRV Mip-Window Re-basing (crates/victory-gpu/src/descriptor/host.rs)
    • Adds rebase_mip_window and adjust_srv_for_mip_drop across Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture3D, TextureCube, and TextureCubeArray.
    • Correctly shrinks partial windows that straddle dropped top mips (e.g., 7-mip texture with drop = 2, guest {1,2,3} → host {0,1}), preserves u32::MAX, clamps all-dropped views to host mip 0, and shifts ResourceMinLODClamp.
  4. Command-List Copy & Resolve Remapping (crates/victory-gpu/src/list.rs)
    • copy_texture_region: remaps destination and texture-source subresources via host_subresource, pruning dead copies that target or read dropped top mips.
    • copy_resource: falls back to subresource-by-subresource CopyTextureRegion across overlapping surviving mips when source and destination have different mip-drop counts.
    • resolve: remaps dst_sub and src_sub, prunes dead resolves to dropped top mips, and compares per-mip extents rather than mip-0 extents.

Credits

Built on the design and real-hardware testing findings documented in #737 (antikohza, MichaelSmithAI, bittertea0323, DrDarkDK) and #1226 (Logan-Gaillard).

Verification

All checks run locally on Windows 11 with NVIDIA GeForce RTX 3060 Ti (Driver 32.0.16.1656), Rust 1.98.1 MSVC:

  • cargo clippy --workspace --all-targets --locked -- -D warnings — 0 warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — 0 warnings
  • cargo test -p victory-gpu --locked — 55 passed, 0 failed, 1 ignored
  • cargo test -p victory-gpu --all-features --locked — 58 passed, 0 failed, 1 ignored (including mip_dropped_texture_copy_and_srv_work_on_host_gpu end-to-end on RTX 3060 Ti, oom_retry_escalates_pressure_and_recovers, mip_drop_respects_constraints_and_bc_alignment, subresource_remapping_drops_top_mips_and_preserves_slices, and srv_mip_window_rebasing_handles_partial_full_and_dropped_ranges)
  • cargo xtask policy — 154 files ok
  • Not tested: live retail title run (no game files on this machine; synthetic unit + D3D12 hardware tests only).
**@⁠ESAT586** on GitHub · 2026-11-24 16:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272) `ESAT586:gpu/auto-mip-drop` → `main` · +1474 −97 · 5 files · 3 commits · open > **AI Transparency Notice:** This PR was authored, implemented, and hardware-tested by **Gemini 4 Neon (High Mode)** (an AI coding agent, not a human engineer), using **zero game files or proprietary console SDK data**. ## Summary Addresses #1226 and #737 by introducing **automatic texture mip-drop recovery on `E_OUTOFMEMORY`** alongside the opt-in `VICTORY_TEXTURE_MIP_DROP` (`0..=3`, default `0`) quality switch, complete with end-to-end SRV re-basing, staging detile offsetting, and command-list subresource remapping/pruning so mip-dropped textures never invalidate host command lists. On machines with sufficient VRAM/commit headroom (`VICTORY_TEXTURE_MIP_DROP` unset and no `E_OUTOFMEMORY`), `mip_drop` remains `0` and behavior is bit-identical to `main`. On 6 GB / 8 GB GPUs or 16 GB RAM hosts where world streaming hits `E_OUTOFMEMORY` (`0x8007000E`), the first failing pure-sampled texture automatically raises `OOM_MIP_PRESSURE`, drops top mip level(s), and retries instead of leaving a null host texture that causes device removal. ## What Changed 1. **Mip-Drop Eligibility & Automatic OOM Retry (`crates/victory-gpu/src/resource.rs`)** - `compute_mip_drop`: restricts mip dropping to pure sampled textures (`dimension != BUFFER`, `flags & 0x7 == 0`, `sample_count <= 1`, `mip_count > 1`), keeps a `64 px` floor (avoiding the tiny/1×1 texture shrinkage issue observed in #737 testing), and verifies 4×4 block alignment for BC formats. - `allocate_with_oom_retry`: on `E_OUTOFMEMORY`, monotonically raises `OOM_MIP_PRESSURE` (up to `MAX_MIP_DROP = 3`), logs a warning, and retries `CreateCommittedResource`. - `HostTexture`: tracks `title_mips`, `mip_drop`, and `is_3d`, and exposes `host_subresource(console_sub) -> Option<u32>` for subresource remapping / dropped-mip pruning. 2. **Detiling & Staging Alignment (`crates/victory-gpu/src/texture.rs`)** - Stores `mip_drop` on `Staging` and reads console mip `host_mip + mip_drop` during `Staging::detile`; staging footprints automatically shrink to match the host texture's reduced mip chain. 3. **Exact SRV Mip-Window Re-basing (`crates/victory-gpu/src/descriptor/host.rs`)** - Adds `rebase_mip_window` and `adjust_srv_for_mip_drop` across `Texture1D`, `Texture1DArray`, `Texture2D`, `Texture2DArray`, `Texture3D`, `TextureCube`, and `TextureCubeArray`. - Correctly shrinks partial windows that straddle dropped top mips (e.g., 7-mip texture with `drop = 2`, guest `{1,2,3}` → host `{0,1}`), preserves `u32::MAX`, clamps all-dropped views to host mip `0`, and shifts `ResourceMinLODClamp`. 4. **Command-List Copy & Resolve Remapping (`crates/victory-gpu/src/list.rs`)** - `copy_texture_region`: remaps destination and texture-source subresources via `host_subresource`, pruning dead copies that target or read dropped top mips. - `copy_resource`: falls back to subresource-by-subresource `CopyTextureRegion` across overlapping surviving mips when source and destination have different mip-drop counts. - `resolve`: remaps `dst_sub` and `src_sub`, prunes dead resolves to dropped top mips, and compares per-mip extents rather than mip-0 extents. ## Credits Built on the design and real-hardware testing findings documented in #737 (`antikohza`, `MichaelSmithAI`, `bittertea0323`, `DrDarkDK`) and #1226 (`Logan-Gaillard`). ## Verification All checks run locally on Windows 11 with **NVIDIA GeForce RTX 3060 Ti** (`Driver 32.0.16.1656`), Rust `1.98.1` MSVC: - `cargo clippy --workspace --all-targets --locked -- -D warnings` — **0 warnings** - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — **0 warnings** - `cargo test -p victory-gpu --locked` — **55 passed, 0 failed, 1 ignored** - `cargo test -p victory-gpu --all-features --locked` — **58 passed, 0 failed, 1 ignored** (including `mip_dropped_texture_copy_and_srv_work_on_host_gpu` end-to-end on RTX 3060 Ti, `oom_retry_escalates_pressure_and_recovers`, `mip_drop_respects_constraints_and_bc_alignment`, `subresource_remapping_drops_top_mips_and_preserves_slices`, and `srv_mip_window_rebasing_handles_partial_full_and_dropped_ranges`) - `cargo xtask policy` — **154 files ok** - **Not tested:** live retail title run (no game files on this machine; synthetic unit + D3D12 hardware tests only).
AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used.

Addresses #1226 and #737:
- Adds opt-in `VICTORY_TEXTURE_MIP_DROP` (0..=3, default 0) plus a monotonic
  process-wide `OOM_MIP_PRESSURE` level that automatically drops top mip levels
  and retries when `CreateCommittedResource` returns `E_OUTOFMEMORY` on pure
  sampled textures.
- Preserves exact native behavior (drop = 0) when memory is sufficient, and
  unconditionally exempts render targets, depth-stencil targets, UAVs, MSAA,
  buffers, single-mip textures, tiny textures (floor 64 px), and block-compressed
  extents that would violate 4x4 alignment.
- Updates `Staging::detile` (`texture.rs`) to offset console mip reads by
  `mip_drop`, saving matching staging upload memory.
- Re-bases explicit texture SRVs (`descriptor/host.rs`) across all texture view
  dimensions with exact partial-window clamping (retaining only the overlap
  between the guest view and surviving host mips) and `ResourceMinLODClamp`
  adjustment.
- Remaps subresources and prunes dead top-mip operations in `copy_resource`,
  `copy_texture_region`, and `resolve` (`list.rs`), comparing per-mip extents
  in `resolve` and copying overlapping surviving mips when `CopyResource` sees
  differing drop levels.
- Adds CPU unit tests plus an end-to-end host D3D12 hardware test verifying
  allocation, dropped-mip copy pruning, retained-mip remapping, and readback.
AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used.

Follow-up to in-game retail testing feedback on #1272 from @Logan-Gaillard:
- Queries the host D3D12 device's adapter `DedicatedVideoMemory` via
  `IDXGIFactory4::EnumAdapterByLuid` (`host.rs`) and host physical RAM via
  `GlobalMemoryStatusEx` (`resource.rs`).
- When `VICTORY_TEXTURE_MIP_DROP` is unset, proactively defaults to `drop = 1`
  before the first texture allocation on hosts with `<= 8 GiB` dedicated VRAM
  (including iGPUs) or `<= 16 GiB` physical RAM, while keeping `0` (native
  resolution) on higher-memory machines.
- Explicit `VICTORY_TEXTURE_MIP_DROP=0..=3` always overrides the proactive
  default, and reactive `E_OUTOFMEMORY` escalation remains active as a fallback.
- Adds `proactive_mip_drop_triggers_on_low_vram_or_low_ram` unit test.
Authored and verified by Gemini 4 Neon (High Mode, AI coding agent) with
zero game data.

Fixes the partial-copy texture ownership bug reported on #1272: when
`copy_resource()` performs a subresource-by-subresource fallback between
textures with differing mip-drop levels (e.g., src drop=2 -> dst drop=1),
marking the entire destination resource as `HOST_WRITTEN` previously
suppressed subsequent title-memory uploads of untouched upper mips on
the destination texture.

Changes:
- `crates/victory-gpu/src/texture.rs`: Track `HOST_WRITTEN` as either
  `HostWritten::All` (full-resource copy/resolve) or
  `HostWritten::Subresources(HashSet<u32>)` (partial copy), skipping
  upload only for subresources actually written by the host GPU while
  continuing to upload untouched subresources.
- `crates/victory-gpu/src/list.rs`: Call `texture::host_written(dst)`
  only on full-resource `CopyResource` paths, and call
  `texture::host_written_subresource(dst, dst_sub)` per copied host
  subresource in the cross-mip-drop fallback loop.
- `crates/victory-gpu/src/resource.rs`: Added
  `partial_copy_resource_preserves_untouched_mip_uploads`, verifying
  no-copy control, full-copy control, and partial-copy integrity
  (256x48 RGBA8 6-mip src drop=2 -> dst drop=1) via GPU readback on both
  NVIDIA GeForce RTX 3060 Ti and WARP.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:25:51 +00:00
Author
Owner

@⁠Logan-Gaillard on GitHub · 2026-11-24 17:22 UTC · original

Tested this head (dfd1bc4) in-game on the machine behind #1226, same route (retail 1.0.2.1
from SSD). The mechanism works, but it fires too late to save the world load — the same result I
measured with my own version of the reactive idea.

Run: RTX 5070 Laptop + Intel iGPU, 15.4 GB RAM, 24.8 GB pagefile, Windows 11, release build,
no environment variable set.

79 packs opened
INFO host: 9.4 fps, 106.4 ms/frame ... 15.0 fps, 66.7 ms/frame
WARN resource: no host texture error=E_OUTOFMEMORY (0x8007000E)   (x2)
ERROR host: a host command list did not close (0x8007000E)
VIctory: host GPU failure: ... device removed

Why it cannot work from the failure side. By the time CreateCommittedResource first returns
0x8007000E, the process is already against its commit ceiling (15.6 GB private on a 15.4 GB
machine, system commit at 38.3/38.3 GB in my measurements). Dropping one mip from the texture
that happened to fail buys nothing: the next 1024-wide texture fails too, and the run ends on the
same command list did not close. In my version of the reactive drop, the pressure level was
raised three times and 86 creations still failed afterwards.

What does work here: the same drop applied from the start of the run instead of on failure.
With drop = 1 decided up front (on this machine, #737's manual switch, and #1296's automatic
default) the load reaches world streaming with zero no host texture and zero
command list did not close.

Second point, independent of the drop: D3D12CreateDevice(None, ...) picks this laptop's
Intel iGPU (128 MiB dedicated), so host copies live in shared system memory. Choosing the adapter
with the most dedicated memory (or honouring the Windows per-app GPU preference) moves the run to
the RTX and changes the failure from an allocation error to a GPU fault much later in the
streaming. Worth having regardless of what the drop does.

So: right diagnosis, wrong moment. Making the level proactive (before the first allocation, from
the device's own adapter memory) is the part that reaches the world.

**@⁠Logan-Gaillard** on GitHub · 2026-11-24 17:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#issuecomment-7139104278) Tested this head (`dfd1bc4`) in-game on the machine behind #1226, same route (retail 1.0.2.1 from SSD). The mechanism works, but it fires too late to save the world load — the same result I measured with my own version of the reactive idea. **Run**: RTX 5070 Laptop + Intel iGPU, 15.4 GB RAM, 24.8 GB pagefile, Windows 11, release build, no environment variable set. ``` 79 packs opened INFO host: 9.4 fps, 106.4 ms/frame ... 15.0 fps, 66.7 ms/frame WARN resource: no host texture error=E_OUTOFMEMORY (0x8007000E) (x2) ERROR host: a host command list did not close (0x8007000E) VIctory: host GPU failure: ... device removed ``` **Why it cannot work from the failure side.** By the time `CreateCommittedResource` first returns `0x8007000E`, the process is already against its commit ceiling (15.6 GB private on a 15.4 GB machine, system commit at 38.3/38.3 GB in my measurements). Dropping one mip from the texture that happened to fail buys nothing: the next 1024-wide texture fails too, and the run ends on the same `command list did not close`. In my version of the reactive drop, the pressure level was raised three times and **86** creations still failed afterwards. **What does work here**: the same drop applied from the start of the run instead of on failure. With `drop = 1` decided up front (on this machine, #737's manual switch, and #1296's automatic default) the load reaches world streaming with **zero** `no host texture` and **zero** `command list did not close`. **Second point, independent of the drop**: `D3D12CreateDevice(None, ...)` picks this laptop's Intel iGPU (128 MiB dedicated), so host copies live in shared system memory. Choosing the adapter with the most dedicated memory (or honouring the Windows per-app GPU preference) moves the run to the RTX and changes the failure from an allocation error to a GPU fault much later in the streaming. Worth having regardless of what the drop does. So: right diagnosis, wrong moment. Making the level proactive (before the first allocation, from the device's own adapter memory) is the part that reaches the world.
Author
Owner

@⁠ESAT586 on GitHub · 2026-11-24 17:30 UTC · original

Thanks for the live retail test and measurements, @⁠Logan-Gaillard — that pinpoints the exact timing issue cleanly.

Updated this branch with a proactive default before the first texture allocation:

  • Queries the host D3D12 device's adapter DedicatedVideoMemory via IDXGIFactory4::EnumAdapterByLuid (crates/victory-gpu/src/host.rs) and physical RAM via GlobalMemoryStatusEx (crates/victory-gpu/src/resource.rs).
  • When VICTORY_TEXTURE_MIP_DROP is unset, proactively defaults to drop = 1 on hosts with <= 8 GiB dedicated VRAM (covering 6/8 GB GPUs and iGPUs) or <= 16 GiB physical RAM, and keeps 0 on > 8 GiB VRAM + > 16 GiB RAM machines.
  • Explicit VICTORY_TEXTURE_MIP_DROP=0..=3 overrides the proactive default (so =0 forces native resolution), while the reactive E_OUTOFMEMORY retry remains as a fallback safety net.
  • Re-verified locally on RTX 3060 Ti (cargo clippy --workspace --all-targets --locked -- -D warnings, --all-features, cargo test -p victory-gpu --all-features --locked: 59 passed / 0 failed, cargo xtask policy: ok).

(Authored and verified by Gemini 4 Neon — High Mode; synthetic tests only, no game data.)

**@⁠ESAT586** on GitHub · 2026-11-24 17:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#issuecomment-7139288080) Thanks for the live retail test and measurements, @⁠Logan-Gaillard — that pinpoints the exact timing issue cleanly. Updated this branch with a proactive default before the first texture allocation: - Queries the host D3D12 device's adapter `DedicatedVideoMemory` via `IDXGIFactory4::EnumAdapterByLuid` (`crates/victory-gpu/src/host.rs`) and physical RAM via `GlobalMemoryStatusEx` (`crates/victory-gpu/src/resource.rs`). - When `VICTORY_TEXTURE_MIP_DROP` is **unset**, proactively defaults to `drop = 1` on hosts with `<= 8 GiB` dedicated VRAM (covering 6/8 GB GPUs and iGPUs) or `<= 16 GiB` physical RAM, and keeps `0` on `> 8 GiB` VRAM + `> 16 GiB` RAM machines. - Explicit `VICTORY_TEXTURE_MIP_DROP=0..=3` overrides the proactive default (so `=0` forces native resolution), while the reactive `E_OUTOFMEMORY` retry remains as a fallback safety net. - Re-verified locally on RTX 3060 Ti (`cargo clippy --workspace --all-targets --locked -- -D warnings`, `--all-features`, `cargo test -p victory-gpu --all-features --locked`: 59 passed / 0 failed, `cargo xtask policy`: ok). *(Authored and verified by Gemini 4 Neon — High Mode; synthetic tests only, no game data.)*
Author
Owner

@⁠ESAT586 on GitHub · 2026-11-24 18:39 UTC · original

Thanks for the thorough review and exact reproduction, @⁠fladit123 — that caught a real subresource-ownership bug.

Fixed in the latest push on this branch:

  • crates/victory-gpu/src/texture.rs: Replaced resource-wide HOST_WRITTEN: HashSet<usize> with HashMap<usize, HostWritten> (HostWritten::All vs HostWritten::Subresources(HashSet<u32>)) so texture::upload() skips only subresources actually written by the host GPU while still uploading untouched upper mips.
  • crates/victory-gpu/src/list.rs: Moved texture::host_written(dst) onto the full-resource CopyResource paths only; the cross-mip-drop CopyTextureRegion fallback loop now records texture::host_written_subresource(dst, dst_sub) per copied host subresource.
  • crates/victory-gpu/src/resource.rs: Added partial_copy_resource_preserves_untouched_mip_uploads covering all three GPU readback controls (no-copy control, full-copy control, and 256x48 RGBA8 6-mip src drop=2 -> dst drop=1 partial-copy integrity: untouched guest mip 1 reads updated 0xC8 while copied guest mip 2 preserves GPU-copied 0x55).

Verified locally on Windows 11 with NVIDIA GeForce RTX 3060 Ti and WARP (VICTORY_D3D12_WARP=1):

  • cargo test -p victory-gpu --all-features --locked (RTX 3060 Ti): 60 passed, 0 failed
  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --locked partial_copy_resource_preserves_untouched_mip_uploads: 1 passed, 0 failed
  • cargo clippy --workspace --all-targets --locked -- -D warnings & --all-features: pass
  • cargo xtask policy: 154 files ok

(Authored and verified by Gemini 4 Neon — High Mode; synthetic tests only, zero game data.)

**@⁠ESAT586** on GitHub · 2026-11-24 18:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#issuecomment-7140958101) Thanks for the thorough review and exact reproduction, @⁠fladit123 — that caught a real subresource-ownership bug. Fixed in the latest push on this branch: - **`crates/victory-gpu/src/texture.rs`**: Replaced resource-wide `HOST_WRITTEN: HashSet<usize>` with `HashMap<usize, HostWritten>` (`HostWritten::All` vs `HostWritten::Subresources(HashSet<u32>)`) so `texture::upload()` skips only subresources actually written by the host GPU while still uploading untouched upper mips. - **`crates/victory-gpu/src/list.rs`**: Moved `texture::host_written(dst)` onto the full-resource `CopyResource` paths only; the cross-mip-drop `CopyTextureRegion` fallback loop now records `texture::host_written_subresource(dst, dst_sub)` per copied host subresource. - **`crates/victory-gpu/src/resource.rs`**: Added `partial_copy_resource_preserves_untouched_mip_uploads` covering all three GPU readback controls (no-copy control, full-copy control, and `256x48` RGBA8 6-mip `src drop=2 -> dst drop=1` partial-copy integrity: untouched guest mip 1 reads updated `0xC8` while copied guest mip 2 preserves GPU-copied `0x55`). Verified locally on Windows 11 with **NVIDIA GeForce RTX 3060 Ti** and **WARP** (`VICTORY_D3D12_WARP=1`): - `cargo test -p victory-gpu --all-features --locked` (RTX 3060 Ti): **60 passed, 0 failed** - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --locked partial_copy_resource_preserves_untouched_mip_uploads`: **1 passed, 0 failed** - `cargo clippy --workspace --all-targets --locked -- -D warnings` & `--all-features`: **pass** - `cargo xtask policy`: **154 files ok** *(Authored and verified by Gemini 4 Neon — High Mode; synthetic tests only, zero game data.)*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:20 UTC · original · edited 2026-11-25 16:03 UTC

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-gpu/src/descriptor/host.rs, crates/victory-gpu/src/list.rs, crates/victory-gpu/src/resource.rs, crates/victory-gpu/src/texture.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (needs-work) was for an older state of main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#issuecomment-7149449237) · edited 2026-11-25 16:03 UTC <!-- victory-triage v1 head=37b5b9394aeefdc31b1d1b4f8b52b90b053878d3 verdict=needs-rebase at=2026-11-25T16:01:00Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-gpu/src/descriptor/host.rs`, `crates/victory-gpu/src/list.rs`, `crates/victory-gpu/src/resource.rs`, `crates/victory-gpu/src/texture.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (needs-work) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠ESAT586 on GitHub · 2026-11-25 14:21 UTC · original

Rebased cleanly onto main (940d32f) at 37b5b93 (resolved the adjacent test conflict in crates/victory-gpu/src/descriptor/host.rs, keeping both dynamic_search_can_find_a_run_across_the_cursor and srv_mip_window_rebasing_handles_partial_full_and_dropped_ranges). Re-verified on RTX 3060 Ti + WARP: all mip-drop, proactive VRAM/RAM default, partial-copy, and SRV rebasing tests pass; strict Clippy (--all-targets and --all-features) clean; cargo xtask policy ok.

**@⁠ESAT586** on GitHub · 2026-11-25 14:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#issuecomment-7165142578) Rebased cleanly onto `main` (`940d32f`) at `37b5b93` (resolved the adjacent test conflict in `crates/victory-gpu/src/descriptor/host.rs`, keeping both `dynamic_search_can_find_a_run_across_the_cursor` and `srv_mip_window_rebasing_handles_partial_full_and_dropped_ranges`). Re-verified on RTX 3060 Ti + WARP: all mip-drop, proactive VRAM/RAM default, partial-copy, and SRV rebasing tests pass; strict Clippy (`--all-targets` and `--all-features`) clean; `cargo xtask policy` ok.
Author
Owner

@⁠fladit123 on GitHub · 2026-11-24 18:00 UTC · original · requested changes

Independent validation of 356d55f19f486fc8853b686e15c8436395b47997.

The OOM recovery mechanism is promising, but I found a blocking texture-content correctness issue that persists after the proactive mip-drop update.

Finding: partial CopyResource suppresses uploads of untouched destination subresources

In list.rs, copy_resource() calls texture::host_written(dst) before determining which subresources will actually be copied.

With different mip-drop levels, the fallback copies only overlapping surviving mips. However, texture.rs tracks HOST_WRITTEN at resource granularity, causing subsequent uploads of the entire destination texture to be skipped.

Synthetic reproduction

  • Source: 128×24, mip drop 2.
  • Destination: 256×48, mip drop 1.
  • CopyResource copies guest mips 2–5.
  • Guest mip 1 survives on the destination but is not written by the copy.
  • A subsequent upload is suppressed.
  • Readback of guest mip 1 returns stale 0xA4 instead of expected 0xC8.
  • All four copied mips contain the correct data.
Test RTX 4060 WARP
No-copy control PASS PASS
Full-copy control PASS PASS
Partial-copy integrity FAIL FAIL

Both backends reproduced the issue in separate processes. The controls distinguish this finding from the intended upload suppression following a full-resource copy.

Suggested change

Please ensure that partial copies preserve correct ownership and upload behavior for destination subresources that were not written, while retaining the contents of successfully copied subresources.

A regression test should verify both properties through GPU readback. Simply removing HOST_WRITTEN suppression entirely could overwrite valid GPU-written contents.

Environment

  • Windows 11, NVIDIA RTX 4060 8 GB, driver 610.88
  • Intel Core i5-12400F, 32 GB RAM
  • Rust 1.98.1 MSVC
  • Physical D3D12 adapter and WARP

Limitations: The focused validation used a zero-byte BCPack placeholder, with the original table excluded. The reproduction uses an additional synthetic test in an isolated worktree, not an unmodified full-workspace validation. No game files or proprietary console SDK data were used.

I have a standalone regression-test patch and supporting readback logs available.

AI use: OpenAI Codex assisted with test implementation and execution; ChatGPT (GPT-6.2) assisted with code review and reporting.

Requesting changes for the partial-copy correctness issue.

**@⁠fladit123** on GitHub · 2026-11-24 18:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#pullrequestreview-6044645471) · **requested changes** Independent validation of `356d55f19f486fc8853b686e15c8436395b47997`. The OOM recovery mechanism is promising, but I found a blocking texture-content correctness issue that persists after the proactive mip-drop update. **Finding: partial CopyResource suppresses uploads of untouched destination subresources** In `list.rs`, `copy_resource()` calls `texture::host_written(dst)` before determining which subresources will actually be copied. With different mip-drop levels, the fallback copies only overlapping surviving mips. However, `texture.rs` tracks HOST_WRITTEN at resource granularity, causing subsequent uploads of the entire destination texture to be skipped. **Synthetic reproduction** - Source: 128×24, mip drop 2. - Destination: 256×48, mip drop 1. - CopyResource copies guest mips 2–5. - Guest mip 1 survives on the destination but is not written by the copy. - A subsequent upload is suppressed. - Readback of guest mip 1 returns stale `0xA4` instead of expected `0xC8`. - All four copied mips contain the correct data. | Test | RTX 4060 | WARP | |---|---|---| | No-copy control | PASS | PASS | | Full-copy control | PASS | PASS | | Partial-copy integrity | FAIL | FAIL | Both backends reproduced the issue in separate processes. The controls distinguish this finding from the intended upload suppression following a full-resource copy. **Suggested change** Please ensure that partial copies preserve correct ownership and upload behavior for destination subresources that were not written, while retaining the contents of successfully copied subresources. A regression test should verify both properties through GPU readback. Simply removing HOST_WRITTEN suppression entirely could overwrite valid GPU-written contents. **Environment** - Windows 11, NVIDIA RTX 4060 8 GB, driver 610.88 - Intel Core i5-12400F, 32 GB RAM - Rust 1.98.1 MSVC - Physical D3D12 adapter and WARP **Limitations:** The focused validation used a zero-byte BCPack placeholder, with the original table excluded. The reproduction uses an additional synthetic test in an isolated worktree, not an unmodified full-workspace validation. No game files or proprietary console SDK data were used. I have a standalone regression-test patch and supporting readback logs available. **AI use:** OpenAI Codex assisted with test implementation and execution; ChatGPT (GPT-6.2) assisted with code review and reporting. Requesting changes for the partial-copy correctness issue.
Author
Owner

@⁠fladit123 on GitHub · 2026-11-24 19:30 UTC · original · approved these changes

Thanks for addressing the finding!

I independently revalidated ccd13f80949a36c9ca6c7c3b736724fd37cee3df using your new regression test on both the RTX 4060 and WARP, in separate processes.

Control RTX 4060 WARP
No-copy PASS PASS
Full-copy PASS PASS
Partial-copy PASS PASS

After the partial copy, the untouched mip correctly accepted 0xC8, while the copied mip retained 0x55.

Test-only instrumentation confirmed the active D3D12 adapter and prevented an early return if host initialization failed. All original readback assertions remained unchanged.

Limitations: The focused build used a zero-byte synthetic BCPack placeholder. Validation covered the first row of the sampled RGBA8 mips. The full workspace suite and retail titles were not tested.

My previously reported blocking finding is resolved. Approving with respect to that finding.

AI use: OpenAI Codex (GPT-6) assisted with local validation and reporting. ChatGPT (GPT-6.2) assisted with review and interpretation.

**@⁠fladit123** on GitHub · 2026-11-24 19:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#pullrequestreview-6045954927) · **approved these changes** Thanks for addressing the finding! I independently revalidated `ccd13f80949a36c9ca6c7c3b736724fd37cee3df` using your new regression test on both the RTX 4060 and WARP, in separate processes. | Control | RTX 4060 | WARP | |---|---|---| | No-copy | PASS | PASS | | Full-copy | PASS | PASS | | Partial-copy | PASS | PASS | After the partial copy, the untouched mip correctly accepted `0xC8`, while the copied mip retained `0x55`. Test-only instrumentation confirmed the active D3D12 adapter and prevented an early return if host initialization failed. All original readback assertions remained unchanged. **Limitations:** The focused build used a zero-byte synthetic BCPack placeholder. Validation covered the first row of the sampled RGBA8 mips. The full workspace suite and retail titles were not tested. My previously reported blocking finding is resolved. Approving with respect to that finding. **AI use:** OpenAI Codex (GPT-6) assisted with local validation and reporting. ChatGPT (GPT-6.2) assisted with review and interpretation.
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-26 14:21 UTC · original

Two things for the rebase onto current main (63bcca4). I tried merging 37b5b93 here: 13 conflict hunks in descriptor/host.rs, list.rs, resource.rs and texture.rs.

  • main now has a real texture-to-buffer read-back. copy_texture_region calls read_back(list, &dst, ..., &src, source_box) where this branch still has the "not implemented" warning. read_back (list.rs:816) gets the mip as src.footprint.offset % desc.MipLevels from the host texture's desc. With a mip drop the host has fewer levels than the title, so a read-back of a dropped-mip texture would read the wrong level. It needs the same host_subresource remapping as the copy paths (and should skip dropped top mips).
  • copy_resource on main now marks the destination with crate::texture::host_writes(list, dst) (per list) instead of host_written(dst). So the per-subresource HostWritten tracking here needs carrying over to the list-based version.

Also worth saying in the description: the proactive default turns mip drop on for every card with 8 GiB or less, and an RTX 4060 8 GB counts. That is what 8 GB players need (the 8 GB forks run with mip dropping on), but it changes the default look on those cards.

AI-assisted (Claude).

**@⁠potatoe0100** on GitHub · 2026-11-26 14:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1272#issuecomment-7194695249) Two things for the rebase onto current `main` (`63bcca4`). I tried merging `37b5b93` here: 13 conflict hunks in `descriptor/host.rs`, `list.rs`, `resource.rs` and `texture.rs`. - `main` now has a real texture-to-buffer read-back. `copy_texture_region` calls `read_back(list, &dst, ..., &src, source_box)` where this branch still has the "not implemented" warning. `read_back` (`list.rs:816`) gets the mip as `src.footprint.offset % desc.MipLevels` from the host texture's desc. With a mip drop the host has fewer levels than the title, so a read-back of a dropped-mip texture would read the wrong level. It needs the same `host_subresource` remapping as the copy paths (and should skip dropped top mips). - `copy_resource` on `main` now marks the destination with `crate::texture::host_writes(list, dst)` (per list) instead of `host_written(dst)`. So the per-subresource `HostWritten` tracking here needs carrying over to the list-based version. Also worth saying in the description: the proactive default turns mip drop on for every card with 8 GiB or less, and an RTX 4060 8 GB counts. That is what 8 GB players need (the 8 GB forks run with mip dropping on), but it changes the default look on those cards. AI-assisted (Claude).
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/list.rs
  • crates/victory-gpu/src/resource.rs
  • crates/victory-gpu/src/texture.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1272'
git switch 'github-bot/gh-1272'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1272'
git switch 'github-bot/gh-1272'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1272'
git switch 'main'
git merge --squash 'github-bot/gh-1272'
git switch 'main'
git merge --ff-only 'github-bot/gh-1272'
git switch 'main'
git merge 'github-bot/gh-1272'
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!1272
No description provided.