upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:13:49 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:13:49 -0500
commitb8e738cb14f7ccdfac7c5b0f6d49dc60ad1806db (patch)
tree1e64508563825ae5ac7c0985900de9a71061d66e /docs
parentc19e132aec6afe4f482a56f67882067cf2fcf85f (diff)
parent9ead046123175cbfc772237c857b0e32074e5311 (diff)
Merge pull request #4339 from YaBulochka
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/README.md
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md1
-rw-r--r--docs/xbox_d3d12_xs.md895
2 files changed, 896 insertions, 0 deletions
diff --git a/docs/README.md b/docs/README.md
index 57e27b515..aaa378f0b 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -66,6 +66,7 @@ method, scope and caveats. No game data is included.
66| [xdxr.md](xdxr.md) | `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) from `XboxBvhBuilder.dll`'s reads; stream records' offsets and defaults; offline statistics not in the package. | 66| [xdxr.md](xdxr.md) | `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) from `XboxBvhBuilder.dll`'s reads; stream records' offsets and defaults; offline statistics not in the package. |
67| [d3d12_command_objects.md](d3d12_command_objects.md) | Measured command queue/list/fence/`PresentX` surface; verified vs prior art vs open. | 67| [d3d12_command_objects.md](d3d12_command_objects.md) | Measured command queue/list/fence/`PresentX` surface; verified vs prior art vs open. |
68| [d3d12_xs_console_abi.md](d3d12_xs_console_abi.md) | The D3D12.X console ABI the `d3d12_xs` shim must reproduce: device/queue/list vtable slots, command-list object fields and record encodings, root-argument SGPR rules, unified memory; sibling-layer measurements marked unverified here. | 68| [d3d12_xs_console_abi.md](d3d12_xs_console_abi.md) | The D3D12.X console ABI the `d3d12_xs` shim must reproduce: device/queue/list vtable slots, command-list object fields and record encodings, root-argument SGPR rules, unified memory; sibling-layer measurements marked unverified here. |
69| [xbox_d3d12_xs.md](xbox_d3d12_xs.md) | The `d3d12_xs` graphics ABI quoted from Microsoft's public GDK reference: root signatures, state objects, DXIL libraries, hit groups, shader cache sessions; which pages are missing or NDA-gated. |
69| [runtime_imports.md](runtime_imports.md) | The 16 shipped modules' measured imports and shim/host/unimplemented split. | 70| [runtime_imports.md](runtime_imports.md) | The 16 shipped modules' measured imports and shim/host/unimplemented split. |
70| [console_libraries.md](console_libraries.md) | The console-DLL surface a title can import (`d3d12_xs`, `xgameruntime`, `xmem`, `gameinput`, `xaudio2_9`, `dstorage_xs`, `xg_xs`, `AcpHal`, `chad`/`xapu`/`xcrdapi`): which are shimmed, classified or unbound. | 71| [console_libraries.md](console_libraries.md) | The console-DLL surface a title can import (`d3d12_xs`, `xgameruntime`, `xmem`, `gameinput`, `xaudio2_9`, `dstorage_xs`, `xg_xs`, `AcpHal`, `chad`/`xapu`/`xcrdapi`): which are shimmed, classified or unbound. |
71| [import_routing.md](import_routing.md) | The bind order (shim → bundled → host → unimplemented), `owns_dll` and the pseudo-handle path, per-DLL outcome. | 72| [import_routing.md](import_routing.md) | The bind order (shim → bundled → host → unimplemented), `owns_dll` and the pseudo-handle path, per-DLL outcome. |
diff --git a/docs/xbox_d3d12_xs.md b/docs/xbox_d3d12_xs.md
new file mode 100644
index 000000000..8eea48de9
--- /dev/null
+++ b/docs/xbox_d3d12_xs.md
@@ -0,0 +1,895 @@
1# The `d3d12_xs` graphics ABI, from Microsoft's public GDK reference
2
3Status: reference, sourced. This page transcribes, for the items the D3D12-to-Vulkan layer proxies, the exact C
4signatures and constraints Microsoft publishes for the Xbox GDK graphics API, and names what the public reference does
5not cover. It is not a design document and not a reimplementation guide; [d3d12_vulkan.md](d3d12_vulkan.md) holds the
6plan and [d3d12_xs_surface.md](d3d12_xs_surface.md) holds the measured export surface.
7
8Source: <https://docs.xbox.com>. The site serves Markdown per page (append `.md`) behind plain-text indexes. The path
9taken was <https://docs.xbox.com/llms.txt> → <https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference.txt>
10→ the `d3d12` sub-index → the page URLs listed in each section below. All pages were read on 2026-11-23.
11
12How to read the quotes: **Documented** means the text block is copied from the page as published, including its
13inconsistencies. Where a published block contradicts itself or cannot be the real ABI, the item is marked **Doc
14quirk** and the reason is stated; nothing is silently corrected. **Not documented in the public GDK reference** means
15the page does not exist (404) or the index does not list it, and no value is guessed.
16
17## 1. What the reference covers
18
19The graphics index has two units: `d3d12` (520 pages) and `d3d12_xs` (7 pages). The console-specific pages are thin:
20six enums (`D3D_FEATURE_LEVEL`, `D3D_NAME`, `D3D_SHADER_INPUT_TYPE`, `D3D12_MESH_SHADER_TIER`,
21`D3D12_STANDARD_MULTISAMPLE_QUALITY_LEVELS`, `D3D12_WAVE_MMA_TIER`), one function (`D3D10CreateBlob`) and one struct
22(`DXGI_ADAPTER_DESC2`) ([index](https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference.txt)).
23
24Everything about root signatures, state objects, DXIL libraries, hit groups and shader caches lives in the `d3d12`
25unit and is labelled "(XBOX Series consoles)" in its title, with `Header: d3d12_xs.h` and `Library: d3d12_xs.lib` in
26its Requirements block. Those labels are the only machine-readable difference from the PC pages; the signatures are
27the PC shapes.
28
29The `d3d12_xs/interfaces/...` paths that several `See Also` links point at (`d3d12_xs/interfaces/ID3D12StateObject/...`,
30`d3d12_xs/interfaces/ID3D12PipelineState/id3d12pipelinestate_xs.md`, `d3d12_xs/interfaces/ID3D12CommandQueue/...`) all
31return 404, and the `_llms` index does not list them. **The console interface pages are not documented in the public
32GDK reference.**
33
34## 2. Root signatures
35
36### 2.1 `D3D12_LOCAL_ROOT_SIGNATURE`
37
38```cpp
39typedef struct D3D12_LOCAL_ROOT_SIGNATURE
40{
41 ID3D12RootSignature pLocalRootSignature;
42} D3D12_LOCAL_ROOT_SIGNATURE
43```
44
45`pLocalRootSignature` is "the root signature that will function as a local root signature. A state object holds a
46reference to this signature." The subobject is optional; the global plus local signatures attached to a shader
47function must cover every resource binding the shader declares, with no overlap. If one function in a call graph is
48associated with a local root signature, every other function in that graph must use the same one or none, and the
49shader entry (the graph root) must be associated with it, because all code reachable from an entry runs from a single
50shader record carrying one set of local root arguments.
51
52Requirements: `Header: d3d12_xs.h or d3d12_x.h`, `Library: d3d12_xs.lib or d3d12_x.lib`, both console families.
53Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_local_root_signature_public.md>
54
55**Doc quirk:** the block declares `ID3D12RootSignature pLocalRootSignature;` but the member table types it
56`ID3D12RootSignature *` and the prose says the state object "holds a reference". The published block has no pointer
57star and no trailing semicolon; that is a transcription of the page, not the header.
58
59### 2.2 `D3D12_GLOBAL_ROOT_SIGNATURE`
60
61```cpp
62typedef struct D3D12_GLOBAL_ROOT_SIGNATURE
63{
64 ID3D12RootSignature pGlobalRootSignature;
65} D3D12_GLOBAL_ROOT_SIGNATURE
66```
67
68Same no-overlap rule, stated per global signature. The page adds the console constraint that matters to a replay
69layer: every shader a particular
70[`DispatchRays`](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist4/methods/id3d12graphicscommandlist4_dispatchrays_public.md)
71reaches from a command list must carry the same global root signature as the compute root signature bound on that
72command list, while one large state object may hold several global root signatures for different shader subsets.
73Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_global_root_signature_public.md>
74
75### 2.3 The graphics/compute root signature, shared with the PC shape
76
77```cpp
78typedef struct D3D12_ROOT_SIGNATURE_DESC
79{
80 UINT NumParameters;
81 const D3D12_ROOT_PARAMETER pParameters;
82 UINT NumStaticSamplers;
83 const D3D12_STATIC_SAMPLER_DESC pStaticSamplers;
84 D3D12_ROOT_SIGNATURE_FLAGS Flags;
85} D3D12_ROOT_SIGNATURE_DESC
86```
87
88`NumParameters` is "the number of slots in the root signature" and the length of `pParameters`. The page states that
89"there is one graphics root signature, and one compute root signature", and that this struct is consumed by
90`D3D12SerializeRootSignature` and returned by `ID3D12RootSignatureDeserializer::GetRootSignatureDesc`.
91Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_root_signature_desc_public.md>
92
93```cpp
94typedef struct D3D12_ROOT_PARAMETER
95{
96 D3D12_ROOT_PARAMETER_TYPE ParameterType;
97 D3D12_ROOT_DESCRIPTOR_TABLE DescriptorTable;
98 D3D12_ROOT_CONSTANTS Constants;
99 D3D12_ROOT_DESCRIPTOR Descriptor;
100 D3D12_SHADER_VISIBILITY ShaderVisibility;
101} D3D12_ROOT_PARAMETER
102```
103
104`ParameterType` selects the union member: `DescriptorTable` (ranges contiguous in a heap), `Constants` (inline
105constants that appear to the shader as one constant buffer), `Descriptor` (inline CBV/SRV/UAV). `ShaderVisibility`
106limits which shaders may read the slot.
107Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_root_parameter_public.md>
108
109```cpp
110typedef enum D3D12_ROOT_PARAMETER_TYPE
111{
112 D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0,
113 D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 0,
114 D3D12_ROOT_PARAMETER_TYPE_CBV = 0,
115 D3D12_ROOT_PARAMETER_TYPE_SRV = 0,
116 D3D12_ROOT_PARAMETER_TYPE_UAV = 0
117} D3D12_ROOT_PARAMETER_TYPE
118```
119
120**Doc quirk, and the one that matters most to a traceless implementation:** every constant is published as `0`, so
121the page cannot be used to recover the numeric values. The prose still distinguishes the five slot kinds
122(descriptor table, 32-bit constants, CBV, SRV, UAV). Take the values from the header the title is compiled against,
123not from this page.
124Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_root_parameter_type_public.md>
125
126```cpp
127typedef enum D3D_ROOT_SIGNATURE_VERSION
128{
129 D3D_ROOT_SIGNATURE_VERSION_1 = 1,
130 D3D_ROOT_SIGNATURE_VERSION_1_0 = 1,
131 D3D_ROOT_SIGNATURE_VERSION_1_1 = 2
132} D3D_ROOT_SIGNATURE_VERSION
133```
134
1351.1 is the version that adds the `D3D12_ROOT_SIGNATURE_DESC1` / `D3D12_ROOT_PARAMETER1` / `D3D12_DESCRIPTOR_RANGE1`
136family; the page links Microsoft's "Root Signature Version 1.1" article but does not restate the differences.
137Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d_root_signature_version_public.md>
138
139```cpp
140HRESULT CreateRootSignature(
141 UINT nodeMask,
142 const void pBlobWithRootSignature,
143 SIZE_T blobLengthInBytes,
144 const IID & riid,
145 void ppvRootSignature
146)
147```
148
149`nodeMask` is zero for single-GPU operation. The blob is the serialized signature produced by
150`D3D12SerializeRootSignature`; `E_INVALIDARG` means the blob is invalid. Header `d3d12_xs.h or d3d12_x.h`.
151Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public.md>
152
153`ID3D12RootSignature` itself documents only that "currently, there is one graphics and one compute root signature per
154app" and that command lists link to the resources the shaders require.
155Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12rootsignature/id3d12rootsignature_public.md>
156
157### 2.4 How the console model differs from the PC model
158
159Three differences are documented:
160
161- **A second axis: global versus local.** On the console a root signature can be attached to a state object as a
162 subobject, and the pair (global, local) is what a shader function binds. The PC root signature has no such split;
163 it is the signature bound on the command list. (§2.1, §2.2.)
164- **State objects carry root signatures by reference.** `D3D12_LOCAL_ROOT_SIGNATURE` and
165 `D3D12_GLOBAL_ROOT_SIGNATURE` hold an `ID3D12RootSignature`, so a state object outlives and ref-counts the
166 signature it was built from.
167- **The graphics/compute signature stays the PC object.** `D3D12_ROOT_SIGNATURE_DESC`, `CreateRootSignature` and the
168 `SetGraphicsRootSignature`/`SetComputeRootSignature` pair are documented with the same shapes and the same
169 `d3d12_xs.h` header, so a console title serializes and creates signatures exactly as a PC title does before the
170 state-object path enters the picture.
171
172**User-data slots: not documented in the public GDK reference.** No page in the graphics index contains the term, no
173`D3D12_ROOT_PARAMETER_TYPE_USER_DATA`-style constant appears in the published enum, and the `D3D12_SHADER_VISIBILITY`
174and `D3D12_ROOT_PARAMETER` pages describe only the three inline kinds plus descriptor tables. What the reference does
175document is the inline-constant mechanism (`D3D12_ROOT_CONSTANTS`, exposed through
176`SetGraphicsRoot32BitConstant(s)` and `SetComputeRoot32BitConstant(s)`), so any console notion of a fixed user-data
177window per stage is outside this reference. The working model in this repository is measured, not documented:
178parameters are placed inline in user SGPRs from `s4` in root order while they fit whole, and the first that does not
179fit plus everything after it go into a packed array reached through a 40-bit pointer at `s[0:1]`
180([d3d12_vulkan.md §8.2 item 3](d3d12_vulkan.md#82-unknown--open-questions)).
181
182**`D3D12_ROOT_SIGNATURE_FLAGS`: not documented in the public GDK reference.** Both
183`d3d12/enums/d3d12_root_signature_flags_public.md` and `d3d12_xs/enums/d3d12_root_signature_flags_xs.md` return 404,
184although `D3D12_ROOT_SIGNATURE_DESC::Flags` is typed by it and the PC page links the Xbox name. The console flag
185values, including the high-byte bits this repository measures as `0x03000000`
186([d3d12_vulkan.md §8.2 item 19](d3d12_vulkan.md#82-unknown--open-questions)), have no public page.
187
188## 3. State objects, DXIL libraries and hit groups
189
190### 3.1 `D3D12_STATE_SUBOBJECT_TYPE`
191
192```cpp
193typedef enum D3D12_STATE_SUBOBJECT_TYPE
194{
195 D3D12_STATE_SUBOBJECT_TYPE_STATE_OBJECT_CONFIG = 0,
196 D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE = 1,
197 D3D12_STATE_SUBOBJECT_TYPE_LOCAL_ROOT_SIGNATURE = 2,
198 D3D12_STATE_SUBOBJECT_TYPE_NODE_MASK = 3,
199 D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY = 5,
200 D3D12_STATE_SUBOBJECT_TYPE_EXISTING_COLLECTION = 6,
201 D3D12_STATE_SUBOBJECT_TYPE_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 7,
202 D3D12_STATE_SUBOBJECT_TYPE_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 8,
203 D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG = 9,
204 D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG = 10,
205 D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP = 11,
206 D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID = 0
207} D3D12_STATE_SUBOBJECT_TYPE
208```
209
210The console-relevant constraint in the constant table: a `NODE_MASK` subobject carrying node `0` is mishandled by
211some runtime versions (it should mean node 1), so the page says to write an explicit `1` or omit the subobject.
212Requirements say `Header: d3d12_x.h`, `Library: d3d12_x.lib`, `Supported Platforms: XBOX One family`, which conflicts
213with the other state-object pages that say `d3d12_xs`; treat the header line as a copy of the Xbox One page.
214
215**Doc quirk:** `D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID` is published as `0`, which collides with
216`STATE_OBJECT_CONFIG`. `4` is unused in the list; the page does not say why and does not name a type 4.
217Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_state_subobject_type_public.md>
218
219### 3.2 `D3D12_DXIL_LIBRARY_DESC`
220
221```cpp
222typedef struct D3D12_DXIL_LIBRARY_DESC
223{
224 D3D12_SHADER_BYTECODE DXILLibrary;
225 UINT NumExports;
226 D3D12_EXPORT_DESC pExports;
227} D3D12_DXIL_LIBRARY_DESC
228```
229
230Constraints the page states:
231
232- `DXILLibrary` "must have been compiled with library target 6.3 or higher".
233- The same library may appear several times in one state object or collection, or across collections, "as long as the
234 names exported each time don't conflict in a given state object".
235- `NumExports` is the length of `pExports`; `0` means "everything gets exported from the library".
236- `pExports` is optional. Requirements: `Header: d3d12_xs.h`, `Library: d3d12_xs.lib`, `XBOX Series consoles`.
237
238Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_dxil_library_desc_public.md>
239
240```cpp
241typedef struct D3D12_SHADER_BYTECODE
242{
243 const void pShaderBytecode;
244 SIZE_T BytecodeLength;
245} D3D12_SHADER_BYTECODE
246```
247
248The bytecode pointer is opaque to the API and may be a whole compiled blob as loaded from disk. This is the type the
249library, the compute PSO and the graphics PSO all carry their programs in.
250Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_bytecode_public.md>
251
252### 3.3 `D3D12_EXPORT_DESC` and `D3D12_EXPORT_FLAGS`
253
254```cpp
255typedef struct D3D12_EXPORT_DESC
256{
257 LPCWSTR Name;
258 LPCWSTR ExportToRename;
259 D3D12_EXPORT_FLAGS Flags;
260} D3D12_EXPORT_DESC
261```
262
263`Name` is the export name; for an overloaded function a compiler-modified name (retrievable from HLSL reflection)
264disambiguates. With a non-null `ExportToRename`, `Name` is the new name and must be the unmodified one, while
265`ExportToRename` may be modified or unmodified; one internal name may be exported several times under different
266renames.
267Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_export_desc_public.md>
268
269```cpp
270typedef enum D3D12_EXPORT_FLAGS
271{
272 D3D12_EXPORT_FLAG_NONE = 0
273} D3D12_EXPORT_FLAGS
274```
275
276The page states plainly that "no export flags are defined in the current release", so a layer can reject every
277non-zero flag value it sees on the console build without losing documented behaviour.
278Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_export_flags_public.md>
279
280### 3.4 `D3D12_HIT_GROUP_DESC` and `D3D12_HIT_GROUP_TYPE`
281
282```cpp
283typedef struct D3D12_HIT_GROUP_DESC
284{
285 LPCWSTR HitGroupExport;
286 D3D12_HIT_GROUP_TYPE Type;
287 LPCWSTR AnyHitShaderImport;
288 LPCWSTR ClosestHitShaderImport;
289 LPCWSTR IntersectionShaderImport;
290} D3D12_HIT_GROUP_DESC
291```
292
293`AnyHitShaderImport` and `ClosestHitShaderImport` are optional and legal for every hit-group type.
294`IntersectionShaderImport` is optional and legal only for a procedural-primitive hit group.
295Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_hit_group_desc_public.md>
296
297```cpp
298typedef enum D3D12_HIT_GROUP_TYPE
299{
300 D3D12_HIT_GROUP_TYPE_TRIANGLES = 0,
301 D3D12_HIT_GROUP_TYPE_PROCEDURAL_PRIMITIVE = 1
302} D3D12_HIT_GROUP_TYPE
303```
304
305A triangle hit group "can't contain an intersection shader"; a procedural-primitive hit group "must contain" one.
306Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_hit_group_type_public.md>
307
308### 3.5 The two raytracing configuration subobjects
309
310```cpp
311typedef struct D3D12_RAYTRACING_SHADER_CONFIG
312{
313 UINT MaxPayloadSizeInBytes;
314 UINT MaxAttributeSizeInBytes;
315} D3D12_RAYTRACING_SHADER_CONFIG
316```
317
318`MaxPayloadSizeInBytes` is the payload budget in scalars of 4 bytes; `MaxAttributeSizeInBytes` is the attribute
319budget, capped at `D3D12_RAYTRACING_MAX_ATTRIBUTE_SIZE_IN_BYTES`. A pipeline needs one such configuration; if several
320are present, for example one per collection so each compiles early, they must all match when combined.
321Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_raytracing_shader_config_public.md>
322
323```cpp
324typedef struct D3D12_RAYTRACING_PIPELINE_CONFIG
325{
326 UINT MaxTraceRecursionDepth;
327} D3D12_RAYTRACING_PIPELINE_CONFIG
328```
329
330The recursion limit "must be in the range of 0 to 31"; a `TraceRay` at the limit puts the device into removed state.
331Duplicating this subobject per collection buys no early compilation, unlike the shader config above.
332Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_raytracing_pipeline_config_public.md>
333
334### 3.6 The state-object container
335
336```cpp
337typedef struct D3D12_STATE_OBJECT_DESC
338{
339 D3D12_STATE_OBJECT_TYPE Type;
340 UINT NumSubobjects;
341 const D3D12_STATE_SUBOBJECT pSubobjects;
342} D3D12_STATE_OBJECT_DESC
343```
344
345Passed to `ID3D12Device5::CreateStateObject`; `NumSubobjects` is the length of `pSubobjects`.
346Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_state_object_desc_public.md>
347
348```cpp
349typedef struct D3D12_STATE_SUBOBJECT
350{
351 D3D12_STATE_SUBOBJECT_TYPE Type;
352 const void pDesc;
353} D3D12_STATE_SUBOBJECT
354```
355
356`Type` selects the meaning and layout of `pDesc`. The related-topics block of this page links
357`d3d12_xs/enums/d3d12_state_subobject_type_xs.md`, which 404s; the live page is the `d3d12` one in §3.1.
358Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_state_subobject_public.md>
359
360```cpp
361typedef enum D3D12_STATE_OBJECT_TYPE
362{
363 D3D12_STATE_OBJECT_TYPE_COLLECTION = 0,
364 D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE = 3
365} D3D12_STATE_OBJECT_TYPE
366```
367
368Two values only: a collection, and a raytracing pipeline. Value 3 with no documented 1 or 2 is what the page
369publishes; the enum is shared with the PC shape, where those numbers historically held graphics and compute state
370objects. A collection is the unit `D3D12_EXISTING_COLLECTION_DESC` re-exports.
371Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_state_object_type_public.md>
372
373```cpp
374typedef struct D3D12_EXISTING_COLLECTION_DESC
375{
376 ID3D12StateObject pExistingCollection;
377 UINT NumExports;
378 D3D12_EXPORT_DESC pExports;
379} D3D12_EXISTING_COLLECTION_DESC
380```
381
382The enclosing object ref-counts the collection; `NumExports` 0 exports the whole collection.
383Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_existing_collection_desc_public.md>
384
385```cpp
386typedef struct D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION
387{
388 const D3D12_STATE_SUBOBJECT pSubobjectToAssociate;
389 UINT NumExports;
390 LPCWSTR pExports;
391} D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION
392```
393
394This is how a local root signature, a shader config or another subobject is bound to named exports. `NumExports == 0`
395declares a default association, which is also what omitting the subobject means. With cross-linkage opted into
396through `D3D12_STATE_OBJECT_CONFIG`, an associated export need not exist yet in the current state object and is
397resolved later, at RTPSO creation.
398Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_subobject_to_exports_association_public.md>
399
400```cpp
401typedef struct D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION
402{
403 LPCWSTR SubobjectToAssociate;
404 UINT NumExports;
405 LPCWSTR pExports;
406} D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION
407```
408
409The whole page is one sentence: "this subobject is unsupported in the current release." It is still a valid
410`D3D12_STATE_SUBOBJECT_TYPE` value (8), so a layer sees the type and must reject it rather than guess semantics.
411Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_dxil_subobject_to_exports_association_public.md>
412
413### 3.7 Creating and querying a state object
414
415```cpp
416HRESULT CreateStateObject(
417 const D3D12_STATE_OBJECT_DESC pDesc,
418 const IID & riid,
419 void ppStateObject
420)
421```
422
423On `ID3D12Device5`. `riid` is `__uuidof(ID3D12StateObject)`. Documented failures: `E_INVALIDARG` for a bad input,
424`E_OUTOFMEMORY` for the handle. Header `d3d12_xs.h`, `Library: d3d12_xs.lib`, `XBOX Series consoles`.
425Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device5/methods/id3d12device5_createstateobject_public.md>
426
427```cpp
428const GetShaderIdentifier(
429 LPCWSTR pExportName
430)
431```
432
433On `ID3D12StateObjectProperties`. Returns a pointer to the shader identifier, valid while the state object lives, of
434`D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES`; the page recommends copying and caching it. The identifier is global to the
435shader, so the same shader in another state object with the same associations yields the same bytes, and the return
436is `nullptr` when the shader is not fully resolved.
437
438**Doc quirk:** the block omits the return type and the parameter star (`const GetShaderIdentifier(`), and the return
439value is described only as "Type: const". The prose is consistent with `const void* GetShaderIdentifier(LPCWSTR)`.
440Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12stateobjectproperties/methods/id3d12stateobjectproperties_getshaderidentifier_public.md>
441
442`ID3D12StateObjectProperties` also documents `GetShaderStackSize`, `GetPipelineStackSize` and `SetPipelineStackSize`
443for raytracing stack management
444([index](https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference/d3d12/interfaces.txt)).
445
446### 3.8 Ray-tracing library shapes
447
448The public reference documents the building blocks above and stops there. What is missing, and therefore what a layer
449cannot take from this source:
450
451- **No console RTPSO page.** `D3D12_RAYTRACING_PIPELINE_CONFIG`, `..._SHADER_CONFIG`, hit groups and the DXIL library
452 are described with PC semantics plus the console global/local root signature rules; no page describes an
453 Xbox-specific pipeline layout, shader-table format or offline pipeline object.
454- **The conceptual XDXR pages are NDA-gated.** `.../graphics/newfeatures/raytracing/index.md` is public and lists
455 cards for BVH builders, BVH compression, k-DOP and offline RTPSO, but fetching `rt-offlinertpso.md` or `rt-xdxr.md`
456 returns Microsoft's "Access restricted" page: the content requires an Xbox developer program sign-in
457 ([raytracing index](https://docs.xbox.com/build/core-features/graphics/newfeatures/raytracing/index.md)).
458- **Shader tables have no page.** `D3D12_DISPATCH_RAYS_DESC` exists in the index and `GetShaderIdentifier` describes a
459 shader record as a blob the app fills in GPU memory, but no page in the graphics reference specifies the
460 record layout beyond the identifier size constant.
461
462## 4. Shader cache sessions
463
464### 4.1 Creation
465
466```cpp
467HRESULT CreateShaderCacheSession(
468 const D3D12_SHADER_CACHE_SESSION_DESC pDesc,
469 const IID & riid,
470 void ppvSession
471)
472```
473
474On `ID3D12Device9`. Returns `DXGI_ERROR_ALREADY_EXISTS` when "you tried to create a cache with an existing
475identifier", which the description below qualifies to the case where sessions are still open. `riid` receives an
476`ID3D12ShaderCacheSession`. Header `d3d12_xs.h`, `Library: d3d12_xs.lib`, `XBOX Series consoles`.
477Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_createshadercachesession_public.md>
478
479```cpp
480typedef struct D3D12_SHADER_CACHE_SESSION_DESC
481{
482 GUID Identifier;
483 D3D12_SHADER_CACHE_MODE Mode;
484 D3D12_SHADER_CACHE_FLAGS Flags;
485 UINT MaximumInMemoryCacheSizeBytes;
486 UINT MaximumInMemoryCacheEntries;
487 UINT MaximumValueFileSizeBytes;
488 UINT64 Version;
489} D3D12_SHADER_CACHE_SESSION_DESC
490```
491
492The documented semantics of each field:
493
494- `Identifier`: caches with different identifiers are stored side by side; caches with the same identifier are shared
495 by all sessions in the process. Creating a disk cache with an existing identifier opens that cache unless `Version`
496 differs, in which case it is wiped and re-created if no other session holds it; if others do, creation fails with
497 `DXGI_ERROR_ALREADY_EXISTS`.
498- `Mode`: memory or disk (§4.2).
499- `Flags`: modifier bits (§4.3).
500- `MaximumInMemoryCacheSizeBytes`: for a memory cache the whole budget; for a disk cache the size of the staging area
501 that holds stored and found entries until newer ones evict them. **Default 1 KB.**
502- `MaximumInMemoryCacheEntries`: how many entries fit in that memory. **Default 128.**
503- `MaximumValueFileSizeBytes`: disk-cache maximum file size. **Default 128 MB.**
504- `Version`: mismatch wipes and re-creates the cache, which is the intended way to invalidate after an app update.
505
506Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public.md>
507
508### 4.2 `D3D12_SHADER_CACHE_MODE`
509
510```cpp
511typedef enum D3D12_SHADER_CACHE_MODE
512{
513 D3D12_SHADER_CACHE_MODE_MEMORY = 0,
514 D3D12_SHADER_CACHE_MODE_DISK = 0
515} D3D12_SHADER_CACHE_MODE
516```
517
518`MEMORY`: no backing file, stores are discarded with the session. `DISK`: files persist across runs until cleared
519(§4.5).
520
521**Doc quirk:** both values are published as `0`, so the page cannot be used to tell the two modes apart numerically.
522It is a transcription error in the page; a layer should accept the host runtime's value rather than assume 0 means
523disk or memory.
524Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_mode_public.md>
525
526### 4.3 `D3D12_SHADER_CACHE_FLAGS`
527
528```cpp
529typedef enum D3D12_SHADER_CACHE_FLAGS
530{
531 D3D12_SHADER_CACHE_FLAG_NONE = 0,
532 D3D12_SHADER_CACHE_FLAG_DRIVER_VERSIONED = 1,
533 D3D12_SHADER_CACHE_FLAG_USE_WORKING_DIR = 2
534} D3D12_SHADER_CACHE_FLAGS
535```
536
537`DRIVER_VERSIONED` makes the cache implicitly versioned per driver, stored side by side per adapter on multi-GPU
538systems, with `Version` as an extra constraint. `USE_WORKING_DIR` moves the cache from temporary storage (subject to
539disk cleanup) into the current working directory, and is "not valid for UWP apps".
540Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_flags_public.md>
541
542### 4.4 The session object
543
544`ID3D12ShaderCacheSession` "represents a shader cache session", is listed under `ID3D12DeviceChild` in its See Also,
545and declares four methods ([interface list](https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference/d3d12/interfaces.txt)):
546
547```cpp
548HRESULT StoreValue(
549 const void pKey,
550 UINT KeySize,
551 const void pValue,
552 UINT ValueSize
553)
554```
555
556Adds an entry. `DXGI_ERROR_ALREADY_EXISTS` for a duplicate key, `DXGI_ERROR_CACHE_HASH_COLLISION` when the hash
557matches but the key does not, `DXGI_ERROR_CACHE_FULL` when the insertion would exceed the maximum size.
558Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_storevalue_public.md>
559
560```cpp
561HRESULT FindValue(
562 const void pKey,
563 UINT KeySize,
564 void pValue,
565 UINT pValueSize
566)
567```
568
569Exact-key lookup, called twice: once for the size, once for the data. Errors are
570`DXGI_ERROR_CACHE_HASH_COLLISION` and `DXGI_ERROR_NOT_FOUND`. The page notes that in-memory temporary storage makes
571the two-call pattern cheap.
572Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_findvalue_public.md>
573
574```cpp
575D3D12_SHADER_CACHE_SESSION_DESC GetDesc(
576)
577```
578
579Returns the description the session was created with.
580Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_getdesc_public.md>
581
582`SetDeleteOnDestroy`: when all sessions for a cache are destroyed, the cache is cleared. The Remarks list the five
583documented ways a disk cache can be cleared, and the on-disk file extensions (`*.idx`, `*.val`, `*.lock`) that only
584`USE_WORKING_DIR` caches may be deleted by hand.
585Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_setdeleteondestroy_public.md>
586
587### 4.5 `ID3D12Device9::ShaderCacheControl`
588
589```cpp
590HRESULT ShaderCacheControl(
591 D3D12_SHADER_CACHE_KIND_FLAGS Kinds,
592 D3D12_SHADER_CACHE_CONTROL_FLAGS Control
593)
594```
595
596"May be used only in developer mode." `DISABLE` and `ENABLE` cannot be combined, and at least one flag is required.
597Any of the named caches may or may not exist.
598Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_shadercachecontrol_public.md>
599
600```cpp
601typedef enum D3D12_SHADER_CACHE_KIND_FLAGS
602{
603 D3D12_SHADER_CACHE_KIND_FLAG_IMPLICIT_D3D_CACHE_FOR_DRIVER = 1,
604 D3D12_SHADER_CACHE_KIND_FLAG_IMPLICIT_D3D_CONVERSIONS = 2,
605 D3D12_SHADER_CACHE_KIND_FLAG_IMPLICIT_DRIVER_MANAGED = 4,
606 D3D12_SHADER_CACHE_KIND_FLAG_APPLICATION_MANAGED = 8
607} D3D12_SHADER_CACHE_KIND_FLAGS
608```
609
610`APPLICATION_MANAGED` covers every session created by `CreateShaderCacheSession`, and a `CLEAR` on it also clears
611on-disk caches created without `USE_WORKING_DIR`.
612Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_kind_flags_public.md>
613
614```cpp
615typedef enum D3D12_SHADER_CACHE_CONTROL_FLAGS
616{
617 D3D12_SHADER_CACHE_CONTROL_FLAG_DISABLE = 1,
618 D3D12_SHADER_CACHE_CONTROL_FLAG_ENABLE = 2,
619 D3D12_SHADER_CACHE_CONTROL_FLAG_CLEAR = 4
620} D3D12_SHADER_CACHE_CONTROL_FLAGS
621```
622
623`DISABLE` also makes an attempt to use or create a cache return `DXGI_ERROR_NOT_CURRENTLY_AVAILABLE`.
624Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_control_flags_public.md>
625
626### 4.6 Support flags and the pipeline-library gate
627
628```cpp
629typedef enum D3D12_SHADER_CACHE_SUPPORT_FLAGS
630{
631 D3D12_SHADER_CACHE_SUPPORT_NONE = 0,
632 D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO = 1,
633 D3D12_SHADER_CACHE_SUPPORT_LIBRARY = 2,
634 D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = 4,
635 D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = 8
636} D3D12_SHADER_CACHE_SUPPORT_FLAGS
637```
638
639`SINGLE_PSO` (the `CachedPSO` member of the PSO descriptions) "is always supported"; `LIBRARY` is what gates
640`ID3D12PipelineLibrary`.
641Source: <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_support_flags_public.md>
642
643`D3D12_FEATURE_DATA_SHADER_CACHE` is a single `SupportFlags` field, answered by `CheckFeatureSupport` under
644`D3D12_FEATURE_SHADER_CACHE`.
645Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_feature_data_shader_cache_public.md>
646
647### 4.7 Documented limits
648
649| Limit | Value | Source |
650|---|---|---|
651| In-memory staging size, default | 1 KB | [session desc](https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public.md) |
652| In-memory entries, default | 128 | [session desc](https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public.md) |
653| Disk value file, default | 128 MB | [session desc](https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public.md) |
654| Key/value sizes | no documented cap; failures surface as `DXGI_ERROR_CACHE_FULL` | [StoreValue](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_storevalue_public.md) |
655| Console-specific cache sizes or memory budget | not documented in the public GDK reference | — |
656
657## 5. Device, queue and pipeline creation entry points
658
659### 5.1 Device
660
661**`D3D12CreateDevice` is not documented in the public GDK graphics reference.**
662`d3d12/functions/d3d12createdevice_public.md` returns 404 and the functions index lists only six free functions:
663`D3D12CreateRootSignatureDeserializer`, `D3D12CreateVersionedRootSignatureDeserializer`,
664`D3D12EnableExperimentalFeatures`, `D3D12GetDebugInterface`, `D3D12GetInterface`, `D3D12SerializeRootSignature`
665([functions list](https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference/d3d12.txt)). The console entry
666point this project calls `D3D12XboxCreateDevice` (exported by `d3d12_xs.dll` as `D3D12ConsCreateDevice`, see
667[d3d12_xs_surface.md §2.1](d3d12_xs_surface.md)) has no page under either name.
668
669What is documented next to it is the interface selector:
670
671```cpp
672HRESULT D3D12GetInterface(
673 const IID & rclsid,
674 const IID & riid,
675 void ppvDebug
676)
677```
678
679"Selects an SDK version at runtime when the system is in Windows Developer Mode." The page defines four CLSIDs
680(`CLSID_D3D12Debug`, `CLSID_D3D12Tools`, `CLSID_D3D12DeviceRemovedExtendedData`, `CLSID_D3D12SDKConfiguration`) with
681their GUID words and maps each to an interface. It creates no device.
682Source: <https://docs.xbox.com/reference/graphics/d3d12/functions/d3d12getinterface_public.md>
683
684### 5.2 Command queue
685
686```cpp
687HRESULT CreateCommandQueue(
688 const D3D12_COMMAND_QUEUE_DESC pDesc,
689 const IID & riid,
690 void ppCommandQueue
691)
692```
693
694The desc:
695
696```cpp
697typedef struct D3D12_COMMAND_QUEUE_DESC
698{
699 D3D12_COMMAND_LIST_TYPE Type;
700 INT Priority;
701 D3D12_COMMAND_QUEUE_FLAGS Flags;
702 UINT NodeMask;
703} D3D12_COMMAND_QUEUE_DESC
704```
705
706`Priority` is a `D3D12_COMMAND_QUEUE_PRIORITY` constant, `NodeMask` must set exactly one bit, and `NodeMask` 0 means
707the single-GPU case. The same struct is returned by `ID3D12CommandQueue::GetDesc`. `ID3D12Device9::CreateCommandQueue1`
708adds a creator ID and is documented separately.
709Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_command_queue_desc_public.md>,
710<https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommandqueue_public.md>
711
712### 5.3 Compute and graphics PSOs
713
714```cpp
715HRESULT CreateComputePipelineState(
716 const D3D12_COMPUTE_PIPELINE_STATE_DESC pDesc,
717 const IID & riid,
718 void ppPipelineState
719)
720```
721
722```cpp
723typedef struct D3D12_COMPUTE_PIPELINE_STATE_DESC
724{
725 ID3D12RootSignature pRootSignature;
726 D3D12_SHADER_BYTECODE CS;
727 UINT NodeMask;
728 D3D12_CACHED_PIPELINE_STATE CachedPSO;
729 D3D12_PIPELINE_STATE_FLAGS Flags;
730} D3D12_COMPUTE_PIPELINE_STATE_DESC
731```
732
733`CachedPSO` may be null/zero. `Flags` is typed by `D3D12_PIPELINE_STATE_FLAGS`, whose page is one of the 404s
734(`d3d12_xs/enums/d3d12_pipeline_state_flags_xs.md`). The returned object is immutable and "contains no methods".
735Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcomputepipelinestate_public.md>,
736<https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_compute_pipeline_state_desc_public.md>
737
738```cpp
739HRESULT CreateGraphicsPipelineState(
740 const D3D12_GRAPHICS_PIPELINE_STATE_DESC pDesc,
741 const IID & riid,
742 void ppPipelineState
743)
744```
745
746Same return contract (`E_OUTOFMEMORY` and the standard D3D12 codes) and the same immutable result. The graphics desc
747page is linked as `d3d12_x/structs/d3d12_graphics_pipeline_state_desc.md`, which is not part of the public `d3d12`
748index, so the field list is **not documented in the public GDK reference**.
749Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_creategraphicspipelinestate_public.md>
750
751**The stream-desc PSO has no page.** `D3D12_PIPELINE_STATE_STREAM_DESC` is documented and its Remarks name
752`ID3D12Device2::CreatePipelineState` as the consumer, but that method's page is absent: the
753`ID3D12Device2` entry in the interfaces index carries no methods, and
754`.../id3d12device2/methods/id3d12device2_createpipelinestate_public.md` returns 404. The struct itself is specified in
755full, including the alignment rule:
756
757```cpp
758typedef struct D3D12_PIPELINE_STATE_STREAM_DESC
759{
760 SIZE_T SizeInBytes;
761 void pPipelineStateSubobjectStream;
762} D3D12_PIPELINE_STATE_STREAM_DESC
763```
764
765The stream is "an alternating set of `D3D12_PIPELINE_STATE_SUBOBJECT_TYPE`" and its subobject, each pair aligned to
766the natural word alignment (`alignas(void*)` or a union of the whole subobject with `void*`, not of the enum alone,
767which misaligns types such as `D3D12_PRIMITIVE_TOPOLOGY_TYPE`). The pipeline kind (COMPUTE, GRAPHICS, MESH) is
768inferred from which of VS/CS/MS is non-null; none or more than one fails creation. Irrelevant subobjects are ignored,
769missing ones take defaults, duplicate or derived-duplicate subobjects fail validation.
770Source: <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_pipeline_state_stream_desc_public.md>
771
772**`D3D12_PIPELINE_STATE_SUBOBJECT_TYPE` is not documented in the public GDK reference**; its page is linked as
773`d3d12_x/enums/d3d12_pipeline_state_subobject_type.md` and is not in the index.
774
775### 5.4 Pipeline libraries
776
777```cpp
778HRESULT CreatePipelineLibrary(
779 const void pLibraryBlob,
780 SIZE_T BlobLength,
781 const IID & riid,
782 void ppPipelineLibrary
783)
784```
785
786On `ID3D12Device1`. Gate it on `CheckFeatureSupport(D3D12_FEATURE_SHADER_CACHE)` returning
787`D3D12_SHADER_CACHE_SUPPORT_LIBRARY`, otherwise the call always returns `DXGI_ERROR_NOT_SUPPORTED`. A non-empty blob
788is validated and parsed but not copied, so the caller must keep it alive for the library's lifetime; an empty blob
789starts an empty library. Documented failures: `E_INVALIDARG` (corrupt or unrecognised blob),
790`D3D12_ERROR_DRIVER_VERSION_MISMATCH` (data from an old driver or runtime), `D3D12_ERROR_ADAPTER_NOT_FOUND` (data
791from other hardware). Passing `nullptr` for the output validates the blob and returns `S_FALSE`.
792Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device1/methods/id3d12device1_createpipelinelibrary_public.md>
793
794```cpp
795HRESULT StorePipeline(
796 LPCWSTR pName,
797 ID3D12PipelineState pPipeline
798)
799```
800
801Adds a PSO under a unique name; overwriting is unsupported, and `E_INVALIDARG` means the name exists.
802Source: <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary/methods/id3d12pipelinelibrary_storepipeline_public.md>
803
804### 5.5 Present
805
806**Presentation is not documented in the public GDK graphics reference.** The graphics API index contains only
807`d3d12` and `d3d12_xs`, and the only DXGI item in either is `DXGI_ADAPTER_DESC2` under `d3d12_xs/structs`; there is no
808`IDXGISwapChain`, `DXGI_PRESENT` or `PresentX` page. The console's present entry point (`PresentX` in this
809repository's usage, [d3d12_command_objects.md](d3d12_command_objects.md)) and its frame-event handshake have no
810public page under any URL form tried, including `d3d12/functions/d3d12createdevice_public.md`'s neighbours.
811
812## 6. What this means for Leonida
813
814Mapping the documented surface onto what the layer does today. Each row names the code that would change; "gap"
815means the code is absent, not that the API is undocumented.
816
817| Area | Documented contract | State in this repository | Consequence |
818|---|---|---|---|
819| Root signature blobs | `D3D12_ROOT_SIGNATURE_DESC` 1.0/1.1, `D3D_ROOT_SIGNATURE_VERSION`, `CreateRootSignature` (§2.3) | `runtime/shims/d3d12_xs_rootsig.cpp` rewrites the measured `0x03000000` high byte and downgrades 1.2 to 1.1 before forwarding to the host serializer | Correct as a forwarding shim; the console flag semantics stay unknown because the flags enum is not published (§2.4) |
820| Console root parameters to `s0..s31` | Only `D3D12_ROOT_PARAMETER`'s three inline kinds are published; no user-data slot type (§2.4) | Measured model: inline from `s4`, spill array via a 40-bit pointer at `s[0:1]` ([d3d12_vulkan.md §8.2](d3d12_vulkan.md#82-unknown--open-questions)) | The layer cannot cite a document for the mapping; the shader-side check stays the only test |
821| State objects and RTPSOs | `CreateStateObject`, subobject enum, DXIL library, hit groups, shader/pipeline configs (§3) | No `CreateStateObject`, `DispatchRays` or `GetShaderIdentifier` in `runtime/shims/d3d12_vulkan_device.cpp` | Full DXR stays unimplemented; `RaytracingTier` is answered `NOT_SUPPORTED` and that answer is what the game reacts to |
822| DXIL library exports | Library target 6.3+, `NumExports == 0` means export all, `D3D12_EXPORT_FLAG_NONE` is the only flag (§3.2, §3.3) | Not reached: no state-object path | When a state object path is added, the export-set and rename rules are the part a translator must preserve to keep `GetShaderIdentifier` stable |
823| Graphics PSOs | `CreateGraphicsPipelineState` with `D3D12_GRAPHICS_PIPELINE_STATE_DESC`; the stream desc's alignment and kind-inference rules (§5.3) | Desc-form creation exists in `d3d12_vulkan_device.cpp`; the stream-desc `CreatePipelineState` is not implemented there (only `LoadPipeline` consumes a stream desc) | A title that builds PSOs through `ID3D12Device2` needs that path; the documented alignment rule is the spec for it |
824| Compute PSO on the console slot | `CreateComputePipelineState` (§5.3) | `d3d12_xs_device.cpp` proxies PC slots 10/11 plus the measured console compute-PSO slot 62 | The console-only entry point has three documented equivalents (compute, graphics, state object); the slot's arity is measured, not documented |
825| Draws and dispatch | `DrawInstanced`, `DrawIndexedInstanced`, `Dispatch`, root-argument setters (interfaces index) | Present and GPU-tested ([first_light.md](first_light.md)) | Nothing to change from the documentation side |
826| Shader cache | Session desc with its three documented defaults, `StoreValue`/`FindValue` two-call pattern, `ShaderCacheControl` in developer mode, library gate (§4) | Implemented with `ID3D12Device9::CreateShaderCacheSession`, the session object and `ShaderCacheControl` (D3D-34, `runtime/test/d3d12_shader_cache_test.cpp`) | The defaults (1 KB / 128 entries / 128 MB) are the numbers the layer must reproduce for a host-parity answer |
827| Present | No page (§5.5) | `runtime/shims/xbox_present.cpp` plus a DXGI swapchain fallback | The layer's presenter is built on measurement; there is no document to check it against |
828| Device creation | No `D3D12CreateDevice` page; `D3D12GetInterface` only (§5.1) | `D3D12XboxCreateDevice` with an unmeasured 24-word params block | Params and flags stay open; nothing in the public reference narrows them |
829
830Two consequences follow for how this documentation is used. First, the parts a replay layer needs most precisely
831(the enum values) are the parts this reference publishes worst: three enums in this page print colliding or all-zero
832constants, and two enum pages do not exist. Values must come from the header the layer is compiled against, with the
833prose here used only for meaning. Second, the console-specific behaviour the layer actually depends on, the root
834signature to user-SGPR mapping and the present path, is exactly what Microsoft keeps out of the public reference, so
835the measured notes in [d3d12_vulkan.md](d3d12_vulkan.md) and [d3d12_command_objects.md](d3d12_command_objects.md)
836remain the operative source for those two.
837
838## 7. Pages used
839
840| Page | URL |
841|---|---|
842| Graphics API reference | <https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference.txt> |
843| `d3d12` index | <https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference/d3d12.txt> |
844| `d3d12` interfaces index | <https://docs.xbox.com/_llms/en/apis/gdk-apis/graphics-api-reference/d3d12/interfaces.txt> |
845| `D3D12_LOCAL_ROOT_SIGNATURE` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_local_root_signature_public.md> |
846| `D3D12_GLOBAL_ROOT_SIGNATURE` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_global_root_signature_public.md> |
847| `D3D12_ROOT_SIGNATURE_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_root_signature_desc_public.md> |
848| `D3D12_ROOT_PARAMETER` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_root_parameter_public.md> |
849| `D3D12_ROOT_PARAMETER_TYPE` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_root_parameter_type_public.md> |
850| `D3D_ROOT_SIGNATURE_VERSION` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d_root_signature_version_public.md> |
851| `CreateRootSignature` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public.md> |
852| `ID3D12RootSignature` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12rootsignature/id3d12rootsignature_public.md> |
853| `D3D12_STATE_SUBOBJECT_TYPE` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_state_subobject_type_public.md> |
854| `D3D12_DXIL_LIBRARY_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_dxil_library_desc_public.md> |
855| `D3D12_SHADER_BYTECODE` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_bytecode_public.md> |
856| `D3D12_EXPORT_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_export_desc_public.md> |
857| `D3D12_EXPORT_FLAGS` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_export_flags_public.md> |
858| `D3D12_HIT_GROUP_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_hit_group_desc_public.md> |
859| `D3D12_HIT_GROUP_TYPE` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_hit_group_type_public.md> |
860| `D3D12_RAYTRACING_SHADER_CONFIG` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_raytracing_shader_config_public.md> |
861| `D3D12_RAYTRACING_PIPELINE_CONFIG` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_raytracing_pipeline_config_public.md> |
862| `D3D12_STATE_OBJECT_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_state_object_desc_public.md> |
863| `D3D12_STATE_SUBOBJECT` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_state_subobject_public.md> |
864| `D3D12_STATE_OBJECT_TYPE` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_state_object_type_public.md> |
865| `D3D12_EXISTING_COLLECTION_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_existing_collection_desc_public.md> |
866| `D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_subobject_to_exports_association_public.md> |
867| `D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_dxil_subobject_to_exports_association_public.md> |
868| `CreateStateObject` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device5/methods/id3d12device5_createstateobject_public.md> |
869| `GetShaderIdentifier` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12stateobjectproperties/methods/id3d12stateobjectproperties_getshaderidentifier_public.md> |
870| `CreateShaderCacheSession` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_createshadercachesession_public.md> |
871| `ShaderCacheControl` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_shadercachecontrol_public.md> |
872| `D3D12_SHADER_CACHE_SESSION_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public.md> |
873| `D3D12_SHADER_CACHE_MODE` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_mode_public.md> |
874| `D3D12_SHADER_CACHE_FLAGS` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_flags_public.md> |
875| `D3D12_SHADER_CACHE_KIND_FLAGS` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_kind_flags_public.md> |
876| `D3D12_SHADER_CACHE_CONTROL_FLAGS` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_control_flags_public.md> |
877| `D3D12_SHADER_CACHE_SUPPORT_FLAGS` | <https://docs.xbox.com/reference/graphics/d3d12/enums/d3d12_shader_cache_support_flags_public.md> |
878| `D3D12_FEATURE_DATA_SHADER_CACHE` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_feature_data_shader_cache_public.md> |
879| `ID3D12ShaderCacheSession` methods | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12shadercachesession/methods/id3d12shadercachesession_storevalue_public.md>, `..._findvalue_public.md`, `..._getdesc_public.md`, `..._setdeleteondestroy_public.md` |
880| `D3D12GetInterface` | <https://docs.xbox.com/reference/graphics/d3d12/functions/d3d12getinterface_public.md> |
881| `CreateCommandQueue` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommandqueue_public.md> |
882| `D3D12_COMMAND_QUEUE_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_command_queue_desc_public.md> |
883| `CreateComputePipelineState` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcomputepipelinestate_public.md> |
884| `D3D12_COMPUTE_PIPELINE_STATE_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_compute_pipeline_state_desc_public.md> |
885| `CreateGraphicsPipelineState` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_creategraphicspipelinestate_public.md> |
886| `D3D12_PIPELINE_STATE_STREAM_DESC` | <https://docs.xbox.com/reference/graphics/d3d12/structs/d3d12_pipeline_state_stream_desc_public.md> |
887| `CreatePipelineLibrary` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12device1/methods/id3d12device1_createpipelinelibrary_public.md> |
888| `StorePipeline` | <https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary/methods/id3d12pipelinelibrary_storepipeline_public.md> |
889| Raytracing concept index | <https://docs.xbox.com/build/core-features/graphics/newfeatures/raytracing/index.md> |
890
891Pages that were looked for and do not exist publicly (404): `d3d12/functions/d3d12createdevice_public.md`,
892`d3d12/enums/d3d12_root_signature_flags_public.md`, `d3d12_xs/enums/d3d12_root_signature_flags_xs.md`,
893`d3d12/interfaces/id3d12device2/methods/id3d12device2_createpipelinestate_public.md`,
894`d3d12_xs/enums/d3d12_pipeline_state_flags_xs.md`, every `d3d12_xs/interfaces/...` page, and the NDA-gated
895`rt-xdxr.md` / `rt-offlinertpso.md`.