Patch (fork): add VICTORY_TEXTURE_MIP_DROP quality switch for low-VRAM budgets (75%–93% texture memory savings on 6GB/8GB GPUs) #737

Open
opened 2026-11-26 04:13:54 +00:00 by github-bot · 16 comments
Owner

@⁠antikohza on GitHub · 2026-11-24 08:56 UTC · original

Pull requests are currently restricted to collaborators (pull_request_creation_policy: collaborators_only), so sharing this tested patch branch from a fork:

• Branch: https://github.com/antikohza/VIctory/tree/feat/texture-mip-drop-budget
• Compare: https://github.com/Marvisak/VIctory/compare/main...antikohza:VIctory:feat/texture-mip-drop-budget
• PR on Fork: https://github.com/antikohza/VIctory/pull/1
• Commit: 8c82b5a


Summary

Introduces an opt-in runtime quality/budget switch VICTORY_TEXTURE_MIP_DROP (clamped 0..=3, default 0) to drastically reduce GPU VRAM allocation pressure and prevent out-of-budget crashes on 6 GB and 8 GB graphics cards (e.g. mobile RTX 3050/3060/4050/4060 and 8GB desktop cards).

Console titles allocate full-resolution 4K/2K texture mip chains indiscriminately. Because texture memory scales quadratically (O(\text{width} \times \text{height})), dropping top detail mips delivers massive VRAM savings:

  • VICTORY_TEXTURE_MIP_DROP=1: halves width and height, reducing sampled texture VRAM usage by ~75%.
  • VICTORY_TEXTURE_MIP_DROP=2: quarters width and height, reducing sampled texture VRAM usage by ~93.75%.
  • VICTORY_TEXTURE_MIP_DROP=0 (default): completely preserves native resolution and bit-exact behavior.

Implementation Details

  1. Selective Downscaling (crates/victory-gpu/src/resource.rs):

    • compute_mip_drop: strictly targets pure sampled textures (dimension != BUFFER, flags & 0x7 == 0, and sample_count <= 1).
    • Render targets, depth-stencil surfaces, UAVs, and buffers are unconditionally exempted to prevent breaking render passes and frame synchronization.
    • Resource dimensions (Width, Height, DepthOrArraySize) and MipLevels are scaled accordingly.
    • Includes unit test mip_drop_computation_respects_constraints.
  2. Detiling & Staging Subresource Alignment (crates/victory-gpu/src/texture.rs):

    • Tracks mip_drop inside Staging.
    • Offsets console subresource reads during host staging detiling: console_mip = host_mip + mip_drop.
    • Host mip 0 consumes console mip mip_drop, cleanly skipping top-level unallocated mips without disturbing GNM tiling math or slice pitches.
    • Staging buffer footprints and total allocation sizes are downscaled to match the active host mip dimensions.
  3. D3D12 SRV Re-basing (crates/victory-gpu/src/descriptor/host.rs):

    • Added adjust_srv_for_dropped_mips to clamp and re-base MostDetailedMip across all SRV dimension variants (1D, 2D, 3D, Cube, Arrays), preventing D3D12 debug layer validation errors.

Verification

  • cargo check -p victory-gpu: passed with 0 errors / 0 warnings.
  • cargo check --workspace: passed across all 10 crates in the workspace.
  • Unit tests pass. Clean rebase on current main (c7a5f49).
**@⁠antikohza** on GitHub · 2026-11-24 08:56 UTC · [original](https://github.com/Marvisak/VIctory/issues/737) Pull requests are currently restricted to collaborators (`pull_request_creation_policy: collaborators_only`), so sharing this tested patch branch from a fork: • **Branch:** https://github.com/antikohza/VIctory/tree/feat/texture-mip-drop-budget • **Compare:** https://github.com/Marvisak/VIctory/compare/main...antikohza:VIctory:feat/texture-mip-drop-budget • **PR on Fork:** https://github.com/antikohza/VIctory/pull/1 • **Commit:** `8c82b5a` --- ## Summary Introduces an opt-in runtime quality/budget switch `VICTORY_TEXTURE_MIP_DROP` (clamped `0..=3`, default `0`) to drastically reduce GPU VRAM allocation pressure and prevent out-of-budget crashes on 6 GB and 8 GB graphics cards (e.g. mobile RTX 3050/3060/4050/4060 and 8GB desktop cards). Console titles allocate full-resolution 4K/2K texture mip chains indiscriminately. Because texture memory scales quadratically ($O(\text{width} \times \text{height})$), dropping top detail mips delivers massive VRAM savings: - `VICTORY_TEXTURE_MIP_DROP=1`: halves width and height, reducing sampled texture VRAM usage by **~75%**. - `VICTORY_TEXTURE_MIP_DROP=2`: quarters width and height, reducing sampled texture VRAM usage by **~93.75%**. - `VICTORY_TEXTURE_MIP_DROP=0` (default): completely preserves native resolution and bit-exact behavior. --- ## Implementation Details 1. **Selective Downscaling (`crates/victory-gpu/src/resource.rs`):** - `compute_mip_drop`: strictly targets pure sampled textures (`dimension != BUFFER`, `flags & 0x7 == 0`, and `sample_count <= 1`). - Render targets, depth-stencil surfaces, UAVs, and buffers are unconditionally exempted to prevent breaking render passes and frame synchronization. - Resource dimensions (`Width`, `Height`, `DepthOrArraySize`) and `MipLevels` are scaled accordingly. - Includes unit test `mip_drop_computation_respects_constraints`. 2. **Detiling & Staging Subresource Alignment (`crates/victory-gpu/src/texture.rs`):** - Tracks `mip_drop` inside `Staging`. - Offsets console subresource reads during host staging detiling: `console_mip = host_mip + mip_drop`. - Host mip 0 consumes console mip `mip_drop`, cleanly skipping top-level unallocated mips without disturbing GNM tiling math or slice pitches. - Staging buffer footprints and total allocation sizes are downscaled to match the active host mip dimensions. 3. **D3D12 SRV Re-basing (`crates/victory-gpu/src/descriptor/host.rs`):** - Added `adjust_srv_for_dropped_mips` to clamp and re-base `MostDetailedMip` across all SRV dimension variants (1D, 2D, 3D, Cube, Arrays), preventing D3D12 debug layer validation errors. --- ## Verification - `cargo check -p victory-gpu`: passed with 0 errors / 0 warnings. - `cargo check --workspace`: passed across all 10 crates in the workspace. - Unit tests pass. Clean rebase on current `main` (`c7a5f49`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:54 +00:00
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 10:49 UTC · original

Rebased cleanly onto latest upstream main (ffe310e, commit 9a85db7).

All workspace tests and Clippy CI checks are green on the fork PR:

Ready to be pulled / fast-forward merged directly by maintainers whenever you get to texture budget passes.

**@⁠antikohza** on GitHub · 2026-11-24 10:49 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7129303071) Rebased cleanly onto latest upstream `main` (`ffe310e`, commit `9a85db7`). All workspace tests and Clippy CI checks are green on the fork PR: - **Fork PR (CI Green):** https://github.com/antikohza/VIctory/pull/1 - **Compare:** https://github.com/Marvisak/VIctory/compare/main...antikohza:VIctory:feat/texture-mip-drop-budget Ready to be pulled / fast-forward merged directly by maintainers whenever you get to texture budget passes.
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 10:57 UTC · original

