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

Open
github-bot wants to merge 1 commit from github-bot/gh-1045 into main AGit
Owner

@⁠robot00f on GitHub · 2026-11-24 17:12 UTC · original
robot00f:docs/agent2 → main · +78 −1 · 1 files · 1 commits · open

Closes nothing (docs only). Claim: #14

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)

**@⁠robot00f** on GitHub · 2026-11-24 17:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1045) `robot00f:docs/agent2` → `main` · +78 −1 · 1 files · 1 commits · open Closes nothing (docs only). Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:35:01 +00:00
Author
Owner

@⁠morodirule on GitHub · 2026-11-24 17:14 UTC · original

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.

**@⁠morodirule** on GitHub · 2026-11-24 17:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1045#issuecomment-7138886431) 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1045/head:github-bot/gh-1045'
git switch 'github-bot/gh-1045'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1045'
git switch 'github-bot/gh-1045'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1045'
git switch 'github-bot/gh-1045'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1045'
git switch 'main'
git merge --squash 'github-bot/gh-1045'
git switch 'main'
git merge --ff-only 'github-bot/gh-1045'
git switch 'main'
git merge 'github-bot/gh-1045'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.