Repository navigation
Conversation
|
Tested this head ( Run: RTX 5070 Laptop + Intel iGPU, 15.4 GB RAM, 24.8 GB pagefile, Windows 11, release build, Why it cannot work from the failure side. By the time What does work here: the same drop applied from the start of the run instead of on failure. Second point, independent of the drop: So: right diagnosis, wrong moment. Making the level proactive (before the first allocation, from |
…osts AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used. Follow-up to in-game retail testing feedback on Marvisak#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.
|
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:
(Authored and verified by Gemini 4 Neon — High Mode; synthetic tests only, no game data.) |
fladit123
left a comment
There was a problem hiding this comment.
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
0xA4instead of expected0xC8. - 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.
…Resource 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 Marvisak#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.
|
Thanks for the thorough review and exact reproduction, @fladit123 — that caught a real subresource-ownership bug. Fixed in the latest push on this branch:
Verified locally on Windows 11 with NVIDIA GeForce RTX 3060 Ti and WARP (
(Authored and verified by Gemini 4 Neon — High Mode; synthetic tests only, zero game data.) |
fladit123
left a comment
There was a problem hiding this comment.
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.
…lazy textures Opt-in VICTORY_TEXTURE_MIP_DROP (0..=3) drops top mip levels of pure sampled textures, with automatic E_OUTOFMEMORY retry. Adapted to the fork's lazy Hosted/Made host-copy architecture (twins and render targets exempt): - resource.rs: HostTexture tracks title_mips/mip_drop/is_3d; host_texture allocates with apply_mip_drop + allocate_with_oom_retry; remap_subresource and host_mip_drop/host_mip_info accessors. - texture.rs: staging detile reads console mip host_mip+drop; HOST_WRITTEN becomes per-subresource so partial copies leave untouched mips uploadable. - list.rs: CopyResource/CopyTextureRegion/ResolveSubresource remap and prune dropped-mip subresources. - descriptor/host.rs: SRV mip-window re-basing across all texture dimensions. Default (unset) is bit-identical to before; proactive VRAM/RAM auto-drop is intentionally omitted. Adds logic tests for eligibility, remap, OOM retry and SRV re-basing.
…osts AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used. Follow-up to in-game retail testing feedback on Marvisak#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.
…Resource 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 Marvisak#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.
ccd13f8 to
856e6d8
Compare
|
Automated triage for the maintainers. This pull request no longer merges cleanly into Generated by Claude Code |
…MIP_DROP AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used. Addresses Marvisak#1226 and Marvisak#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.
…osts AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used. Follow-up to in-game retail testing feedback on Marvisak#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.
…Resource 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 Marvisak#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.
|
Rebased cleanly onto |
856e6d8 to
37b5b93
Compare
|
Two things for the rebase onto current
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). |
…rted budget; CHANGES: why Marvisak#1272 and Marvisak#2872 are not ported AI-assisted (Claude)
Summary
Addresses #1226 and #737 by introducing automatic texture mip-drop recovery on
E_OUTOFMEMORYalongside the opt-inVICTORY_TEXTURE_MIP_DROP(0..=3, default0) 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_DROPunset and noE_OUTOFMEMORY),mip_dropremains0and behavior is bit-identical tomain. On 6 GB / 8 GB GPUs or 16 GB RAM hosts where world streaming hitsE_OUTOFMEMORY(0x8007000E), the first failing pure-sampled texture automatically raisesOOM_MIP_PRESSURE, drops top mip level(s), and retries instead of leaving a null host texture that causes device removal.What Changed
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 a64 pxfloor (avoiding the tiny/1×1 texture shrinkage issue observed in Patch (fork): add VICTORY_TEXTURE_MIP_DROP quality switch for low-VRAM budgets (75%–93% texture memory savings on 6GB/8GB GPUs) #737 testing), and verifies 4×4 block alignment for BC formats.allocate_with_oom_retry: onE_OUTOFMEMORY, monotonically raisesOOM_MIP_PRESSURE(up toMAX_MIP_DROP = 3), logs a warning, and retriesCreateCommittedResource.HostTexture: trackstitle_mips,mip_drop, andis_3d, and exposeshost_subresource(console_sub) -> Option<u32>for subresource remapping / dropped-mip pruning.crates/victory-gpu/src/texture.rs)mip_droponStagingand reads console miphost_mip + mip_dropduringStaging::detile; staging footprints automatically shrink to match the host texture's reduced mip chain.crates/victory-gpu/src/descriptor/host.rs)rebase_mip_windowandadjust_srv_for_mip_dropacrossTexture1D,Texture1DArray,Texture2D,Texture2DArray,Texture3D,TextureCube, andTextureCubeArray.drop = 2, guest{1,2,3}→ host{0,1}), preservesu32::MAX, clamps all-dropped views to host mip0, and shiftsResourceMinLODClamp.crates/victory-gpu/src/list.rs)copy_texture_region: remaps destination and texture-source subresources viahost_subresource, pruning dead copies that target or read dropped top mips.copy_resource: falls back to subresource-by-subresourceCopyTextureRegionacross overlapping surviving mips when source and destination have different mip-drop counts.resolve: remapsdst_subandsrc_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), Rust1.98.1MSVC:cargo clippy --workspace --all-targets --locked -- -D warnings— 0 warningscargo clippy --workspace --all-targets --all-features --locked -- -D warnings— 0 warningscargo test -p victory-gpu --locked— 55 passed, 0 failed, 1 ignoredcargo test -p victory-gpu --all-features --locked— 58 passed, 0 failed, 1 ignored (includingmip_dropped_texture_copy_and_srv_work_on_host_gpuend-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, andsrv_mip_window_rebasing_handles_partial_full_and_dropped_ranges)cargo xtask policy— 154 files ok