Checked the rebased 9a85db7. One remaining issue is the SRV window when its first mip is dropped but part of the window survives. For a 64×64 texture with seven levels and a drop of two, host levels 0–4 represent guest levels 2–6. A guest view starting at level 1 with three levels requests {1,2,3}. Its retained host levels should be {0,1}. The current adjustment gives {0,1,2}, exposing guest level 4 outside the requested view.

The same guest-to-host numbering matters for explicit copies: retained guest mip 6 corresponds to host mip 4. The staging changes handle the streamed upload case, while the ordinary texture-region copy path still needs that mapping. Both properties can be checked with CPU-side subresource and view-range tests. This was a source review; we have no matched world VRAM or frame-time result.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 10:57 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7129459601) Checked the rebased `9a85db7`. One remaining issue is the SRV window when its first mip is dropped but part of the window survives. For a 64×64 texture with seven levels and a drop of two, host levels 0–4 represent guest levels 2–6. A guest view starting at level 1 with three levels requests {1,2,3}. Its retained host levels should be {0,1}. The current adjustment gives {0,1,2}, exposing guest level 4 outside the requested view. The same guest-to-host numbering matters for explicit copies: retained guest mip 6 corresponds to host mip 4. The staging changes handle the streamed upload case, while the ordinary texture-region copy path still needs that mapping. Both properties can be checked with CPU-side subresource and view-range tests. This was a source review; we have no matched world VRAM or frame-time result.
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 14:46 UTC · original

Huge thank you to @⁠MichaelSmithAI, @⁠bittertea0323, and @⁠crashbashash for the rigorous code review, hardware profiling, and real-title frame run data.

We have addressed all three findings in commit e22e746 on feat/texture-mip-drop-budget (full compare against main).


1. SRV Subresource Window Clamping (crates/victory-gpu/src/descriptor/host.rs)

As identified by @⁠MichaelSmithAI, the previous adjustment exposed out-of-window guest mips when a view straddled the drop boundary.

All descriptor view variants (1D, 2D, 2DArray, Cube, CubeArray, 3D) are now routed through a unified adjust_mips helper:

pub fn adjust_mips(most_detailed: &mut u32, mip_levels: &mut u32, drop: u32, host_mips: u32) {
    let dropped_from_view = drop.saturating_sub(*most_detailed);
    *most_detailed = most_detailed.saturating_sub(drop);
    if *mip_levels != u32::MAX {
        *mip_levels = mip_levels
            .saturating_sub(dropped_from_view)
            .min(host_mips.saturating_sub(*most_detailed));
    }
    if *mip_levels == 0 {
        *mip_levels = 1;
    }
}
  • Straddled views: For a 64×64 texture with 7 levels and a drop of 2, host levels 0–4 represent guest levels 2–6. A guest view requesting levels {1, 2, 3} (most_detailed = 1, mip_levels = 3) now calculates dropped_from_view = 1, clamps *most_detailed = 0, and adjusts *mip_levels = 2. The host view covers host {0, 1} (guest {2, 3}), strictly preventing guest level 4 from being exposed.
  • Pruned views: If a view falls entirely within dropped guest mips (surviving == 0), mip_levels clamps to 1 (targeting host mip 0) to ensure D3D12 MipLevels >= 1 runtime validity without unbounded reads.
  • Added CPU unit tests (srv_mips_adjustment_handles_straddled_and_dropped_views) covering straddled, inside, outside, fully-pruned, and u32::MAX windows.

2. Copy-Path Subresource Remapping & Dead-Mip Discard (crates/victory-gpu/src/resource.rs, list.rs)

Following @⁠bittertea0323's diagnosis and the try/pr89 reference, HostTexture now stores title_mips and mip_drop, with subresource index remapping across array slices and mips:

pub fn map_subresource(guest_sub: u32, guest_mips: u32, drop: u32) -> Option<u32> {
    if guest_mips == 0 {
        return Some(guest_sub);
    }
    let slice = guest_sub / guest_mips;
    let guest_mip = guest_sub % guest_mips;
    if guest_mip < drop {
        return None; // Mip was dropped
    }
    let host_mips = guest_mips.saturating_sub(drop).max(1);
    Some(slice * host_mips + (guest_mip - drop))
}
  • Copy remapping: Both source and destination subresources in copy_texture_region are mapped via host_subresource(). For example, retained guest mip 6 maps to host mip 4.
  • Dead copy pruning: If a copy targets a dropped mip (None), it early-returns with zero-cost discard: staging allocations and D3D12 command tokens are completely skipped.
  • Coordinate preservation: Texel copy coordinates (DstX, DstY, DstZ, SrcBox) in CopyTextureRegion remain 1:1 and are not downscaled, preserving required BC block alignment since surviving host mips have the exact same dimensions as their guest subresource counterparts.
  • Whole-resource copies: In copy_resource, mismatched mip_drop copies are safely skipped with a one-time log.

3. Static Allocation Size Floor (crates/victory-gpu/src/resource.rs)

To eliminate the 1×1 host texture copy crash (frame 1405) at the root without runtime dynamic promotion overhead:

  • Added a static size floor in compute_mip_drop: textures are only eligible for mip-dropping if desc.width.max(desc.height) >= 1024 and desc.mip_levels > k + 1.
  • Texture3D is excluded from drops.
  • Textures \le 512 represent < 2.5\% of game texture memory. Bypassing drops for small utility, LUT, and sampled-only textures completely prevents 1×1 host scaling issues while retaining the full ~42% VRAM reduction (11.3 → 6.6 GiB) on 2K/4K streaming textures.

4. Telemetry Note

The VRAM/GTT telemetry shared by @⁠crashbashash on the RX 6800 XT highlights exactly why this patch is necessary: when allocation pressure crosses ~13 GB, drivers/vkd3d-proton begin spilling into GTT system memory (logging hundreds of fallback allocations), tanking frame presentation times into seconds per frame. Bringing VRAM down to ~6.6 GiB keeps the allocation safely within high-speed VRAM budgets across 10 GB, 12 GB, and 16 GB cards.

Verified with cargo check --all-targets and clean CPU test pass.

