docs(d3d12_command_objects): 0x48/0x50 are heap handle getters on heap objects (D3D12-HEAP-HANDLE-SLOTS) #1045

Merged
robot00f merged 1 commit from upstream-pr/1045 into main 2026-11-29 14:41:39 +00:00
robot00f commented 2026-11-24 17:12:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-24T17:12:41Z.


Closes nothing (docs only). Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138270960

Item: D3D12-HEAP-HANDLE-SLOTS.

What

docs/d3d12_command_objects.md gets a new §2.1a: a byte offset is not a method, and 0x48/0x50 are ambiguous by offset alone.

  • On the device (0x148759D00) 0x48 is CreateCommandAllocator; 0x50 is unused.
  • On an ID3D12DescriptorHeap the same offsets are GetCPUDescriptorHandleForHeapStart (0x48) and GetGPUDescriptorHandleForHeapStart (0x50), because the interface inherits eight IUnknown/ID3D12Object/ID3D12DeviceChild slots and starts its own methods at 0x40 (d3d12.h:5768/5775/5782).

The section states the rule (resolve the receiver, not the offset), gives the two signature shapes, and gives the counts below. §3.2's FSR note now points at it.

Why

Several pages summarise call sites as "the 29 calls at 0x48" or "device slot 9", and a reader can carry that offset to a heap object and land two methods early/late. The pair also collides with ID3D12CommandQueue (0x48 CopyTileMappings, 0x50 ExecuteCommandLists), so a replacement runtime that keys on the offset alone will wire the wrong method.

Measurements (no game data, nothing executed)

  • Whole image, byte-scanning the rip-relative device load in front of every +0x48/+0x50 call site: 2 device sites at 0x48, none at 0x50. Both are in 0x142478440 (0x142478B2D edx=0, 0x142478C3B edx=2) and pass &IID_ID3D12CommandAllocator (0x1461E0658). The other four +0x48 sites there are two Close calls on the new list and two no-argument getter calls on globals.
  • 0x141CF3280 calls device 0x70 (CreateDescriptorHeap, &IID_ID3D12DescriptorHeap at 0x1461E0628), then the returned heap at 0x141CF3358 (0x48) and 0x141CF3392 (0x50) with only this, caches the CPU handle, asserts it against the expected base, and subtracts it from the GPU handle to store the base delta. 0x141C744F0 (0x141C74559) uses the 0x48 return as a descriptor base and strides it by the device 0x78 increment.
  • Population: 33 functions call 0x70 and 0x48; 81 call 0x70 and 0x50. In 19 of the 99, a +0x48/+0x50 receiver traces to the CreateDescriptorHeap return — 47 sites, 14 of them passing only this.
  • Four counter-shapes are listed so a one-hop trace does not misfile them: 0x14080C3E0 (inner boolean pair), 0x14049E200 (C RetVal out pointer), 0x140087040 (dispatch thunk forwarding rdx/r8), 0x141993B30 (heap register reloaded from a factory global).

Tested

  • python -I scripts/check_no_game_data.py docs/d3d12_command_objects.md → exit 0
  • python -m compileall -q make_game.py tools tests → exit 0

Docs only, no code paths changed.

GPUs tested: n/a

AI-assisted: yes (OpenCode)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5476867930 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1045). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-24T17:12:41Z. --- Closes nothing (docs only). Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138270960 Item: `D3D12-HEAP-HANDLE-SLOTS`. ## What `docs/d3d12_command_objects.md` gets a new §2.1a: a byte offset is not a method, and `0x48`/`0x50` are ambiguous by offset alone. - On the **device** (`0x148759D00`) `0x48` is `CreateCommandAllocator`; `0x50` is unused. - On an **`ID3D12DescriptorHeap`** the same offsets are `GetCPUDescriptorHandleForHeapStart` (`0x48`) and `GetGPUDescriptorHandleForHeapStart` (`0x50`), because the interface inherits eight `IUnknown`/`ID3D12Object`/`ID3D12DeviceChild` slots and starts its own methods at `0x40` (`d3d12.h:5768/5775/5782`). The section states the rule (resolve the receiver, not the offset), gives the two signature shapes, and gives the counts below. §3.2's FSR note now points at it. ## Why Several pages summarise call sites as "the 29 calls at `0x48`" or "device slot 9", and a reader can carry that offset to a heap object and land two methods early/late. The pair also collides with `ID3D12CommandQueue` (`0x48` `CopyTileMappings`, `0x50` `ExecuteCommandLists`), so a replacement runtime that keys on the offset alone will wire the wrong method. ## Measurements (no game data, nothing executed) - Whole image, byte-scanning the rip-relative device load in front of every `+0x48`/`+0x50` call site: **2 device sites at `0x48`, none at `0x50`**. Both are in `0x142478440` (`0x142478B2D` `edx=0`, `0x142478C3B` `edx=2`) and pass `&IID_ID3D12CommandAllocator` (`0x1461E0658`). The other four `+0x48` sites there are two `Close` calls on the new list and two no-argument getter calls on globals. - `0x141CF3280` calls device `0x70` (`CreateDescriptorHeap`, `&IID_ID3D12DescriptorHeap` at `0x1461E0628`), then the returned heap at `0x141CF3358` (`0x48`) and `0x141CF3392` (`0x50`) with only `this`, caches the CPU handle, asserts it against the expected base, and subtracts it from the GPU handle to store the base delta. `0x141C744F0` (`0x141C74559`) uses the `0x48` return as a descriptor base and strides it by the device `0x78` increment. - Population: 33 functions call `0x70` and `0x48`; 81 call `0x70` and `0x50`. In 19 of the 99, a `+0x48`/`+0x50` receiver traces to the `CreateDescriptorHeap` return — 47 sites, 14 of them passing only `this`. - Four counter-shapes are listed so a one-hop trace does not misfile them: `0x14080C3E0` (inner boolean pair), `0x14049E200` (C `RetVal` out pointer), `0x140087040` (dispatch thunk forwarding `rdx`/`r8`), `0x141993B30` (heap register reloaded from a factory global). ## Tested - `python -I scripts/check_no_game_data.py docs/d3d12_command_objects.md` → exit 0 - `python -m compileall -q make_game.py tools tests` → exit 0 Docs only, no code paths changed. GPUs tested: n/a AI-assisted: yes (OpenCode)
morodirule commented 2026-11-24 17:14:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by morodirule on 2026-11-24T17:14:01Z.


