GPU: return the output pointer from GetDesc methods #1093

Closed
github-bot wants to merge 1 commit from gh-pr/1093/head into gh-pr/1093/base
Owner

@⁠BlueCatsz on GitHub · 2026-11-24 15:40 UTC · original
BlueCatsz:fix/gpu-getdesc-return-ptr → main · +87 −5 · 3 files · 1 commits · closed without merging

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, 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.

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

  • Fork windows-latest CI run (45374509224 against ef2f8fa16e00856779e40bf1b3050eea508784c7):
    • 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 all workspace crates, including:
      • victory-gpu: 52 passed; 0 failed; 1 ignored (texture_checks_per_submission benchmark), 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)
  • Independent Windows hardware / D3D12 checks reported on #779:
    • Confirmed cleanly compatible with #773 (ec64d8d atop ef2f8fa) and returning the output pointer on RTX 4070 Ti + WARP (DrDarkDK, 56 passed, 1 benchmark ignored).
    • Cherry-picked downstream in LAKSHYA-cmd-tech/VIctory#12 and verified on Windows 11 D3D12 across all 88 victory-gpu tests 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.

**@⁠BlueCatsz** on GitHub · 2026-11-24 15:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1093) `BlueCatsz:fix/gpu-getdesc-return-ptr` → `main` · +87 −5 · 3 files · 1 commits · closed without merging 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`, 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`. ### 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 - **Fork `windows-latest` CI run ([`45374509224`](https://github.com/BlueCatsz/VIctory/actions/runs/45374509224) against `ef2f8fa16e00856779e40bf1b3050eea508784c7`):** - `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 all workspace crates, including: - `victory-gpu`: `52 passed; 0 failed; 1 ignored` (`texture_checks_per_submission` benchmark), 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`) - **Independent Windows hardware / D3D12 checks reported on #779:** - Confirmed cleanly compatible with #773 (`ec64d8d` atop `ef2f8fa`) and returning the output pointer on RTX 4070 Ti + WARP (`DrDarkDK`, `56 passed`, 1 benchmark ignored). - Cherry-picked downstream in `LAKSHYA-cmd-tech/VIctory#12` and verified on Windows 11 D3D12 across all 88 `victory-gpu` tests 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.
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:19:35 +00:00
github-bot closed this pull request 2026-11-26 04:19:35 +00:00
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 15:49 UTC · original

Independent Win64 check under Wine/GE 3.2: ef2f8fa applied cleanly to our integration build (290b384), and all four guest vtable tests passed for the resource, heap, descriptor heap and command queue. Each GetDesc returned the address supplied by the caller.

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.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 15:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/1093#issuecomment-7136671555) Independent Win64 check under Wine/GE 3.2: `ef2f8fa` applied cleanly to our integration build (`290b384`), and all four guest vtable tests passed for the resource, heap, descriptor heap and command queue. Each GetDesc returned the address supplied by the caller. 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.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 16:29 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at ef2f8fa: cargo test -p victory-gpu passes, 52 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 16:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1093#issuecomment-7137751799) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at ef2f8fa: `cargo test -p victory-gpu` passes, 52 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:31 UTC · original

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.

**@⁠Marvisak** on GitHub · 2026-11-25 00:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1093#issuecomment-7148604785) 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.
Author
Owner

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

This automated close appears to be a false positive:

  1. Confirmed on main by automated issue triage: After this PR was closed at 2026-11-25T00:31:59Z, automated triage on companion issue #779 (2026-11-25T03:52:14Z) confirmed the exact same bug on main across all four methods touched here (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), labeled #779 area: gpu, bug, triage: confirmed, and triage: has patch, and explicitly requested opening a PR from fix/gpu-getdesc-return-ptr (missing that this PR had already been opened from that branch before the auto-close).
  2. Independent verification across four Windows/Wine setups + fork CI:
    • Green fork windows-latest CI run against ef2f8fa: https://github.com/BlueCatsz/VIctory/actions/runs/45374509224
    • MichaelSmithAI (RTX 4090 / Wine GE 3.2): all four GetDesc vtable tests pass + verified combined with #933.
    • Zipettte (AMD RX 7700 XT / Windows 11 / Rust 1.98.1 MSVC): victory-gpu 52 passed / 0 failed.
    • DrDarkDK (RTX 4070 Ti + WARP, on #779): verified return pointer and clean stacking with #773 (ec64d8d on ef2f8fa).
    • LAKSHYA-cmd-tech (Windows 11 D3D12, on #779): cherry-picked in LAKSHYA-cmd-tech/VIctory#12, verified across all victory-gpu tests.
  3. Branch & merge status: #1093 still merges cleanly (MERGEABLE) onto current main. Note that #2058 was opened later (04:16 UTC) for #779 after the issue triage comment said no open PR existed.

Could this PR be reopened so it isn't duplicated by #2058?

**@⁠BlueCatsz** on GitHub · 2026-11-25 08:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1093#issuecomment-7157371123) This automated close appears to be a false positive: 1. **Confirmed on `main` by automated issue triage:** After this PR was closed at `2026-11-25T00:31:59Z`, automated triage on companion issue #779 (`2026-11-25T03:52:14Z`) confirmed the exact same bug on `main` across all four methods touched here (`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`), labeled #779 `area: gpu`, `bug`, `triage: confirmed`, and `triage: has patch`, and explicitly requested opening a PR from `fix/gpu-getdesc-return-ptr` (missing that this PR had already been opened from that branch before the auto-close). 2. **Independent verification across four Windows/Wine setups + fork CI:** - Green fork `windows-latest` CI run against `ef2f8fa`: https://github.com/BlueCatsz/VIctory/actions/runs/45374509224 - `MichaelSmithAI` (RTX 4090 / Wine GE 3.2): all four `GetDesc` vtable tests pass + verified combined with #933. - `Zipettte` (AMD RX 7700 XT / Windows 11 / Rust 1.98.1 MSVC): `victory-gpu` 52 passed / 0 failed. - `DrDarkDK` (RTX 4070 Ti + WARP, on #779): verified return pointer and clean stacking with #773 (`ec64d8d` on `ef2f8fa`). - `LAKSHYA-cmd-tech` (Windows 11 D3D12, on #779): cherry-picked in `LAKSHYA-cmd-tech/VIctory#12`, verified across all `victory-gpu` tests. 3. **Branch & merge status:** #1093 still merges cleanly (`MERGEABLE`) onto current `main`. Note that #2058 was opened later (`04:16 UTC`) for #779 after the issue triage comment said no open PR existed. Could this PR be reopened so it isn't duplicated by #2058?

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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!1093
No description provided.