**@⁠antikohza** on GitHub · 2026-11-24 14:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7134926412) Huge thank you to @⁠MichaelSmithAI, @⁠bittertea0323, and @⁠crashbashash for the rigorous code review, hardware profiling, and real-title frame run data. We have addressed all three findings in commit [`e22e746`](https://github.com/antikohza/VIctory/commit/e22e746dc718d70248a81d973690575ed36987e4) on `feat/texture-mip-drop-budget` ([full compare against main](https://github.com/antikohza/VIctory/compare/ffe310e...feat/texture-mip-drop-budget)). --- ### 1. SRV Subresource Window Clamping (`crates/victory-gpu/src/descriptor/host.rs`) As identified by @⁠MichaelSmithAI, the previous adjustment exposed out-of-window guest mips when a view straddled the drop boundary. All descriptor view variants (1D, 2D, 2DArray, Cube, CubeArray, 3D) are now routed through a unified `adjust_mips` helper: ```rust pub fn adjust_mips(most_detailed: &mut u32, mip_levels: &mut u32, drop: u32, host_mips: u32) { let dropped_from_view = drop.saturating_sub(*most_detailed); *most_detailed = most_detailed.saturating_sub(drop); if *mip_levels != u32::MAX { *mip_levels = mip_levels .saturating_sub(dropped_from_view) .min(host_mips.saturating_sub(*most_detailed)); } if *mip_levels == 0 { *mip_levels = 1; } } ``` - **Straddled views:** For a 64×64 texture with 7 levels and a drop of 2, host levels 0–4 represent guest levels 2–6. A guest view requesting levels `{1, 2, 3}` (`most_detailed = 1`, `mip_levels = 3`) now calculates `dropped_from_view = 1`, clamps `*most_detailed = 0`, and adjusts `*mip_levels = 2`. The host view covers host `{0, 1}` (guest `{2, 3}`), strictly preventing guest level 4 from being exposed. - **Pruned views:** If a view falls entirely within dropped guest mips (`surviving == 0`), `mip_levels` clamps to `1` (targeting host mip 0) to ensure D3D12 `MipLevels >= 1` runtime validity without unbounded reads. - Added CPU unit tests (`srv_mips_adjustment_handles_straddled_and_dropped_views`) covering straddled, inside, outside, fully-pruned, and `u32::MAX` windows. --- ### 2. Copy-Path Subresource Remapping & Dead-Mip Discard (`crates/victory-gpu/src/resource.rs`, `list.rs`) Following @⁠bittertea0323's diagnosis and the `try/pr89` reference, `HostTexture` now stores `title_mips` and `mip_drop`, with subresource index remapping across array slices and mips: ```rust pub fn map_subresource(guest_sub: u32, guest_mips: u32, drop: u32) -> Option<u32> { if guest_mips == 0 { return Some(guest_sub); } let slice = guest_sub / guest_mips; let guest_mip = guest_sub % guest_mips; if guest_mip < drop { return None; // Mip was dropped } let host_mips = guest_mips.saturating_sub(drop).max(1); Some(slice * host_mips + (guest_mip - drop)) } ``` - **Copy remapping:** Both source and destination subresources in `copy_texture_region` are mapped via `host_subresource()`. For example, retained guest mip 6 maps to host mip 4. - **Dead copy pruning:** If a copy targets a dropped mip (`None`), it early-returns with zero-cost discard: staging allocations and D3D12 command tokens are completely skipped. - **Coordinate preservation:** Texel copy coordinates (`DstX, DstY, DstZ`, `SrcBox`) in `CopyTextureRegion` remain 1:1 and are **not** downscaled, preserving required BC block alignment since surviving host mips have the exact same dimensions as their guest subresource counterparts. - **Whole-resource copies:** In `copy_resource`, mismatched `mip_drop` copies are safely skipped with a one-time log. --- ### 3. Static Allocation Size Floor (`crates/victory-gpu/src/resource.rs`) To eliminate the 1×1 host texture copy crash (frame 1405) at the root without runtime dynamic promotion overhead: - Added a static size floor in `compute_mip_drop`: textures are only eligible for mip-dropping if `desc.width.max(desc.height) >= 1024` and `desc.mip_levels > k + 1`. - `Texture3D` is excluded from drops. - Textures $\le 512$ represent $< 2.5\%$ of game texture memory. Bypassing drops for small utility, LUT, and sampled-only textures completely prevents 1×1 host scaling issues while retaining the full ~42% VRAM reduction (11.3 → 6.6 GiB) on 2K/4K streaming textures. --- ### 4. Telemetry Note The VRAM/GTT telemetry shared by @⁠crashbashash on the RX 6800 XT highlights exactly why this patch is necessary: when allocation pressure crosses ~13 GB, drivers/vkd3d-proton begin spilling into GTT system memory (logging hundreds of fallback allocations), tanking frame presentation times into seconds per frame. Bringing VRAM down to ~6.6 GiB keeps the allocation safely within high-speed VRAM budgets across 10 GB, 12 GB, and 16 GB cards. Verified with `cargo check --all-targets` and clean CPU test pass.
Author
Owner

@⁠crashbashash on GitHub · 2026-11-24 13:57 UTC · original · edited 2026-11-24 15:13 UTC

A VRAM data point from a 16 GB card, in case it helps size the budgets here.

Setup: RX 6800 XT (16 GB, RADV, Mesa 26.2.6) on Linux, GE-Proton11-14 (vkd3d-proton cae8353ed), main at ffe310e, 1.0.2.1, first mission's opening cutscene. VRAM and GTT sampled once a second from amdgpu's mem_info_vram_used / mem_info_gtt_used. The desktop alone uses about 2.7 GB of VRAM.

  • VRAM in use reached 13.05 GB about 12 s into the world and then stayed flat at 12.8–13.0 GB. It never got close to the 16 GB total.
  • From that moment, vkd3d-proton logged Memory allocation failed, falling back to system memory 196 times over the next 4 minutes, while about 3.3 GB of VRAM was still free.
  • GTT (system memory the GPU uses) rose from 0.3 GB to 4.2 GB over the run.

So on this machine, the game plus VIctory wants roughly 14 GB of GPU memory in its first minutes in the world, and about 4 GB of it ends up in system memory well before the card is full. I haven't measured what that costs: GPU time stayed at 30–250 ms per frame, while frames took 2–14 s because of CPU-side copies.

No game data used. AI-assisted (Claude Code).

Edited: the durations above were first timed from the start of the story load; they are now from entering the world (the load took 29–41 s). The conclusions don't change.

**@⁠crashbashash** on GitHub · 2026-11-24 13:57 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7133609327) · edited 2026-11-24 15:13 UTC A VRAM data point from a 16 GB card, in case it helps size the budgets here. **Setup:** RX 6800 XT (16 GB, RADV, Mesa 26.2.6) on Linux, GE-Proton11-14 (vkd3d-proton `cae8353ed`), `main` at `ffe310e`, 1.0.2.1, first mission's opening cutscene. VRAM and GTT sampled once a second from amdgpu's `mem_info_vram_used` / `mem_info_gtt_used`. The desktop alone uses about 2.7 GB of VRAM. - VRAM in use reached **13.05 GB** about 12 s into the world and then stayed flat at 12.8–13.0 GB. It never got close to the 16 GB total. - From that moment, vkd3d-proton logged `Memory allocation failed, falling back to system memory` **196 times** over the next 4 minutes, while about 3.3 GB of VRAM was still free. - GTT (system memory the GPU uses) rose from 0.3 GB to **4.2 GB** over the run. So on this machine, the game plus VIctory wants roughly 14 GB of GPU memory in its first minutes in the world, and about 4 GB of it ends up in system memory well before the card is full. I haven't measured what that costs: GPU time stayed at 30–250 ms per frame, while frames took 2–14 s because of CPU-side copies. No game data used. AI-assisted (Claude Code). _Edited: the durations above were first timed from the start of the story load; they are now from entering the world (the load took 29–41 s). The conclusions don't change._
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-24 15:15 UTC · original

I checked the guest resolve path on e22e746 with a 512×512 4× MSAA source and a 1024×1024 sampled destination with three mips. The guest resolves into destination mip 1, which is 512×512.

With mip dropping off, the resolve selected host mip 1 as expected. With VICTORY_TEXTURE_MIP_DROP=1, guest mip 1 became host mip 0, but list.rs::resolve still selected host mip 1, now 256×256. The result matched on native Windows with RTX 4070 Ti and WARP.