Independent check of the ABI half (public headers only, MinGW w32api d3d12.h — no game files): ID3D12DescriptorHeap vtable order is GetDesc, GetCPUDescriptorHandleForHeapStart, GetGPUDescriptorHandleForHeapStart after 8 inherited slots (IUnknown 3 + Object 4 + DeviceChild 1), i.e. 0x40/0x48/0x50 as the new §2.1a table says; ID3D12Device order is GetNodeCount, CreateCommandQueue, CreateCommandAllocator, ... i.e. CreateCommandAllocator at 0x48, also as stated. The "no call site in the image" measurement half I cannot independently re-derive from headers — leaving that to the recorded trace. Not claiming; review evidence.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7138886431 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1045#issuecomment-7138886431). Originally posted by [morodirule](https://github.com/morodirule) on 2026-11-24T17:14:01Z. --- Independent check of the ABI half (public headers only, MinGW w32api d3d12.h — no game files): ID3D12DescriptorHeap vtable order is GetDesc, GetCPUDescriptorHandleForHeapStart, GetGPUDescriptorHandleForHeapStart after 8 inherited slots (IUnknown 3 + Object 4 + DeviceChild 1), i.e. 0x40/0x48/0x50 as the new §2.1a table says; ID3D12Device order is GetNodeCount, CreateCommandQueue, CreateCommandAllocator, ... i.e. CreateCommandAllocator at 0x48, also as stated. The "no call site in the image" measurement half I cannot independently re-derive from headers — leaving that to the recorded trace. Not claiming; review evidence.
zmasi commented 2026-11-28 23:48:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:48:09Z.


Native Windows 11 Verification (6994562bda)

Diff-audited docs/d3d12_command_objects.md (+78/-1) and verified merged onto origin/main (a9e247cd69) on Windows 11 (10.0.26200, Python 3.12.10 with -I).

Results

  • Documentation & Multi-PR Merge Suites:
    • All tests/test_docs_*.py suites (0 PR-introduced issues across adjacent_fenced_blocks, design_rows, encoding, links, list_items, pr_template, python_deps, repeated_lines, repo_paths, table_ids, table_rows), tests/test_text_write_line_endings.py (3/3), and scripts/check_no_game_data.py pass (rc=0).
    • Merges cleanly (rc=0) onto origin/main (a9e247cd69) and alongside #1056.
  • Minor x64 ABI Register Typo (docs/d3d12_command_objects.md:157):
    • In §2.1a (line 157), the device factory shape is written as (rcx = device, edx = type, rdx = &IID, r8 = &out), which lists edx and rdx (RDX) twice; in the Windows x64 ABI for CreateCommandAllocator, the four register parameters are (rcx = device, edx = type, r8 = &IID, r9 = &out).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247672998 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1045#issuecomment-7247672998). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:48:09Z. --- ### Native Windows 11 Verification (`6994562bda`) Diff-audited `docs/d3d12_command_objects.md` (`+78/-1`) and verified merged onto `origin/main` (`a9e247cd69`) on Windows 11 (`10.0.26200`, Python `3.12.10` with `-I`). #### Results - **Documentation & Multi-PR Merge Suites**: - All `tests/test_docs_*.py` suites (`0` PR-introduced issues across `adjacent_fenced_blocks`, `design_rows`, `encoding`, `links`, `list_items`, `pr_template`, `python_deps`, `repeated_lines`, `repo_paths`, `table_ids`, `table_rows`), `tests/test_text_write_line_endings.py` (`3/3`), and `scripts/check_no_game_data.py` pass (`rc=0`). - Merges cleanly (`rc=0`) onto `origin/main` (`a9e247cd69`) and alongside `#1056`. - **Minor x64 ABI Register Typo (`docs/d3d12_command_objects.md:157`)**: - In §2.1a (`line 157`), the device factory shape is written as `(rcx = device, edx = type, rdx = &IID, r8 = &out)`, which lists `edx` and `rdx` (`RDX`) twice; in the Windows x64 ABI for `CreateCommandAllocator`, the four register parameters are `(rcx = device, edx = type, r8 = &IID, r9 = &out)`. AI-assisted.
MoonEyes commented 2026-11-29 14:41:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:41:42Z.


Merged at head 6994562. Docs-only, reviewed on this head by zmasi (PASS); no test applies. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257503200 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1045#issuecomment-7257503200). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:41:42Z. --- Merged at head 6994562. Docs-only, reviewed on this head by zmasi (PASS); no test applies. AI-assisted: yes.
Sign in to join this conversation.
No reviewers
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
ProjectLeonida/mandy!1045
No description provided.