GPU/COM: return hidden sret out pointer in RAX from Heap/Resource/DescriptorHeap/Queue GetDesc #3058
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!3058
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/3058/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-26 05:43 UTC · original
RVZO6:rvzo/com-getdesc-sret→main· +54 −5 · 3 files · 1 commits · closed without mergingProblem
Under the Microsoft x64 calling convention (Return values), COM methods returning structs larger than 8 bytes by value write into the caller-supplied hidden
sretpointer (out) and must return that sameoutpointer inRAX.Four D3D12 COM
GetDescmethods invictory-gpucurrently return()instead of*mut ...:ID3D12Heap::GetDesc(resource.rs::heap_desc, 48 B)ID3D12Resource::GetDesc(resource.rs::resource_desc, 56 B)ID3D12DescriptorHeap::GetDesc(descriptor.rs::desc, 16 B)ID3D12CommandQueue::GetDesc(queue.rs::desc, 16 B)Compare with
allocation_info,allocation_info2,custom_heap_properties(resource.rs), andxsystem::analytics_info, which already returnout. In--releasebuilds, LLVM leaves a clobbered register (e.g. the vtable pointer) inRAXinstead ofout, so MSVC C++ callers chainingres->GetDesc().Width/heap->GetDesc().SizeInBytesviaRAXread garbage or fault.Fix
Change all four
GetDescimplementations to return*mut HeapDesc/*mut ResourceDesc/*mut QueueDescand returnout. Disjoint from #933, #2193, and #2690 (which adjustResourceDescfield values while keeping()).Verification
resource::tests::heaps_are_zeroed_aligned_memory,descriptor::tests::heaps_hold_count_descriptors_from_their_start, andqueue::tests::queue_signals_complete_at_onceto call all four vtable slots asextern "system" fn(This, *mut T) -> *mut Tand assert the returned pointer equalsout.--releasebefore fix: all 3 tests failed with vtable pointers (0x1405...) inRAXinstead of the stackoutpointer (0x7fffff...); all 3 pass in--releaseand debug after fix.windows-latestMSVC + WARP SM 6.6 CI (cargo clippy --workspace --all-targets --locked -- -D warnings,--all-features,xtask policy, full workspace tests): https://github.com/RVZO6/VIctory/actions/runs/45762903919AI-assisted: T3 Code (Antigravity, gemini-4-neon)
@RVZO6 on GitHub · 2026-11-26 05:58 UTC · original
Closing: after checking closed PR #2058's second-look review, Xbox D3D12.X
GetDescvtable slots take an explicit out-pointer returningvoid(the C++ inline wrapper returns its local copy), so no caller readsRAX. Apologies for the noise!Pull request closed