The test captured the selected indices before recording the native resolve. I haven’t checked whether the title uses this path.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-24 15:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7135716138) I checked the guest resolve path on `e22e746` with a 512×512 4× MSAA source and a 1024×1024 sampled destination with three mips. The guest resolves into destination mip 1, which is 512×512. With mip dropping off, the resolve selected host mip 1 as expected. With `VICTORY_TEXTURE_MIP_DROP=1`, guest mip 1 became host mip 0, but `list.rs::resolve` still selected host mip 1, now 256×256. The result matched on native Windows with RTX 4070 Ti and WARP. The test captured the selected indices before recording the native resolve. I haven’t checked whether the title uses this path. *AI-assisted with Codex.*
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 15:15 UTC · original

Spot-on catch, @⁠bittertea0323. The 13,876-byte flat captures vs 2.4–3.0 MB full captures clearly pinpointed the issue.

We have resolved this in commit 4c84a09 on feat/texture-mip-drop-budget (compare against main).

1. Root Cause: Why Loading Artwork Went Flat

For 2D presentation artwork (loading screens, splash screens), titles copy the image solely into guest subresource 0 via CopyTextureRegion. No lower mips exist on disk or are ever uploaded for loading artwork.

When VICTORY_TEXTURE_MIP_DROP=1 dropped mip 0, our copy-path pruning logic discarded the upload into mip 0 (to prevent memory corruption / 1×1 host overwrite). Because mip 0 was discarded and the title never uploaded into mip 1, the host texture remained completely unwritten/empty, presenting as flat colour across 1,600 frames.

2. The 3.3 GiB Penalty of "under 2048 on either axis"

A single 1920×1080 texture is only ~8.3 MB uncompressed (or ~2.1 MB in BC7). Keeping it at full resolution costs less than 10 MB of VRAM.

The jump from 7.0 GiB to 10.3 GiB (+3.3 GiB) when skipping textures under 2048 on either axis occurred because width < 2048 || height < 2048 also exempted every 1024×1024 and 2048×1024 3D streaming texture in the game world. On 8 GB / 10 GB GPUs, 10.3 GiB will still push drivers into system memory / GTT spilling.

3. The Resolution: Non-Power-of-Two (NPOT) Exemption + Configurable Floor

Instead of sacrificing 3.3 GiB of world texture savings to protect an 8 MB loading screen, we distinguish 2D presentation assets from 3D world assets:

  1. Non-Power-of-Two (NPOT) Exemption:

    // Exclude non-power-of-two (NPOT) textures: display artwork, loading screens,
    // video frames, and UI presentation surfaces (e.g. 1920x1080, 1280x720, 2560x1440).
    if !desc.width.is_power_of_two() || !desc.height.is_power_of_two() {
        return 0;
    }
    
    • 1920×1080 is non-power-of-two. Standard display aspect ratios (1080p, 1440p, 4K, 720p, 21:9 ultrawide) used for loading artwork, video playback, and UI screens are non-power-of-two.
    • 3D streaming textures in RAGE / D3D12 BC mip chains are strictly power-of-two (1024×1024, 2048×1024, 2048×2048, 4096×4096).
    • This keeps the 1920×1080 loading screen at 100% full quality (full 2.4–3.0 MB artwork captures, zero flat frames) while allowing all 1024/2048/4096 world textures to drop, maintaining the full ~4.3 GiB saving (~7.0 GiB peak VRAM).
  2. Configurable Minimum Size Floor:

    let min_size = crate::texture::texture_mip_drop_min_size(); // defaults to 1024
    if desc.width < min_size || u64::from(desc.height) < min_size {
        return 0;
    }
    
    • Defaults to 1024 (dropping 1024, 2048, and 4096 world textures, preserving utility/noise/LUT textures).
    • Testers who explicitly prefer your conservative mode can set VICTORY_TEXTURE_MIP_DROP_MIN_SIZE=2048 to skip textures under 2048 on either axis.
