GPU: retain D3D12 object names in private data #541
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!541
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@broccolize on GitHub · 2026-11-24 04:41 UTC · original
broccolize:gpu/persist-d3d12-object-names→main· +53 −6 · 1 files · 1 commits · openSetNamenow 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.
@fromthemoonx on GitHub · 2026-11-24 10:16 UTC · original
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.
@fromthemoonx on GitHub · 2026-11-24 11:45 UTC · original
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).
@Marvisak on GitHub · 2026-11-25 01:16 UTC · original · edited 2026-11-25 06:27 UTC
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
@fuzeofficlal on GitHub · 2026-11-26 01:08 UTC · original
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.
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.