GPU: GetDesc methods do not return their output pointer in RAX (fix on a fork) #779

Open
opened 2026-11-26 04:13:57 +00:00 by github-bot · 4 comments
Owner

@⁠BlueCatsz on GitHub · 2026-11-24 10:32 UTC · original

Problem

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, after this) and must return that pointer in RAX.

In victory-gpu, all four GetDesc implementations currently return (), leaving RAX undefined 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, and resource::custom_heap_properties) already return out.

Fix on a fork

Since PR creation is currently limited to collaborators, the fix is pushed and CI-verified on a fork:

Changes

  • crates/victory-gpu/src/resource.rs: change heap_desc and resource_desc to return *mut HeapDesc / *mut ResourceDesc (out); update resource::tests::heaps_are_zeroed_aligned_memory and resource::tests::committed_and_placed_resources_map_at_their_gpu_address to verify get_desc(obj, out_ptr) == out_ptr, the populated fields, and null out handling.
  • crates/victory-gpu/src/queue.rs: change queue::desc to return *mut QueueDesc (out) and add synthetic test queue::tests::queue_get_desc_returns_its_output_pointer (resolving vtable slot 0xe0 vs 0xd0 dynamically).
  • crates/victory-gpu/src/descriptor.rs: change descriptor::desc to return *mut HeapDesc (out) and add synthetic test descriptor::tests::heap_get_desc_returns_its_output_pointer.

Verification (windows-latest CI)