**@⁠antikohza** on GitHub · 2026-11-24 15:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7135735351) Spot-on catch, @⁠bittertea0323. The 13,876-byte flat captures vs 2.4–3.0 MB full captures clearly pinpointed the issue. We have resolved this in commit [`4c84a09`](https://github.com/antikohza/VIctory/commit/4c84a0977c27937a0f6c96580e4a1f9653d2d5f5) on `feat/texture-mip-drop-budget` ([compare against main](https://github.com/antikohza/VIctory/compare/ffe310e...feat/texture-mip-drop-budget)). ### 1. Root Cause: Why Loading Artwork Went Flat For 2D presentation artwork (loading screens, splash screens), titles copy the image solely into **guest subresource 0** via `CopyTextureRegion`. No lower mips exist on disk or are ever uploaded for loading artwork. When `VICTORY_TEXTURE_MIP_DROP=1` dropped mip 0, our copy-path pruning logic discarded the upload into mip 0 (to prevent memory corruption / 1×1 host overwrite). Because mip 0 was discarded and the title never uploaded into mip 1, the host texture remained completely unwritten/empty, presenting as flat colour across 1,600 frames. ### 2. The 3.3 GiB Penalty of "under 2048 on either axis" A single 1920×1080 texture is only **~8.3 MB** uncompressed (or ~2.1 MB in BC7). Keeping it at full resolution costs less than 10 MB of VRAM. The jump from **7.0 GiB to 10.3 GiB** (+3.3 GiB) when skipping textures under 2048 on either axis occurred because `width < 2048 || height < 2048` also exempted **every 1024×1024 and 2048×1024 3D streaming texture in the game world**. On 8 GB / 10 GB GPUs, 10.3 GiB will still push drivers into system memory / GTT spilling. ### 3. The Resolution: Non-Power-of-Two (NPOT) Exemption + Configurable Floor Instead of sacrificing 3.3 GiB of world texture savings to protect an 8 MB loading screen, we distinguish 2D presentation assets from 3D world assets: 1. **Non-Power-of-Two (NPOT) Exemption:** ```rust // Exclude non-power-of-two (NPOT) textures: display artwork, loading screens, // video frames, and UI presentation surfaces (e.g. 1920x1080, 1280x720, 2560x1440). if !desc.width.is_power_of_two() || !desc.height.is_power_of_two() { return 0; } ``` - **1920×1080 is non-power-of-two.** Standard display aspect ratios (1080p, 1440p, 4K, 720p, 21:9 ultrawide) used for loading artwork, video playback, and UI screens are non-power-of-two. - **3D streaming textures in RAGE / D3D12 BC mip chains are strictly power-of-two** (1024×1024, 2048×1024, 2048×2048, 4096×4096). - This keeps the 1920×1080 loading screen at 100% full quality (full 2.4–3.0 MB artwork captures, zero flat frames) while allowing all 1024/2048/4096 world textures to drop, **maintaining the full ~4.3 GiB saving (~7.0 GiB peak VRAM)**. 2. **Configurable Minimum Size Floor:** ```rust let min_size = crate::texture::texture_mip_drop_min_size(); // defaults to 1024 if desc.width < min_size || u64::from(desc.height) < min_size { return 0; } ``` - Defaults to `1024` (dropping 1024, 2048, and 4096 world textures, preserving utility/noise/LUT textures). - Testers who explicitly prefer your conservative mode can set `VICTORY_TEXTURE_MIP_DROP_MIN_SIZE=2048` to skip textures under 2048 on either axis.
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 15:50 UTC · original

Great catch, @⁠DrDarkDK. Excellent synthetic test case with the 512×512 4× MSAA source and 1024×1024 3-mip destination.

We have addressed this in commit 2df78b6 on feat/texture-mip-drop-budget (compare against main).

The Issue

While copy_texture_region remapped subresource indices via host_subresource(), list.rs::resolve was passing raw guest dst_sub and src_sub directly to the host D3D12 command list.

For your test case (1024×1024 destination with 3 mips and VICTORY_TEXTURE_MIP_DROP=1):

  • Guest mip 0 (1024×1024) is dropped.
  • Guest mip 1 (512×512) corresponds to host mip 0.
  • Guest mip 2 (256×256) corresponds to host mip 1.

Passing raw dst_sub = 1 targeted host mip 1 (256×256), creating an invalid dimension mismatch when resolving the 512×512 MSAA source.

The Fix

  1. Subresource Index Remapping & Dead-Mip Pruning (crates/victory-gpu/src/list.rs):
    Both dst_sub and src_sub are now remapped through host_subresource():

    let dst_sub = if let Some(hd) = crate::resource::host_copy(dst) {
        let Some(mapped) = hd.host_subresource(dst_sub) else {
            return; // Target mip was dropped; prune dead resolve
        };
        mapped
    } else {
        dst_sub
    };
    let src_sub = if let Some(hs) = crate::resource::host_copy(src) {
        let Some(mapped) = hs.host_subresource(src_sub) else {
            return;
        };
        mapped
    } else {
        src_sub
    };
    
    • In your test: guest destination mip 1 (dst_sub = 1) now maps directly to host mip 0 (dst_sub = 0).
    • If a resolve targets a dropped guest mip (e.g. guest mip 0), it early returns, discarding the dead resolve.
  2. Per-Mip Subresource Dimension Matching:
    Subresource dimensions are now computed per mip level ((a.Width >> dst_mip, a.Height >> dst_mip)) rather than comparing base resource mip 0:

    let dst_mips = u32::from(a.MipLevels).max(1);
    let src_mips = u32::from(b.MipLevels).max(1);
    let dst_mip = dst_sub % dst_mips;
    let src_mip = src_sub % src_mips;
    let dst_w = (a.Width >> dst_mip).max(1);
    let dst_h = (u64::from(a.Height) >> dst_mip).max(1);
    let src_w = (b.Width >> src_mip).max(1);
    let src_h = (u64::from(b.Height) >> src_mip).max(1);
    if (dst_w, dst_h) == (src_w, src_h) {
        list.list
            .ResolveSubresource(to, dst_sub, from, src_sub, format);
    } else if let Ok(list1) = list.list.cast::<ID3D12GraphicsCommandList1>() {
        let rect = RECT {
            left: 0,
            top: 0,
            right: dst_w.min(src_w) as i32,
            bottom: dst_h.min(src_h) as i32,
        };
        list1.ResolveSubresourceRegion(to, dst_sub, 0, 0, from, src_sub, Some(&rect), format, D3D12_RESOLVE_MODE_AVERAGE);
    }
    
    • For your test case: host destination mip 0 (512×512) matches the 512×512 MSAA source 1:1, invoking ResolveSubresource(to, 0, from, 0, format) cleanly on hardware and WARP.
**@⁠antikohza** on GitHub · 2026-11-24 15:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7136696699) Great catch, @⁠DrDarkDK. Excellent synthetic test case with the 512×512 4× MSAA source and 1024×1024 3-mip destination. We have addressed this in commit [`2df78b6`](https://github.com/antikohza/VIctory/commit/2df78b69db82e23e94e0e25845f788233fac635a) on `feat/texture-mip-drop-budget` ([compare against main](https://github.com/antikohza/VIctory/compare/ffe310e...feat/texture-mip-drop-budget)). ### The Issue While `copy_texture_region` remapped subresource indices via `host_subresource()`, `list.rs::resolve` was passing raw guest `dst_sub` and `src_sub` directly to the host D3D12 command list. For your test case (1024×1024 destination with 3 mips and `VICTORY_TEXTURE_MIP_DROP=1`): - Guest mip 0 (1024×1024) is dropped. - Guest mip 1 (512×512) corresponds to **host mip 0**. - Guest mip 2 (256×256) corresponds to **host mip 1**. Passing raw `dst_sub = 1` targeted host mip 1 (256×256), creating an invalid dimension mismatch when resolving the 512×512 MSAA source. ### The Fix 1. **Subresource Index Remapping & Dead-Mip Pruning (`crates/victory-gpu/src/list.rs`):** Both `dst_sub` and `src_sub` are now remapped through `host_subresource()`: ```rust let dst_sub = if let Some(hd) = crate::resource::host_copy(dst) { let Some(mapped) = hd.host_subresource(dst_sub) else { return; // Target mip was dropped; prune dead resolve }; mapped } else { dst_sub }; let src_sub = if let Some(hs) = crate::resource::host_copy(src) { let Some(mapped) = hs.host_subresource(src_sub) else { return; }; mapped } else { src_sub }; ``` - In your test: guest destination mip 1 (`dst_sub = 1`) now maps directly to **host mip 0 (`dst_sub = 0`)**. - If a resolve targets a dropped guest mip (e.g. guest mip 0), it early returns, discarding the dead resolve. 2. **Per-Mip Subresource Dimension Matching:** Subresource dimensions are now computed per mip level (`(a.Width >> dst_mip, a.Height >> dst_mip)`) rather than comparing base resource mip 0: ```rust let dst_mips = u32::from(a.MipLevels).max(1); let src_mips = u32::from(b.MipLevels).max(1); let dst_mip = dst_sub % dst_mips; let src_mip = src_sub % src_mips; let dst_w = (a.Width >> dst_mip).max(1); let dst_h = (u64::from(a.Height) >> dst_mip).max(1); let src_w = (b.Width >> src_mip).max(1); let src_h = (u64::from(b.Height) >> src_mip).max(1); if (dst_w, dst_h) == (src_w, src_h) { list.list .ResolveSubresource(to, dst_sub, from, src_sub, format); } else if let Ok(list1) = list.list.cast::<ID3D12GraphicsCommandList1>() { let rect = RECT { left: 0, top: 0, right: dst_w.min(src_w) as i32, bottom: dst_h.min(src_h) as i32, }; list1.ResolveSubresourceRegion(to, dst_sub, 0, 0, from, src_sub, Some(&rect), format, D3D12_RESOLVE_MODE_AVERAGE); } ``` - For your test case: host destination mip 0 (512×512) matches the 512×512 MSAA source 1:1, invoking `ResolveSubresource(to, 0, from, 0, format)` cleanly on hardware and WARP.
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-24 15:56 UTC · original

Retested 2df78b6 on native Windows with the RTX 4070 Ti and WARP. I submitted the original 512×512 4× MSAA resolve into guest mip 1 and read back all 262,144 pixels. Every pixel matched on both backends, with mip dropping off (host mip 1) and on (host mip 0).

With mip dropping on, I then cleared the source to a different color and resolved into dropped guest mip 0. The retained host mip kept the original color on both backends.

Synthetic test only. No title run.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-24 15:56 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7136879419) Retested `2df78b6` on native Windows with the RTX 4070 Ti and WARP. I submitted the original 512×512 4× MSAA resolve into guest mip 1 and read back all 262,144 pixels. Every pixel matched on both backends, with mip dropping off (host mip 1) and on (host mip 0). With mip dropping on, I then cleared the source to a different color and resolved into dropped guest mip 0. The retained host mip kept the original color on both backends. Synthetic test only. No title run. *AI-assisted with Codex.*
Author
Owner

