D3D12.X: null ID3D12Heap::GetDesc leaves Flags untouched #2773

Open
opened 2026-11-26 12:24:04 +00:00 by Amongus6969 · 1 comment
Amongus6969 commented 2026-11-26 12:24:04 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by Amongus6969 on 2026-11-26T12:24:04Z.


On b49be18, the null backend’s ID3D12Heap::GetDesc slot calls Hidden_ZeroDesc40, which clears bytes 0–39 of the return buffer. On Windows x64, Flags occupies bytes 40–43 of the 48-byte D3D12_HEAP_DESC. The caller therefore gets the buffer’s previous contents as heap flags. This is a missing field, not just uncleared padding.

Related: #1902 fixed the return-buffer argument order, not the write size.

Suggested regression test: Create a heap with D3D12_HEAP_FLAG_NONE on the null device. Fill an aligned return buffer with 0xA5, call GetDesc, and check that Flags is D3D12_HEAP_FLAG_NONE. Repeat with a freshly filled buffer for the other supported argument order. No GPU or game is needed.

Verification: Source inspection only. The proposed test was not run; no game failure is claimed.

AI use (source review and drafting): omp with openai-codex/gpt-6.2-astra checked the cited code at b49be18 and drafted this issue.

<!-- greyfinch-sync:ivall/xcl:issue:6626577507 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2783). Originally posted by [Amongus6969](https://github.com/Amongus6969) on 2026-11-26T12:24:04Z. --- On `b49be18`, the null backend’s [`ID3D12Heap::GetDesc` slot](https://github.com/xcl-dev/xcl/blob/b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7/crates/xcl/src/hle/d3d12x/null.rs#L178) calls [`Hidden_ZeroDesc40`](https://github.com/xcl-dev/xcl/blob/b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7/crates/xcl/src/hle/d3d12x/null.rs#L287-L293), which clears bytes 0–39 of the return buffer. On Windows x64, `Flags` occupies bytes 40–43 of the 48-byte [`D3D12_HEAP_DESC`](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_heap_desc). The caller therefore gets the buffer’s previous contents as heap flags. This is a missing field, not just uncleared padding. Related: #1902 fixed the return-buffer argument order, not the write size. **Suggested regression test:** Create a heap with `D3D12_HEAP_FLAG_NONE` on the null device. Fill an aligned return buffer with `0xA5`, call `GetDesc`, and check that `Flags` is `D3D12_HEAP_FLAG_NONE`. Repeat with a freshly filled buffer for the other supported argument order. No GPU or game is needed. **Verification:** Source inspection only. The proposed test was not run; no game failure is claimed. **AI use (source review and drafting):** `omp` with `openai-codex/gpt-6.2-astra` checked the cited code at `b49be18` and drafted this issue.
oni-swr commented 2026-11-26 13:05:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T12:37:37Z.


Claiming this: I'm making the null ID3D12Heap::GetDesc fill the full 48-byte D3D12_HEAP_DESC, including Flags, with a regression test. A draft PR will follow.
AI-assisted (Claude Code, Claude Sonnet 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7192247558 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2783#issuecomment-7192247558). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T12:37:37Z. --- Claiming this: I'm making the null ID3D12Heap::GetDesc fill the full 48-byte D3D12_HEAP_DESC, including Flags, with a regression test. A draft PR will follow. AI-assisted (Claude Code, Claude Sonnet 5.5).
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
xcl-dev/xcl#2773
No description provided.