GPU, Formats: lock-free resource::current fast path, zero-alloc memory_key, zero-COM shared_texture stat, and cached ID3D12Device10 #2210
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2212"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-25T08:00:14Z.
Per-draw/dispatch texture validation and shared-texture registration currently hit several avoidable CPU bottlenecks:
resource::current()acquires the globalMEMORYmutex and hashes/looks up the texture's memory key on every draw/view check, even though the vast majority of textures are never replaced.resource::memory_key()constructs a fullvictory_formats::texture::Texturelayout (allocating mip/subresource tables) only to validate swizzle parameters.shared_texture()issues aGetResourceAllocationInfoCOM call while holding the globalMEMORYmutex even thought.bytesis already stored.Host::make_texture()queriesID3D12Device10viacast()on every texture creation instead of caching it once onHost.Claimed on #1633 (
https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7155570873).The change
crates/victory-formats/src/texture.rs:Layout::validate_descandTexture::validate_swizzlevalidation helpers (avoiding full layout/subresource allocation) and add exhaustive equivalence testvalidate_swizzle_matches_texture_new.crates/victory-gpu/src/resource.rs:replaced: AtomicBoolflag onHostTexture, set withReleaseordering whenever a liveMEMORYentry is replaced inshared_texture().resource::current()checksreplaced.load(Acquire)first and returnstruelock-free on the common unreplaced path, falling back toMEMORYonce replaced (preserving exact semantics if the replacement later drops).Texture::validate_swizzle()inresource::memory_key()instead of building a fullTexturelayout.GetResourceAllocationInfoCOM call under theMEMORYlock inshared_texture()witht.bytes.memory_key_matches_texture_layoutandreplaced_flag_fast_path_and_fallback_state_machine.crates/victory-gpu/src/host.rs:device10: Option<ID3D12Device10>once onHostincreate()and reuse it inmake_texture().Not a duplicate of
No open PR or
CLAIMS.mdentry adds the lock-freereplacedfast path inresource::current(), extractsTexture::validate_swizzle()formemory_key(), removesGetResourceAllocationInfounder theMEMORYlock, or cachesID3D12Device10onHost. (#2187addresses readable-texture sharing policy for shader-denied textures and is orthogonal.)Tested
windows-latestMSVC + Windows WARP SM 6.6 CI run45570823602(Clippyclean,Clippy, diagnostics buildclean,Tests:731 passed; 0 failed; 10 ignored,victory-formats:39 passed; 0 failed; 5 ignored,victory-gpu:153 passed; 0 failed; 2 ignored+1 passed,xtask:6 passed; 0 failed):texture::tests::validate_swizzle_matches_texture_new ... okresource::tests::memory_key_matches_texture_layout ... okresource::tests::replaced_flag_fast_path_and_fallback_state_machine ... okNot run: the title; any hardware GPU. The title was not used in these tests.
AI-assisted: T3 Code (Antigravity, gemini-4-neon)
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T08:03:26Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib resource::tests::— 12 passed, 0 failed on RTX 5090cargo clippy -p victory-gpu -p victory-formats --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean lock-free
resource::currentfast path, zero-allocmemory_key, zero-COMshared_texturestat, and cachedID3D12Device10. Looks great.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:17:48Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-formats --locked.39 passed / 0 failed. resource::current lock-free fast path, zero-alloc... — lock-free resource lookup; mixed gpu+formats, formats side green (39 passed / 5 ignored).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:29:18Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/resource.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-25T17:13:54Z.
Closing to keep the queue clean:
resource.rsmoved significantly on13f91ca(69d1e8e,11e9a54,56f75f8) and I do not have a title run to supply the GPU/CPU profile triage asked for.Pull request closed