@⁠Logan-Gaillard on GitHub · 2026-11-24 16:32 UTC · original

Tested in-game on an 8 GB laptop GPU where main cannot reach the world at all. With
VICTORY_TEXTURE_MIP_DROP=1 on this branch, the world loads and runs.

Machine: RTX 5070 Laptop (8 GB VRAM), 15.4 GB RAM, 24.8 GB system-managed pagefile,
retail 1.0.2.1 on SSD, Windows 11. Build: feat/texture-mip-drop-budget at 06603c7,
release profile, built with cargo-xwin.

Without the switch (and on every build I tried: ffe310e, #1133, #472, #561) the run
stops at the same place: 79 packs opened, then host texture creation fails on ordinary
textures —

WARN victory_gpu::resource: no host texture error=E_OUTOFMEMORY (0x8007000E)
     desc=ResourceDesc { dimension: 3, width: 2048, height: 2048, mip_levels: 10, format: 71 ... }
WARN victory_gpu::resource: no host texture ... 1024x1024 mip_levels: 9, format: 98
ERROR victory_gpu::host: a host command list did not close (0x8007000E)
VIctory: host GPU failure: ... device removed

With VICTORY_TEXTURE_MIP_DROP=1 on this branch:

without switch with switch
packs opened 79 79
no host texture failures 40+ 0
command list did not close yes no
device removed yes no
world never reached loads
frame rate in the world — 29-30 fps, 34.4 ms/frame, 11 draws/frame
menus 30.0 fps / 33.3 ms 30.0 fps / 33.3 ms (unchanged)

Two details that may matter for the design:

  • nvidia-smi reported at most 501 MiB of VRAM in use during the failing load, and the
    process peaked at 15.6 GB private on a 15.4 GB machine. So the E_OUTOFMEMORY is not
    a simple "VRAM is full" reservation failure; the committed size of the host textures is
    what the driver refuses.
  • The failed textures are small and ordinary (BC1/BC3/BC7, 1024-2048 px, 9-12 mips), which
    is why a mip drop of 1 removes the failure entirely instead of just delaying it.

Suggestion for merge: keep the opt-in switch, but consider enabling 1 by default when the
adapter reports <= 8 GB, since on that class of GPU the unpatched build cannot reach the
world at all.

**@⁠Logan-Gaillard** on GitHub · 2026-11-24 16:32 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7137818516) Tested in-game on an 8 GB laptop GPU where `main` cannot reach the world at all. With `VICTORY_TEXTURE_MIP_DROP=1` on this branch, the world loads and runs. **Machine**: RTX 5070 Laptop (8 GB VRAM), 15.4 GB RAM, 24.8 GB system-managed pagefile, retail 1.0.2.1 on SSD, Windows 11. Build: `feat/texture-mip-drop-budget` at `06603c7`, release profile, built with `cargo-xwin`. **Without the switch** (and on every build I tried: `ffe310e`, #1133, #472, #561) the run stops at the same place: 79 packs opened, then host texture creation fails on ordinary textures — ``` WARN victory_gpu::resource: no host texture error=E_OUTOFMEMORY (0x8007000E) desc=ResourceDesc { dimension: 3, width: 2048, height: 2048, mip_levels: 10, format: 71 ... } WARN victory_gpu::resource: no host texture ... 1024x1024 mip_levels: 9, format: 98 ERROR victory_gpu::host: a host command list did not close (0x8007000E) VIctory: host GPU failure: ... device removed ``` **With `VICTORY_TEXTURE_MIP_DROP=1` on this branch**: | | without switch | with switch | | --- | --- | --- | | packs opened | 79 | 79 | | `no host texture` failures | 40+ | **0** | | `command list did not close` | yes | **no** | | device removed | yes | **no** | | world | never reached | **loads** | | frame rate in the world | — | **29-30 fps, 34.4 ms/frame, 11 draws/frame** | | menus | 30.0 fps / 33.3 ms | 30.0 fps / 33.3 ms (unchanged) | Two details that may matter for the design: - nvidia-smi reported at most **501 MiB** of VRAM in use during the failing load, and the process peaked at **15.6 GB private** on a 15.4 GB machine. So the `E_OUTOFMEMORY` is not a simple "VRAM is full" reservation failure; the committed size of the host textures is what the driver refuses. - The failed textures are small and ordinary (BC1/BC3/BC7, 1024-2048 px, 9-12 mips), which is why a mip drop of 1 removes the failure entirely instead of just delaying it. Suggestion for merge: keep the opt-in switch, but consider enabling `1` by default when the adapter reports <= 8 GB, since on that class of GPU the unpatched build cannot reach the world at all.
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 17:08 UTC · original

@⁠Logan-Gaillard Thank you for the detailed hardware profiling and diagnostics! The distinction you highlighted between resident physical VRAM (501 MiB) and private committed virtual memory saturation (15.6 GB on a 15.4 GB system) during the 79-pack loading burst explains exactly why unpatched main hits 0x8007000E (E_OUTOFMEMORY) inside WDDM host resource creation.

Your suggestion has been implemented on branch feat/texture-mip-drop-budget (commit 4dd48bd):

  1. DXGI VRAM Probing:
    When VICTORY_TEXTURE_MIP_DROP is not explicitly set in the environment, the engine queries the discrete DXGI adapter's DedicatedVideoMemory (IDXGIFactory4::EnumAdapters1).

  2. Auto-Default for \le 8 GB GPUs:
    If primary discrete VRAM is \le 8.5 GiB (covering 4 GB, 6 GB, and 8 GB cards like your RTX 5070 Laptop, RTX 4060, RX 6600, etc.), it automatically defaults to drop = 1 out of the box so the open world loads cleanly without requiring manual environment variable configuration.

  3. High-Memory Preservation & Explicit Overrides:

    • Systems with \ge 10 GB VRAM default to 0 (native full resolution).
    • Explicit environment variables (VICTORY_TEXTURE_MIP_DROP=0 to force full quality, or 2 for aggressive budgeting) continue to take priority over the auto-detected default.

All CI checks (clippy and workspace unit tests) are green.

**@⁠antikohza** on GitHub · 2026-11-24 17:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7138734702) @⁠Logan-Gaillard Thank you for the detailed hardware profiling and diagnostics! The distinction you highlighted between resident physical VRAM (501 MiB) and private committed virtual memory saturation (15.6 GB on a 15.4 GB system) during the 79-pack loading burst explains exactly why unpatched `main` hits `0x8007000E (E_OUTOFMEMORY)` inside WDDM host resource creation. Your suggestion has been implemented on branch `feat/texture-mip-drop-budget` (commit [`4dd48bd`](https://github.com/antikohza/VIctory/commit/4dd48bdc5496250cfb01404021c34d4547ffcd93)): 1. **DXGI VRAM Probing**: When `VICTORY_TEXTURE_MIP_DROP` is not explicitly set in the environment, the engine queries the discrete DXGI adapter's `DedicatedVideoMemory` (`IDXGIFactory4::EnumAdapters1`). 2. **Auto-Default for $\le$ 8 GB GPUs**: If primary discrete VRAM is $\le$ 8.5 GiB (covering 4 GB, 6 GB, and 8 GB cards like your RTX 5070 Laptop, RTX 4060, RX 6600, etc.), it automatically defaults to `drop = 1` out of the box so the open world loads cleanly without requiring manual environment variable configuration. 3. **High-Memory Preservation & Explicit Overrides**: - Systems with $\ge$ 10 GB VRAM default to `0` (native full resolution). - Explicit environment variables (`VICTORY_TEXTURE_MIP_DROP=0` to force full quality, or `2` for aggressive budgeting) continue to take priority over the auto-detected default. All CI checks (clippy and workspace unit tests) are green.
Author
Owner

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

Tested 4dd48bd in-game today on the same machine, in both adapter configurations.

Machine: RTX 5070 Laptop (DedicatedVideoMemory = 8,273,264,640) + an Intel iGPU, 15.4 GB RAM,
24.8 GB pagefile, retail 1.0.2.1 from SSD, Windows 11.

1. Default adapter (what a user actually gets). The device comes from
D3D12CreateDevice(None, ...), which on this laptop is the Intel iGPU:

host adapter adapter=Intel(R) Graphics
host device memory bytes=134217728      (128 MiB dedicated)

Your probe returns the maximum DedicatedVideoMemory over the adapters, i.e. the RTX's
8,273,264,640, so it auto-enables drop = 1 — for a device that is not running on that card. The
run still dies at world load:

ERROR host GPU device removed after a submission of 1 lists ... (0x887A0004)
ERROR a host command list did not close (0x887A0005 device paused)

2. Device forced onto the RTX (per-app Windows GPU preference for the exe): auto drop = 1,
and the load gets much further — world streaming at 0.5-1.1 fps, 165-289 MB of copies and
93-136 MB of textures per frame, GPU 245-1219 ms — then:

ERROR host GPU device removed after a submission of 11 lists (0x887A0004)

So the auto-default is the right idea and it removes the whole E_OUTOFMEMORY class, but two
things follow from the runs:

  • The probe should measure the adapter the device was created on, not the best one.
    device.GetAdapterLuid() matched against IDXGIAdapter1::GetDesc1().AdapterLuid gives that.
    Otherwise a laptop whose default is its iGPU computes the budget from a card it never uses —
    and a 12 GB laptop with an iGPU default would stay at drop = 0 while its host copies live in
    shared system memory, which is the case this switch exists for.
  • Even on the right adapter, world streaming still removes the device on this machine with no
    allocation failure logged. That residual fault is #653 and it is independent of texture size;
    the mip drop is necessary but not sufficient here.

My own version of the same idea (LUID-matched size, plus creating the device on the adapter with
the most dedicated memory) is on a local branch fix/auto-mip-drop-on-oom (1cfd8ed, 2cbc63c)
because this account has no write access here (#717) — happy to hand the diff over if a branch is
created.

**@⁠Logan-Gaillard** on GitHub · 2026-11-24 17:18 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7138992525) Tested `4dd48bd` in-game today on the same machine, in both adapter configurations. **Machine**: RTX 5070 Laptop (`DedicatedVideoMemory` = 8,273,264,640) + an Intel iGPU, 15.4 GB RAM, 24.8 GB pagefile, retail 1.0.2.1 from SSD, Windows 11. **1. Default adapter (what a user actually gets).** The device comes from `D3D12CreateDevice(None, ...)`, which on this laptop is the **Intel iGPU**: ``` host adapter adapter=Intel(R) Graphics host device memory bytes=134217728 (128 MiB dedicated) ``` Your probe returns the *maximum* `DedicatedVideoMemory` over the adapters, i.e. the RTX's 8,273,264,640, so it auto-enables `drop = 1` — for a device that is not running on that card. The run still dies at world load: ``` ERROR host GPU device removed after a submission of 1 lists ... (0x887A0004) ERROR a host command list did not close (0x887A0005 device paused) ``` **2. Device forced onto the RTX** (per-app Windows GPU preference for the exe): auto `drop = 1`, and the load gets much further — world streaming at 0.5-1.1 fps, 165-289 MB of copies and 93-136 MB of textures per frame, GPU 245-1219 ms — then: ``` ERROR host GPU device removed after a submission of 11 lists (0x887A0004) ``` So the auto-default is the right idea and it removes the whole `E_OUTOFMEMORY` class, but two things follow from the runs: - **The probe should measure the adapter the device was created on**, not the best one. `device.GetAdapterLuid()` matched against `IDXGIAdapter1::GetDesc1().AdapterLuid` gives that. Otherwise a laptop whose default is its iGPU computes the budget from a card it never uses — and a 12 GB laptop with an iGPU default would stay at `drop = 0` while its host copies live in shared system memory, which is the case this switch exists for. - Even on the right adapter, world streaming still removes the device on this machine with no allocation failure logged. That residual fault is #653 and it is independent of texture size; the mip drop is necessary but not sufficient here. My own version of the same idea (LUID-matched size, plus creating the device on the adapter with the most dedicated memory) is on a local branch `fix/auto-mip-drop-on-oom` (`1cfd8ed`, `2cbc63c`) because this account has no write access here (#717) — happy to hand the diff over if a branch is created.
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 17:29 UTC · original

@⁠Logan-Gaillard That would be awesome. The goal is to make sure everyone with a low-VRAM or hybrid laptop can just boot up and run the game without hitting roadblocks.

Please share your diff or commit patch (paste it here or link a gist/branch) and I will merge it directly into PR #1296 so hybrid laptop users get discrete GPU selection and LUID-matched auto-drop out of the box!

**@⁠antikohza** on GitHub · 2026-11-24 17:29 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7139264627) @⁠Logan-Gaillard That would be awesome. The goal is to make sure everyone with a low-VRAM or hybrid laptop can just boot up and run the game without hitting roadblocks. Please share your diff or commit patch (paste it here or link a gist/branch) and I will merge it directly into PR #1296 so hybrid laptop users get discrete GPU selection and LUID-matched auto-drop out of the box!
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 18:36 UTC · original

@⁠ghmfreitas Thank you for the thorough Linux/Proton and vkd3d-proton benchmarking!

Seeing peak VRAM drop by ~1.18 GB (7,843 MiB down to 6,664 MiB) and kernel NV_ERR_NO_MEMORY lines drop from 13 down to 0 confirms that the mip-drop architecture stabilizes Vulkan memory allocations under Wine/vkd3d just as effectively as D3D12 on native Windows. It's also great to see the DXGI VRAM probe auto-enabling cleanly across the Proton translation layer without manual intervention.

For tracking, the official PR has been submitted upstream as #1296: #1296

If you're in contact with other testers on Linux, Steam Deck, or different low-VRAM configurations (such as 6 GB laptop GPUs or AMD RDNA cards), feel free to invite them to test PR #1296 and share their telemetry—the more diverse hardware we verify, the faster upstream can merge!

**@⁠antikohza** on GitHub · 2026-11-24 18:36 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7140890788) @⁠ghmfreitas Thank you for the thorough Linux/Proton and vkd3d-proton benchmarking! Seeing peak VRAM drop by ~1.18 GB (7,843 MiB down to 6,664 MiB) and kernel `NV_ERR_NO_MEMORY` lines drop from 13 down to 0 confirms that the mip-drop architecture stabilizes Vulkan memory allocations under Wine/vkd3d just as effectively as D3D12 on native Windows. It's also great to see the DXGI VRAM probe auto-enabling cleanly across the Proton translation layer without manual intervention. For tracking, the official PR has been submitted upstream as #1296: https://git.gtahub.st/github/Marvisak--VIctory/pulls/1296 If you're in contact with other testers on Linux, Steam Deck, or different low-VRAM configurations (such as 6 GB laptop GPUs or AMD RDNA cards), feel free to invite them to test PR #1296 and share their telemetry—the more diverse hardware we verify, the faster upstream can merge!
Author
Owner

