GPU: retain D3D12 object names in private data #541
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/541"
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 broccolize on 2026-11-24T04:41:27Z.
SetNamenow stores the original UTF-16 name, including its terminating NUL, underWKPDID_D3DDebugObjectNameW. Callers can retrieve the name throughGetPrivateData.The regression covers Unicode names, replacement, and empty names. It failed on
mainand passes with this change. Native Direct3D returned matching bytes on the GTX 1650, Intel UHD Graphics, and WARP.On Windows with Rust 1.98.1 (GNU), the GPU suite passed 44 tests by default and 46 with diagnostics. Both runs had zero failures and one ignored benchmark. The asset policy and
git diff --checkpassed.AI-assisted with Codex. The tests used synthetic inputs.
Imported from Marvisak/VIctory. Originally posted by fromthemoonx on 2026-11-24T10:16:44Z.
Tested
51fc0d3merged onto currentmain(ffe310e, merges cleanly) on NVIDIA.Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1
x86_64-pc-windows-msvc.CI's commands, on the merge: both clippy runs (
-D warnings, with and without--all-features) clean;cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored.Against native D3D12. A throwaway test (not pushed) made a native
ID3D12Fenceon the RTX 3060 and on WARP and one of ours, then calledSetNameand read back withGetPrivateData:SetName("abc"), wide keyS_OK, 8 bytes,abc\0S_OK, 8 bytes,abc\0WKPDID_D3DDebugObjectName)DXGI_ERROR_NOT_FOUNDDXGI_ERROR_NOT_FOUNDSetName("")S_OK, 2 bytes,\0S_OK, 2 bytes,\0SetName(null)S_OK, previous name keptSo the stored bytes match native exactly. The more lenient
nullis fine. The regression test also catches dropping the terminating NUL (withfrom_raw_parts(name, len), it fails atobject.rs:419).One cost this introduces: release becomes O(named objects).
release_boxedclears an object's private data withprivate_data().retain(...)over the whole map. That was cheap while only explicitSetPrivateDataput anything there; now every named object adds an entry, so each release scans every live name. Releasing N named fences (release build, names liketexture 123 1024x1024 f98 flags 0x0):mainThe world creates and releases many named resources and pipelines, so this would show up as streaming and release cost. Since the key is
(address, Iid), the object's entries are one contiguous range of theBTreeMap. Removing just that range keeps release logarithmic. This is what I measured above, and the object tests still pass with it:Not tested: tools reading the names (PIX, the debug layer's messages); no game data used.
AI-assisted (Claude Code) ran the checks and drafted this comment.
Imported from Marvisak/VIctory. Originally posted by fromthemoonx on 2026-11-24T11:45:22Z.
Re-tested
cbd8426(it already containsmainffe310e) on the same RTX 3060 machine.Release cost, same benchmark as before (release build, N named fences released):
51fc0d3)cbd8426)last_release_clears_only_the_released_objects_private_dataguards the change: with the cleanup loop disabled locally, it fails atobject.rs:435.CI's commands: both clippy runs (
-D warnings, with and without--all-features) clean;cargo test --workspace --locked: 344 passed, 0 failed, 6 ignored.Thanks for taking it in.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:16:37Z.
Automated triage for the maintainers.
Merge candidate.
set_nameincrates/victory-gpu/src/object.rsnow also stores the NUL-terminated UTF-16 name underWKPDID_D3DDebugObjectNameW(the public PC key), through main's ownset_private_data, soGetPrivateDatareturns it as native D3D12 does. A tester's comparison above shows byte-identical results for normal and empty names on hardware and WARP. Main'srelease_boxedalready removes an object's private data by key range, so the per-release cost raised earlier does not come back. The new test round-trips Unicode, replacement and empty names. It is a small conformance change; nothing shows yet that the title reads names back.CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:08:25Z.
Code review and RTX 5090 + WARP verification at head
9999e2d1e895merged cleanly ontomain(63bcca43c6a0):crates/victory-gpu/src/object.rs:239-255):set_namescans non-null*const u16to the null terminator, checksu32::try_from(size_of_val(units)), and stores the UTF-16LE bytes (including�) viaset_private_data(this, &DEBUG_OBJECT_NAME_W, ...)(deep-copied underPRIVATEmutex and cleaned up onrelease_boxed).SetName(nullptr)currently logs and returnsS_OKwithout clearing a previously storedDEBUG_OBJECT_NAME_Wentry (set_private_data(..., 0, null())), whereasSetName(L"")overwrites with[0u16].VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:191 files ok;cargo clippy --locked -p victory-gpu --tests -- -D warnings(default +--features diagnostics): 0 warningsvictory-gpu --lib -- object::: 6/6 passed (1 ignored bench) on default RTX 5090,--features diagnosticsRTX 5090, and WARP (includingnames_round_trip_as_wide_private_data).LGTM.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-27T00:51:32Z.
Review: APPROVED
LGTM — verified on Windows:
WKPDID_D3DDebugObjectNameW({4cca5fd8-921f-42c8-8566-70caf2a9b741}) with trailing NUL andu32::try_frombounds check is clean and matches D3D12SetName/GetPrivateDatasemanticscargo test -p victory-gpu --lib object::tests::passed (6/6, includingnames_round_trip_as_wide_private_data)cargo clippy -p victory-gpu --all-targets -- -D warningspassed with 0 warningscargo xtask policypassed (191 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.