d3d12_command_objects §3.3: the builder's `+0x490` call has 29 sites (18 hoisted through `r9`), and the arguments match `D3D12_GLOBAL_BARRIER` byte for byte

Aperta
#1,626 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
12/100
Tipo di issue
Documentazione
Chiarezza
Da chiarire
Stato di attività
Attiva
Ambito
documentation

Direzione di ricerca

This is a static-analysis correction to section 3.3 and 3.5a of docs/d3d12_command_objects.md, not a code change. Read the doc's 3.3 table and the 3.5a slot-85 row, then check the claimed 29 call sites of [reg+0x490] in XboxBvhBuilder.dll against the .pdata-segmented disassembly described in the issue. Done means the doc's wording reflects the verified site count and the slot-85 note, with the reproduction steps reproducible by a reviewer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Read against docs/d3d12_command_objects.md @ 3a346edf (unchanged since #1469 / #1470). Two additions to section 3.3 and one small note on 3.5a. Static analysis only, no runtime step; no game bytes below, only sizes, sha256, RVAs and counts.

1. Independent check of the Barrier reading

We checked your reading against the public header (DirectX-Headers 61c7718, MIT) on our own bytes rather than against your doc:

  • the 16 bytes at RVA 0xcdf60 are {0x80, 0x80, 0x10, 0x10}, which is exactly D3D12_GLOBAL_BARRIER{SYNC_COMPUTE_SHADING, SYNC_COMPUTE_SHADING, ACCESS_UNORDERED_ACCESS, ACCESS_UNORDERED_ACCESS} with both enum values read straight out of d3d12.h;
  • the record passed in R8 is 16 bytes, {Type, NumBarriers = 1, pointer}, which matches D3D12_BARRIER_GROUP with Type = D3D12_BARRIER_TYPE_GLOBAL;
  • the 16-byte payload also rules out D3D12_BUFFER_BARRIER (40 B) and D3D12_TEXTURE_BARRIER (48 B), so GLOBAL is locked from both directions;
  • the return value is never read after any of the calls, which is consistent with Barrier returning void.

So your identification holds on the bytes, not only on the shape. We cannot confirm the console-slot 146 → GCL7 slot 80 mapping from the package (it has no d3d12_xs.dll), so this corroborates the arguments, not the slot number.

2. There are 29 call sites, not the two in the table

On XboxBvhBuilder.dll (size 884224, sha256 99f803ac22c01ef329dddb1d40be67238d2a812d01e8d040b3cb5135bc23707e, the entry in game/xbox-1.0.2.1.json), enumerating indirect calls through [reg+0x490] over the whole .text (bases rsp/rbp/rip excluded) gives 29 sites in 7 functions. Your table lists two of them.

Form Count RVAs
call qword ptr [rax+0x490] 11 0xd7b4, 0xd80a, 0x14fcb, 0x15443, 0x1d786, 0x1da02, 0x1ef71, 0x1f060, 0x1f113, 0x1f174, 0x1f260
mov r9,[rax+0x490] … call r9 18 0xea86, 0xef64, 0xf0bc, 0xf1c1, 0xf459, 0xf4ca, 0xf7a4, 0xf812, 0xfb0e, 0xfb7c, 0xfe7e, 0xfeef, 0x103da, 0x10449, 0x1054c, 0x105b9, 0x10d1a, 0x10db7 (the mov)
Function (.pdata) Direct Hoisted
0xd580 (chained fragment 0xd5b8–0xd827) 2 —
0x14700 (fragment 0x14f7e–0x1546c) 2 —
0x1d540 1 (0x1d786) —
0x1d7c0 1 (0x1da02) —
0x1ee50 5 —
0xe6a0 — 16
0x10a80 — 2

At all 29 sites:

  • the same 16-byte constant from RVA 0xcdf60 is loaded (vmovdqu) and stored to a stack slot; the whole .text has exactly 29 references to that constant, one per site;
  • +4 of the R8 record is 1 and +8 points at that stack copy; the Type word is a literal 0 at most sites and comes from a xor-zeroed register at the rest;
  • at the four sites where EDX comes from lea edx,[r12+1] / lea edx,[r13+1] (leas at 0xf0ca, 0xf4d8, 0xfb8a, 0x10457; calls at 0xf0cf, 0xf4dd, 0xfb8f, 0x1045b), the index register is zeroed on every path, so the count is 1 there as well.

0x1d786 (in 0x1d540, which 3.3 already names as one of the two inner functions) is a third direct site that no row lists. 0xe6a0 receives the command list as its second argument and stores it at [rbp+0x578] (+8 of a stack record); every inner call takes the list from there.

How to reproduce
  • Byte identity only: game/xbox-1.0.2.1.json (size 884224, sha256 99f803ac…3707e). Every number is an RVA from image base 0x180000000.
  • Disassemble with capstone, segmented by the .pdata RUNTIME_FUNCTION table (449 entries), resolving chained unwind (0xd5b8 → 0xd580, 0x14f7e → 0x1483d → 0x14700). A flat linear sweep desyncs at jump tables.
  • Collect both forms: call qword ptr [reg+0x490], and mov r9,[reg+0x490] followed by call r9. Expected: 11 + 18 = 29.
What it changes
  • Section 3.3 / 3.3a: "A second call site with the same constant is 0xd7b4" could read "29 sites across .text; the rows are a subset".
  • Anything that counts, records or intercepts this call has to handle the hoisted form: a call [reg+disp]-only scan sees 11 of 29.
  • It is not a one-shot call: 16 of the 18 hoisted sites sit in 0xe6a0's per-element loop (the counter increments and branches back), so a slot-146 stub that returns E_NOTIMPL fails once per element, not once per build. Since the return value is never read, a failing stub is silent; a no-op would drop a UAV barrier.

3. Small note on 3.5a, console slot 85

The PC-slot cell for 85 is "—" while the Method column already says CopyTextureRegion shape (PC 16). Filling the PC-slot cell with 16 (inferred) would keep "—" meaning only what it means for 141, 146 and 148 (no PC slot at any width). The distinction matters for the §5.2 proxy bullets: offset 0x2a8 / 8 = 85 is inside the widest PC list (ID3D12GraphicsCommandList12 has 98 slots; 85 is DispatchGraph, first present in GCL10), so a bounds check sized to the PC list does not protect console slot 85 — a PC-ordered table answers it with DispatchGraph. Fail-closed has to key on identity, not on the bound. Byte check: on amd_fidelityfx_upscaler_xbox.dll (sha256 faff02f2…a75fa), displacements at or past 0x288 (beyond GCL8's last slot, 81) occur exactly three times: 0x65f8 (+0x468, 141), and 0x7147 / 0x7191 (+0x2a8, 85).

What we are not claiming

  • No runtime measurement, and nothing about the game's main executable; static analysis of the two shipped DLLs at the sha256 above.
  • Not the console-slot 146 → PC slot 80 mapping (see section 1), and not that console 85 is DispatchGraph.
  • Not exhaustive coverage: a computed slot index or an indirect jump table would not appear in this enumeration.

AI-assisted: prepared with an AI coding agent and reviewed by a human before posting.

Lingua principale
Python
Stelle
14.9k
Fork
1.2k
Merge medio
1h 58m
PR unite (30g)
40

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ItsNotRexed/Leonida

Tutte le issue di ItsNotRexed/Leonida

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.