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

Open
opened 2026-11-26 20:20:01 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1045
Author: @robot00f
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: docs/agent2


📝 Commits (1)

  • 6994562 docs(d3d12_command_objects): 0x48/0x50 are heap handle getters on heap objects

📊 Changes

1 file changed (+78 additions, -1 deletions)

View changed files

📝 docs/d3d12_command_objects.md (+78 -1)

📄 Description

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)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1045 **Author:** [@robot00f](https://github.com/robot00f) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `docs/agent2` --- ### 📝 Commits (1) - [`6994562`](https://github.com/ubiquitarianism/leonida/commit/6994562bda790af7e55775524b64c1a46d00c771) docs(d3d12_command_objects): 0x48/0x50 are heap handle getters on heap objects ### 📊 Changes **1 file changed** (+78 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_command_objects.md` (+78 -1) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#1080
No description provided.