Repository navigation
Conversation
Under the Microsoft x64 ABI, COM methods returning a struct larger than 8 bytes by value receive a caller-allocated hidden return pointer (after `this`) and must return that pointer in RAX. ID3D12Heap::GetDesc, ID3D12Resource::GetDesc, ID3D12CommandQueue::GetDesc, and ID3D12DescriptorHeap::GetDesc returned (), leaving RAX undefined, unlike GetCustomHeapProperties and GetResourceAllocationInfo. Return `out` from all four methods and cover the return pointer and null output pointer handling with synthetic unit tests.
|
Independent Win64 check under Wine/GE 3.2: We also combined this change with #933 and checked the returned address and descriptor contents in the same call. On an RTX 4090, a committed 4×2 texture with nine array slices reported three automatic mip levels. A 4×2×9 volume reported four. Requesting two levels explicitly returned two for each. All four results matched GetDesc on the actual D3D12 backing resource, and the guest returned the original output pointer each time. All six focused tests passed on the combined build. This exercises synthetic resources; title use remains unmeasured. |
|
Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Fixes #779
Summary
Under the Microsoft x64 COM ABI, member methods returning a struct larger than 8 bytes by value receive a caller-allocated hidden output pointer (
out, afterthis) and must return that pointer inRAX.In
victory-gpu, all fourGetDescimplementations currently return(), leavingRAXundefined for callers that read the returned pointer rather than their own stack slot:ID3D12Heap::GetDesc(resource::heap_desc,HeapDesc= 48 B)ID3D12Resource::GetDesc(resource::resource_desc,ResourceDesc= 56 B)ID3D12CommandQueue::GetDesc(queue::desc,QueueDesc= 16 B)ID3D12DescriptorHeap::GetDesc(descriptor::desc,HeapDesc= 16 B)Other hidden-out-pointer methods in the workspace (
xsystem::analytics_info,resource::allocation_info,resource::allocation_info2, andresource::custom_heap_properties) already returnout.Changes
crates/victory-gpu/src/resource.rs: changeheap_descandresource_descto return*mut HeapDesc/*mut ResourceDesc(out); updateresource::tests::heaps_are_zeroed_aligned_memoryandresource::tests::committed_and_placed_resources_map_at_their_gpu_addressto verifyget_desc(obj, out_ptr) == out_ptr, the populated fields, and nullouthandling.crates/victory-gpu/src/queue.rs: changequeue::descto return*mut QueueDesc(out) and add synthetic testqueue::tests::queue_get_desc_returns_its_output_pointer(resolving vtable slot0xe0vs0xd0dynamically).crates/victory-gpu/src/descriptor.rs: changedescriptor::descto return*mut HeapDesc(out) and add synthetic testdescriptor::tests::heap_get_desc_returns_its_output_pointer.Verification
windows-latestCI run (45374509224againstef2f8fa16e00856779e40bf1b3050eea508784c7):cargo clippy --workspace --all-targets --locked -- -D warnings— passedcargo clippy --workspace --all-targets --all-features --locked -- -D warnings— passedcargo test --workspace --locked— passed across all workspace crates, including:victory-gpu:52 passed; 0 failed; 1 ignored(texture_checks_per_submissionbenchmark), including all fourGetDesctests (heaps_are_zeroed_aligned_memory,committed_and_placed_resources_map_at_their_gpu_address,queue_get_desc_returns_its_output_pointer,heap_get_desc_returns_its_output_pointer)xtask:4 passed; 0 failed(includingpolicy::tests::repository_passes_policy)ec64d8datopef2f8fa) and returning the output pointer on RTX 4070 Ti + WARP (DrDarkDK,56 passed, 1 benchmark ignored).LAKSHYA-cmd-tech/VIctory#12and verified on Windows 11 D3D12 across all 88victory-gputests on that fork (LAKSHYA-cmd-tech).Disclosure
Verified with synthetic unit tests only (no game files or external dumps used). This patch and PR are AI-assisted.