Full workflow run on the fork against ef2f8fa16e00856779e40bf1b3050eea508784c7:
https://github.com/BlueCatsz/VIctory/actions/runs/45374509224

  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — passed
  • cargo test --workspace --locked — passed across the workspace, including:
    • victory-gpu: 52 passed, 0 failed (1 benchmark ignored: texture_checks_per_submission), including all four GetDesc tests (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 (including policy::tests::repository_passes_policy)

Disclosure

Verified solely with synthetic unit tests (no game files or external dumps used). The patch and this issue are AI-assisted.

**@⁠BlueCatsz** on GitHub · 2026-11-24 10:32 UTC · [original](https://github.com/Marvisak/VIctory/issues/779) ### Problem 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`, after `this`) and must return that pointer in `RAX`. In `victory-gpu`, all four `GetDesc` implementations currently return `()`, leaving `RAX` undefined 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`, and `resource::custom_heap_properties`) already return `out`. ### Fix on a fork Since PR creation is currently limited to collaborators, the fix is pushed and CI-verified on a fork: - **Branch:** https://github.com/BlueCatsz/VIctory/tree/fix/gpu-getdesc-return-ptr - **Commit:** `ef2f8fa16e00856779e40bf1b3050eea508784c7` - **Compare:** https://github.com/Marvisak/VIctory/compare/main...BlueCatsz:VIctory:fix/gpu-getdesc-return-ptr #### Changes - `crates/victory-gpu/src/resource.rs`: change `heap_desc` and `resource_desc` to return `*mut HeapDesc` / `*mut ResourceDesc` (`out`); update `resource::tests::heaps_are_zeroed_aligned_memory` and `resource::tests::committed_and_placed_resources_map_at_their_gpu_address` to verify `get_desc(obj, out_ptr) == out_ptr`, the populated fields, and null `out` handling. - `crates/victory-gpu/src/queue.rs`: change `queue::desc` to return `*mut QueueDesc` (`out`) and add synthetic test `queue::tests::queue_get_desc_returns_its_output_pointer` (resolving vtable slot `0xe0` vs `0xd0` dynamically). - `crates/victory-gpu/src/descriptor.rs`: change `descriptor::desc` to return `*mut HeapDesc` (`out`) and add synthetic test `descriptor::tests::heap_get_desc_returns_its_output_pointer`. ### Verification (`windows-latest` CI) Full workflow run on the fork against `ef2f8fa16e00856779e40bf1b3050eea508784c7`: https://github.com/BlueCatsz/VIctory/actions/runs/45374509224 - `cargo clippy --workspace --all-targets --locked -- -D warnings` — passed - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` — passed - `cargo test --workspace --locked` — passed across the workspace, including: - `victory-gpu`: 52 passed, 0 failed (1 benchmark ignored: `texture_checks_per_submission`), including all four `GetDesc` tests (`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 (including `policy::tests::repository_passes_policy`) ### Disclosure Verified solely with synthetic unit tests (no game files or external dumps used). The patch and this issue are AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:57 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-24 10:40 UTC · original

Checked #773 and #779 together on their shared base ffe310e. The #773 commit ec64d8d applied cleanly on top of ef2f8fa.

A synthetic guest ID3D12Resource::GetDesc vtable test checked that the same call returns the output pointer and reports the native D3D12 mip count. It passed on RTX 4070 Ti and software WARP for automatic 1D, 2D-array and 3D textures, plus an explicit two-mip control. With ef2f8fa alone, the same test returned the correct pointer but reported 0 mips for the 1D case, where native D3D12 reported 3.

The combined victory-gpu diagnostics library suite passed on both adapters: 56 passed, 1 benchmark ignored. Synthetic tests only. AI-assisted testing and reporting.

**@⁠DrDarkDK** on GitHub · 2026-11-24 10:40 UTC · [original](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7129089769) Checked #773 and #779 together on their shared base `ffe310e`. The #773 commit `ec64d8d` applied cleanly on top of `ef2f8fa`. A synthetic guest `ID3D12Resource::GetDesc` vtable test checked that the same call returns the output pointer and reports the native D3D12 mip count. It passed on RTX 4070 Ti and software WARP for automatic 1D, 2D-array and 3D textures, plus an explicit two-mip control. With `ef2f8fa` alone, the same test returned the correct pointer but reported 0 mips for the 1D case, where native D3D12 reported 3. The combined `victory-gpu` diagnostics library suite passed on both adapters: 56 passed, 1 benchmark ignored. Synthetic tests only. AI-assisted testing and reporting.
Author
Owner

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 11:12 UTC · original

Cherry-picked and merged downstream in https://github.com/LAKSHYA-cmd-tech/VIctory/pull/12.

Verified clean on Windows 11 D3D12 across all 88 \ ictory-gpu\ tests.

**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 11:12 UTC · [original](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7129791636) Cherry-picked and merged downstream in https://github.com/LAKSHYA-cmd-tech/VIctory/pull/12. Verified clean on Windows 11 D3D12 across all 88 \ ictory-gpu\ tests.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:52 UTC · original · edited 2026-11-25 09:54 UTC

Automated triage for the maintainers.

Confirmed on main (940d32f): the four GetDesc methods return nothing, so RAX does not hold the hidden output pointer that the x64 ABI requires when a struct is returned by value. They are heap_desc and resource_desc in crates/victory-gpu/src/resource.rs, desc in crates/victory-gpu/src/queue.rs and desc in crates/victory-gpu/src/descriptor.rs. Other hidden-pointer methods in the same file (allocation_info2, custom_heap_properties) already return out.

Correction to the earlier version of this comment: the branch was opened as #1093, which was closed unmerged before that triage ran. Open PR #2058 now carries the same change for this issue. Whether to reopen #1093 or review #2058 is the maintainers' call. #933 (mip count in GetDesc, from #773) touches the same method, and the comments above say the two apply together.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7152316661) · edited 2026-11-25 09:54 UTC <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T08:42:38Z at=2026-11-25T09:50:38Z --> Automated triage for the maintainers. Confirmed on `main` (`940d32f`): the four `GetDesc` methods return nothing, so `RAX` does not hold the hidden output pointer that the x64 ABI requires when a struct is returned by value. They are `heap_desc` and `resource_desc` in `crates/victory-gpu/src/resource.rs`, `desc` in `crates/victory-gpu/src/queue.rs` and `desc` in `crates/victory-gpu/src/descriptor.rs`. Other hidden-pointer methods in the same file (`allocation_info2`, `custom_heap_properties`) already return `out`. Correction to the earlier version of this comment: the branch was opened as #1093, which was closed unmerged before that triage ran. Open PR #2058 now carries the same change for this issue. Whether to reopen #1093 or review #2058 is the maintainers' call. #933 (mip count in `GetDesc`, from #773) touches the same method, and the comments above say the two apply together. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠BlueCatsz on GitHub · 2026-11-25 08:42 UTC · original

Quick clarification for maintainers/triage regarding "No open PR carries this change... please open one from fix/gpu-getdesc-return-ptr":

PR #1093 was already opened yesterday from BlueCatsz:fix/gpu-getdesc-return-ptr (ef2f8fa16e00856779e40bf1b3050eea508784c7), and was mistakenly auto-closed at 00:31 UTC (three hours before the 03:52 UTC issue triage comment here). #2058 was then opened afterward at 04:16 UTC for the same fix.

I've replied on #1093 per its triage close prompt so maintainers can reopen #1093 cleanly without needing a duplicate PR.

**@⁠BlueCatsz** on GitHub · 2026-11-25 08:42 UTC · [original](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7157373734) Quick clarification for maintainers/triage regarding *"No open PR carries this change... please open one from `fix/gpu-getdesc-return-ptr`"*: PR #1093 was already opened yesterday from `BlueCatsz:fix/gpu-getdesc-return-ptr` (`ef2f8fa16e00856779e40bf1b3050eea508784c7`), and was mistakenly auto-closed at `00:31 UTC` (three hours before the `03:52 UTC` issue triage comment here). #2058 was then opened afterward at `04:16 UTC` for the same fix. I've replied on #1093 per its triage close prompt so maintainers can reopen #1093 cleanly without needing a duplicate PR.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#779
No description provided.