GPU: return the output pointer from GetDesc methods #126

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

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

Problem

Under the Microsoft x64 COM ABI, methods returning a struct larger than 8 bytes by value receive a caller-allocated hidden output pointer (out) after this and must return out in RAX.

On main (01aadd1), all four GetDesc methods in victory-gpu returned (), leaving RAX undefined, unlike custom_heap_properties and allocation_info in resource.rs:

  • crates/victory-gpu/src/descriptor.rs: desc (ID3D12DescriptorHeap::GetDesc)
  • crates/victory-gpu/src/queue.rs: desc (ID3D12CommandQueue::GetDesc)
  • crates/victory-gpu/src/resource.rs: heap_desc (ID3D12Heap::GetDesc) and resource_desc (ID3D12Resource::GetDesc)

(Ported from upstream PR Marvisak/VIctory#1093 for Marvisak/VIctory#779.)

Fix & Tests

  • Return out from descriptor::desc, queue::desc, resource::heap_desc, and resource::resource_desc (*mut HeapDesc / *mut QueueDesc / *mut ResourceDesc).
  • Added synthetic vtable tests descriptor::tests::heap_get_desc_returns_its_output_pointer and queue::tests::queue_get_desc_returns_its_output_pointer.
  • Updated resource::tests::heaps_are_zeroed_aligned_memory and resource::tests::committed_and_placed_resources_map_at_their_gpu_address to call vtable slots 0x40 / 0x50 expecting the *mut return pointer, verify RAX == out and fields, and check null out.

Verification

  • Fork windows-latest MSVC CI run (scoped to victory-gpu on a temporary verification branch): https://github.com/BlueCatsz/VIctory-Belobug-AMD/actions/runs/45639197846
    • cargo clippy -p victory-gpu --all-targets --locked and --all-features: passed, 0 warnings in descriptor.rs, queue.rs, or resource.rs (only pre-existing warnings in shadow.rs).
    • cargo test -p victory-gpu --lib --locked: 113 passed, 0 failed, 4 ignored (all four GetDesc tests ran and passed).
  • Note on repo-wide CI: Belobug/VIctory-Belobug-AMD main's default workspace CI currently stops earlier in victory-shader on pre-existing clippy lints (#3) and lower.rs policy size (noted in README.md), so victory-gpu checks were verified on the temporary fork branch (closed/deleted afterward). This PR touches only those three victory-gpu files.

Disclosure

  • AI-assisted port and tests; verified on windows-latest CI via synthetic unit tests only (no game files, not run in-world on hardware).
**@⁠BlueCatsz** on GitHub · 2026-11-25 15:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/126) `BlueCatsz:fix/gpu-getdesc-return-ptr` → `main` · +87 −5 · 3 files · 1 commits · closed without merging ### Problem Under the Microsoft x64 COM ABI, methods returning a struct larger than 8 bytes by value receive a caller-allocated hidden output pointer (`out`) after `this` and must return `out` in `RAX`. On `main` (`01aadd1`), all four `GetDesc` methods in `victory-gpu` returned `()`, leaving `RAX` undefined, unlike `custom_heap_properties` and `allocation_info` in `resource.rs`: - `crates/victory-gpu/src/descriptor.rs`: `desc` (`ID3D12DescriptorHeap::GetDesc`) - `crates/victory-gpu/src/queue.rs`: `desc` (`ID3D12CommandQueue::GetDesc`) - `crates/victory-gpu/src/resource.rs`: `heap_desc` (`ID3D12Heap::GetDesc`) and `resource_desc` (`ID3D12Resource::GetDesc`) (Ported from upstream PR [`Marvisak/VIctory#1093`](https://github.com/Marvisak/VIctory/pull/1093) for [`Marvisak/VIctory#779`](https://github.com/Marvisak/VIctory/issues/779).) ### Fix & Tests - Return `out` from `descriptor::desc`, `queue::desc`, `resource::heap_desc`, and `resource::resource_desc` (`*mut HeapDesc` / `*mut QueueDesc` / `*mut ResourceDesc`). - Added synthetic vtable tests `descriptor::tests::heap_get_desc_returns_its_output_pointer` and `queue::tests::queue_get_desc_returns_its_output_pointer`. - Updated `resource::tests::heaps_are_zeroed_aligned_memory` and `resource::tests::committed_and_placed_resources_map_at_their_gpu_address` to call vtable slots `0x40` / `0x50` expecting the `*mut` return pointer, verify `RAX == out` and fields, and check null `out`. ### Verification - Fork `windows-latest` MSVC CI run (scoped to `victory-gpu` on a temporary verification branch): https://github.com/BlueCatsz/VIctory-Belobug-AMD/actions/runs/45639197846 - `cargo clippy -p victory-gpu --all-targets --locked` and `--all-features`: passed, 0 warnings in `descriptor.rs`, `queue.rs`, or `resource.rs` (only pre-existing warnings in `shadow.rs`). - `cargo test -p victory-gpu --lib --locked`: **113 passed, 0 failed, 4 ignored** (all four `GetDesc` tests ran and passed). - Note on repo-wide CI: `Belobug/VIctory-Belobug-AMD` `main`'s default workspace CI currently stops earlier in `victory-shader` on pre-existing clippy lints (#3) and `lower.rs` policy size (noted in `README.md`), so `victory-gpu` checks were verified on the temporary fork branch (closed/deleted afterward). This PR touches only those three `victory-gpu` files. ### Disclosure - AI-assisted port and tests; verified on `windows-latest` CI via synthetic unit tests only (no game files, not run in-world on hardware).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:16 +00:00
github-bot closed this pull request 2026-11-26 03:36:16 +00:00
Author
Owner

@⁠BlueCatsz on GitHub · 2026-11-25 22:27 UTC · original

Closing this PR: upstream second-look triage on Marvisak/VIctory#2058 clarified that on console D3D12.X these GetDesc vtable entries take an explicit out pointer and return void (the inline wrapper returns its own local copy, so callers do not read RAX), invalidating the PC D3D12 ABI premise behind this port. Apologies for the noise!

**@⁠BlueCatsz** on GitHub · 2026-11-25 22:27 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/126#issuecomment-7176383876) Closing this PR: upstream second-look triage on Marvisak/VIctory#2058 clarified that on console D3D12.X these GetDesc vtable entries take an explicit out pointer and return void (the inline wrapper returns its own local copy, so callers do not read RAX), invalidating the PC D3D12 ABI premise behind this port. Apologies for the noise!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.