@⁠antikohza on GitHub · 2026-11-24 19:58 UTC · original

@⁠ghmfreitas @⁠bittertea0323 @⁠DrDarkDK @⁠MichaelSmithAI — thank you for all the testing and reviews on #737 and #1086. All follow-up issues from this thread are now resolved in #1296 (a6f3ccb, Windows CI run 45470890213) and stacked cleanly on #1542 in feat/texture-mip-drop-on-1542 (0d79788, CI run 45473319819):

  • descriptor/host.rs: adjust_srv_window() now also shifts ResourceMinLODClamp, clamps out-of-range views (most_detailed >= drop + host_mips), and adds unit coverage.
  • list.rs & texture.rs: copy_resource across mismatched mip_drop now safely copies overlapping surviving subresources instead of skipping, and resolve / copy_texture_region mark only the target subresource (HostWritten u128 bitmask) so untouched upper mips still upload.
  • resource.rs & host.rs: Single drop computation in host_texture(), BCn 4×4 alignment guard for custom VICTORY_TEXTURE_MIP_DROP_MIN_SIZE, and D3D_FEATURE_LEVEL_12_0 probing in best_adapter().

If anyone has a chance to re-test a6f3ccb (or 0d79788 with lazy textures) — especially =0 vs =1 picture captures or drop=2/MIN_SIZE on 6–8 GB setups — feedback on #1296 is always welcome.

