GPU: cache immutable HostTexture flags/format and descriptor heap start handles #2213
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2215"
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:05:56Z.
Hot per-draw, barrier, descriptor, and texture-upload paths in
victory-gpucurrently repeat immutable COM queries (ID3D12Resource::GetDesc(),GetCPUDescriptorHandleForHeapStart(),GetGPUDescriptorHandleForHeapStart()), cloneArc<HostTexture>on every barrier/lookup, and computelegal_state()twice per resource barrier:HostTexture::new()already callsGetDesc()once, yetlegal_state,view_format,takes, andtitle_writtenre-issueGetDesc()through D3D12 COM on every barrier, render-target/depth bind, and texture refresh.HostList::transition()andlist.rsbarriers each calllegal_state()separately and cloneArc<HostTexture>just to read immutable fields.Host::rtv(),Host::dsv(),Host::cpu_view(), andHostHeap::gpu()invokeGet{CPU,GPU}DescriptorHandleForHeapStart()on every descriptor allocation/lookup even though a heap's start handle is immutable for its lifetime.Claimed on #1633 (
https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7155911614).The change
crates/victory-gpu/src/resource.rs:flags: D3D12_RESOURCE_FLAGSandformat: DXGI_FORMATonHostTexturefrom its existingGetDesc()inHostTexture::new().host_copy_ref()to borrowHostTexturewithout hot-pathArc::clonewhere callers only inspect metadata/resource handles.flags/formatvia pure helpersview_format_forandtakes_meta, adding testsview_format_for_reports_own_pc_format_only_when_host_differsandtakes_meta_checks_required_uses_and_format_compatibility.crates/victory-gpu/src/host.rs,crates/victory-gpu/src/list.rs,crates/victory-gpu/src/draw.rs,crates/victory-gpu/src/texture.rs,crates/victory-gpu/src/bindless.rs:legal_for(flags, state)once insideHostList::transition()and return the resolved target state to barrier callers, eliminating duplicateGetDesc()calls and extraArcclones.rtv_start,dsv_start, andcpu_view_starthandles onHost(using purering_handlehelper).host::tests::legal_for_strips_only_states_forbidden_by_resource_flags,host::tests::ring_handle_offsets_and_wraps_across_rtv_ring, andtexture::tests::title_written_flags_accepts_only_non_writable_textures.crates/victory-gpu/src/descriptor/host.rs:gpu: u64start handle onHostHeapand compute slot handles via puregpu_handlearithmetic.descriptor::host::tests::gpu_handle_offsets_by_index_and_step.Not a duplicate of
No open PR or
CLAIMS.mdentry caches immutableHostTextureflags/format, removes duplicate barrierGetDesc()/legal_state()calls, or cachesHost/HostHeapdescriptor-heap start handles. (#2187addresses readable-texture sharing policy for shader-denied textures and is orthogonal.)Tested
windows-latestMSVC + Windows WARP SM 6.6 CI run45572159221(Clippyclean,Clippy, diagnostics buildclean,Tests:715 passed; 0 failed; 10 ignored,victory-gpu:157 passed; 0 failed; 2 ignored+1 passed,xtask:6 passed; 0 failed):descriptor::host::tests::gpu_handle_offsets_by_index_and_step ... okhost::tests::legal_for_strips_only_states_forbidden_by_resource_flags ... okhost::tests::ring_handle_offsets_and_wraps_across_rtv_ring ... okresource::tests::view_format_for_reports_own_pc_format_only_when_host_differs ... okresource::tests::takes_meta_checks_required_uses_and_format_compatibility ... oktexture::tests::title_written_flags_accepts_only_non_writable_textures ... 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 catminou4 on 2026-11-25T08:48:20Z.
Review: COMMENTED
Caches immutable HostTexture flags/format and the heap GPU handle start instead of re-querying per bind. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:23:39Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib gpu_handle_offsets_by_index_and_step— passedcargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean caching of immutable
HostTextureflags/format and descriptor heap start handles. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:30:06Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/bindless.rs,crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs,crates/victory-gpu/src/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 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:57Z.
Closing to keep the queue clean:
texture.rs/resource.rs/draw.rswere heavily updated on13f91caand I do not have a title run to profile this path.upstream-sync referenced this pull request2026-11-25 19:06:22 +00:00
Pull request closed