GPU, Formats: lock-free resource::current fast path, zero-alloc memory_key, zero-COM shared_texture stat, and cached ID3D12Device10 #2212
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2212
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2212/head"
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?
@RVZO6 on GitHub · 2026-11-25 08:00 UTC · original
RVZO6:rvzo/resource-fast-path→main· +470 −36 · 3 files · 1 commits · closed without mergingPer-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)
@Marvisak on GitHub · 2026-11-25 13:29 UTC · original · edited 2026-11-25 16:03 UTC
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
@RVZO6 on GitHub · 2026-11-25 17:13 UTC · original
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