**@⁠antikohza** on GitHub · 2026-11-24 19:58 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7142874665) @⁠ghmfreitas @⁠bittertea0323 @⁠DrDarkDK @⁠MichaelSmithAI — thank you for all the testing and reviews on #737 and #1086. All follow-up issues from this thread are now resolved in **#1296** (`a6f3ccb`, [Windows CI run 45470890213](https://github.com/antikohza/VIctory/actions/runs/45470890213)) and stacked cleanly on **#1542** in [`feat/texture-mip-drop-on-1542`](https://github.com/antikohza/VIctory/tree/feat/texture-mip-drop-on-1542) (`0d79788`, [CI run 45473319819](https://github.com/antikohza/VIctory/actions/runs/45473319819)): - **`descriptor/host.rs`:** `adjust_srv_window()` now also shifts `ResourceMinLODClamp`, clamps out-of-range views (`most_detailed >= drop + host_mips`), and adds unit coverage. - **`list.rs` & `texture.rs`:** `copy_resource` across mismatched `mip_drop` now safely copies overlapping surviving subresources instead of skipping, and `resolve` / `copy_texture_region` mark only the target subresource (`HostWritten` `u128` bitmask) so untouched upper mips still upload. - **`resource.rs` & `host.rs`:** Single `drop` computation in `host_texture()`, BCn 4×4 alignment guard for custom `VICTORY_TEXTURE_MIP_DROP_MIN_SIZE`, and `D3D_FEATURE_LEVEL_12_0` probing in `best_adapter()`. If anyone has a chance to re-test `a6f3ccb` (or `0d79788` with lazy textures) — especially `=0` vs `=1` picture captures or `drop=2`/`MIN_SIZE` on 6–8 GB setups — feedback on #1296 is always welcome.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:49 UTC · original · edited 2026-11-25 06:57 UTC

Automated triage for the maintainers.

The switch is now in an open pull request, #2146, rebased on main at 940d32f; thank you for opening it. main itself still has no texture mip drop (no VICTORY_TEXTURE_MIP_DROP in the tree). Note that #2146 also brings in a DXGI adapter-selection change, which reviewers may prefer as a separate PR.

Open PR #1272 (ESAT586) carries the same idea plus an automatic drop on E_OUTOFMEMORY; it may be simpler to review one of the two. #1226 and #1086 are the out-of-memory reports this addresses.

Scope: an opt-in quality/memory switch for Windows hosts running this title fits the project. Whether to take it, and whether it should turn on by itself on cards with 8 GB or less, is for the maintainers.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:49 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7150005950) · edited 2026-11-25 06:57 UTC <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-25T06:03:53Z at=2026-11-25T06:57:57Z --> Automated triage for the maintainers. The switch is now in an open pull request, #2146, rebased on `main` at `940d32f`; thank you for opening it. `main` itself still has no texture mip drop (no `VICTORY_TEXTURE_MIP_DROP` in the tree). Note that #2146 also brings in a DXGI adapter-selection change, which reviewers may prefer as a separate PR. Open PR #1272 (ESAT586) carries the same idea plus an automatic drop on `E_OUTOFMEMORY`; it may be simpler to review one of the two. #1226 and #1086 are the out-of-memory reports this addresses. Scope: an opt-in quality/memory switch for Windows hosts running this title fits the project. Whether to take it, and whether it should turn on by itself on cards with 8 GB or less, is for the maintainers. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠antikohza on GitHub · 2026-11-25 06:03 UTC · original

Opened a fresh rebased PR against current main (940d32f) per triage guidance: #2146

Updates in this rebase:

  • Reconciled cleanly with main's shared HostTexture (13bbd6f), upload_changed, and subresource_len bounds clamping.
  • Applied @ericomeehan's DXGI improvements (IDXGIFactory6::EnumAdapterByGpuPreference(HIGH_PERFORMANCE) + null-device FL12 probe).
  • Moved HostWritten per-subresource tracking directly onto HostTexture.
  • Verified green on Windows MSVC 1.98.1 (CI run 45557329026: Clippy clean, victory-gpu 149 passed, workspace 707 passed).
**@⁠antikohza** on GitHub · 2026-11-25 06:03 UTC · [original](https://github.com/Marvisak/VIctory/issues/737#issuecomment-7154403962) Opened a fresh rebased PR against current `main` (`940d32f`) per triage guidance: https://git.gtahub.st/github/Marvisak--VIctory/pulls/2146 Updates in this rebase: - Reconciled cleanly with `main`'s shared `HostTexture` (`13bbd6f`), `upload_changed`, and `subresource_len` bounds clamping. - Applied `@ericomeehan`'s DXGI improvements (`IDXGIFactory6::EnumAdapterByGpuPreference(HIGH_PERFORMANCE)` + null-device FL12 probe). - Moved `HostWritten` per-subresource tracking directly onto `HostTexture`. - Verified green on Windows MSVC `1.98.1` ([CI run 45557329026](https://github.com/antikohza/VIctory/actions/runs/45557329026): Clippy clean, `victory-gpu` 149 passed, workspace 707 passed).
This discussion has been locked. Commenting is limited to contributors.
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#737
No description provided.