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

Open
opened 2026-11-24 10:32:24 +00:00 by BlueCatsz · 4 comments
BlueCatsz commented 2026-11-24 10:32:24 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by BlueCatsz on 2026-11-24T10:32:24Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6579807236 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/779). Originally posted by [BlueCatsz](https://github.com/BlueCatsz) on 2026-11-24T10:32:24Z. --- ### 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.
DrDarkDK commented 2026-11-24 11:04:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by DrDarkDK on 2026-11-24T10:40:17Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7129089769 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7129089769). Originally posted by [DrDarkDK](https://github.com/DrDarkDK) on 2026-11-24T10:40:17Z. --- 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.
LAKSHYA-cmd-tech commented 2026-11-24 12:04:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T11:12:13Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7129791636 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7129791636). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T11:12:13Z. --- 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.
Marvisak commented 2026-11-25 04:07:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:52:14Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152316661 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7152316661). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:52:14Z. --- <!-- 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)_
BlueCatsz commented 2026-11-25 09:06:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by BlueCatsz on 2026-11-25T08:42:38Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157373734 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/779#issuecomment-7157373734). Originally posted by [BlueCatsz](https://github.com/BlueCatsz) on 2026-11-25T08:42:38Z. --- 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.
Sign in to join this conversation.
No labels
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.

Reference
Marvisak/VIctory#779
No description provided.