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:
authorubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com>2026-11-23 20:14:27 -0500
committerubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com>2026-11-23 20:14:27 -0500
commit7c7b5c73e7f2a0585a9065f504dbbcd0d9b4746d (patch)
tree1c719f2213d6f7cea233d34515adc904d732c078 /docs
parentf266d1735bfa7adcd1fd843bdba3e148a53aa8b5 (diff)
parente33f4cef1936aba076d1100a5f5b48d26a10d6bd (diff)
Merge main into integrate-mirrors
Diffstat (limited to 'docs')
-rw-r--r--docs/d3d12_vulkan.md11
-rw-r--r--docs/retail_boot_chain.md10
2 files changed, 16 insertions, 5 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 0652c6c87..5f711aefa 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -1478,11 +1478,20 @@ The layer therefore owns the console VAs. It returns them from `ID3D12Resource::
1478| Address space | Two ranges. A **BDA arena** holds buffers, descriptor heaps and shader code; its device address is `heap_base`. A separate **image key range** supplies unique console VAs for images; those keys are never added to `heap_base`. The arena's `VkBuffer` is created with all buffer usages the game can bind (uniform, storage, vertex, index, indirect, transfer) plus `SHADER_DEVICE_ADDRESS`, and its memory with `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT`. | 1478| Address space | Two ranges. A **BDA arena** holds buffers, descriptor heaps and shader code; its device address is `heap_base`. A separate **image key range** supplies unique console VAs for images; those keys are never added to `heap_base`. The arena's `VkBuffer` is created with all buffer usages the game can bind (uniform, storage, vertex, index, indirect, transfer) plus `SHADER_DEVICE_ADDRESS`, and its memory with `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT`. |
1479| Buffers | A buffer resource is a range in the arena's single `VkBuffer`: offset = its console VA, size = the resource size. Buffer commands bind the arena buffer with that offset, so its device address is exactly `arena_bda + offset`; no per-resource `VkBuffer` object is needed. | 1479| Buffers | A buffer resource is a range in the arena's single `VkBuffer`: offset = its console VA, size = the resource size. Buffer commands bind the arena buffer with that offset, so its device address is exactly `arena_bda + offset`; no per-resource `VkBuffer` object is needed. |
1480| Images | Each image gets a unique console VA key and lives in its own `VkDeviceMemory` (or a suballocated device-local image heap) with optimal tiling. Shader image access goes through the T#/hash table, so nothing dereferences the key. Keeping images out of the arena avoids forcing optimal-tiled images into the arena's memory type and keeps the arena sized by buffers, not textures. | 1480| Images | Each image gets a unique console VA key and lives in its own `VkDeviceMemory` (or a suballocated device-local image heap) with optimal tiling. Shader image access goes through the T#/hash table, so nothing dereferences the key. Keeping images out of the arena avoids forcing optimal-tiled images into the arena's memory type and keeps the arena sized by buffers, not textures. |
1481| Heaps and placed resources | `CreateHeap` reserves the requested size in the arena, so a buffer placed at a 64 KiB-aligned offset is that offset into the arena and its console VA is the heap's place plus the offset. A placed texture (1D, 2D or 3D) gets its own `VkDeviceMemory` and a null VA, as in D3D12. Tiled (`64KB_UNDEFINED_SWIZZLE` and Xbox `0x101`) 2D/3D placed textures (D3D-191) and multisampled 2D placed textures (D3D-222) share that backing, answer `GetResourceAllocationInfo` and `GetResourceTiling`, and check heap/offset alignments. Reserved buffers can use heap tile mappings (section 4.2). | 1481| Heaps and placed resources | `CreateHeap` reserves the requested size in the arena, so a buffer placed at a 64 KiB-aligned offset is that offset into the arena and its console VA is the heap's place plus the offset. A placed texture (1D, 2D or 3D) gets its own `VkDeviceMemory`; one the title placed at its own address through the console's `CreatePlacedResourceX` (Xbox device slot 133) reports that title address from `GetGPUVirtualAddress`, as the console does — a title turns it into the CPU pointer it clears the texture through — while its pixels do not alias the title's pages yet. Any other texture answers a null VA, as on D3D12. Tiled (`64KB_UNDEFINED_SWIZZLE` and Xbox `0x101`) 2D/3D placed textures (D3D-191) and multisampled 2D placed textures (D3D-222) share that backing, answer `GetResourceAllocationInfo` and `GetResourceTiling`, and check heap/offset alignments. Reserved buffers can use heap tile mappings (section 4.2). |
1482| Descriptor heaps | Shader-visible CBV/SRV/UAV and sampler heaps are allocated in the low 4 GB of the arena. RTV/DSV heaps are host-side only. | 1482| Descriptor heaps | Shader-visible CBV/SRV/UAV and sampler heaps are allocated in the low 4 GB of the arena. RTV/DSV heaps are host-side only. |
1483| Shader code | Each FSSM blob is uploaded to the arena; its console VA is the code base. | 1483| Shader code | Each FSSM blob is uploaded to the arena; its console VA is the code base. |
1484| Upload/readback | `D3D12_HEAP_TYPE_UPLOAD`/`READBACK` resources are separate host-visible buffers outside the arena. Their console VAs are only used by copy APIs; if the game binds one as a vertex/index buffer or reads it in a shader, the layer biases the view/descriptor by `-heap_base` so the shader's addition lands on the host BDA (**ASSUMPTION**; **measured to fail for a V#**, see below). | 1484| Upload/readback | `D3D12_HEAP_TYPE_UPLOAD`/`READBACK` resources are separate host-visible buffers outside the arena. Their console VAs are only used by copy APIs; if the game binds one as a vertex/index buffer or reads it in a shader, the layer biases the view/descriptor by `-heap_base` so the shader's addition lands on the host BDA (**ASSUMPTION**; **measured to fail for a V#**, see below). |
1485 1485
1486**Measured (XCL, retail title, PR #168):** the console answers a placed texture's `GetGPUVirtualAddress` with the
1487address the title placed it at; the title clears a 256×256 `R32_FLOAT` texture through that value as a CPU pointer.
1488On the PC, where D3D12 answers 0 for a texture, that write went to address 0. XCL returns the title address when the
1489PC answers 0 and leaves buffers and resources with a PC address unchanged
1490([`real.rs`](https://github.com/ivall/xcl/blob/main/crates/xcl/src/hle/d3d12x/real.rs), PR
1491[#168](https://github.com/ivall/xcl/pull/168)). Facts only: XCL is GPL-2.0-only and no code is copied. This layer
1492sets a slot-133 fallback texture's `GetGPUVirtualAddress` to the title address; the image itself still does not
1493alias the title's pages.
1494
1486Non-arena buffers (upload/readback) can still be addressed by the shader without putting them in the arena: pass 1495Non-arena buffers (upload/readback) can still be addressed by the shader without putting them in the arena: pass
1487`console_va = host_bda - heap_base` (mod 2^64) in root descriptors and vertex/index/indirect views, so the shader's 1496`console_va = host_bda - heap_base` (mod 2^64) in root descriptors and vertex/index/indirect views, so the shader's
1488`heap_base + console_va` equals the host BDA. For descriptors, patch the V# base field the same way when the layer 1497`heap_base + console_va` equals the host BDA. For descriptors, patch the V# base field the same way when the layer
diff --git a/docs/retail_boot_chain.md b/docs/retail_boot_chain.md
index f46c698b9..cbe29cf83 100644
--- a/docs/retail_boot_chain.md
+++ b/docs/retail_boot_chain.md
@@ -88,10 +88,12 @@ proxy gets all 581 lists created and closed.
88Xbox device slot 133 is `(va, const D3D12_RESOURCE_DESC*, state, clear, riid, out)` with `riid = IID_ID3D12Resource` 88Xbox device slot 133 is `(va, const D3D12_RESOURCE_DESC*, state, clear, riid, out)` with `riid = IID_ID3D12Resource`
89and `state = 0xFFFFFFFF`, which isn't a valid PC state. At the first call, `va` is the start of a physical-page 89and `state = 0xFFFFFFFF`, which isn't a valid PC state. At the first call, `va` is the start of a physical-page
90range the title had just reserved, and `desc` is a buffer of that range's size with Xbox bits in `Flags` above 90range the title had just reserved, and `desc` is a buffer of that range's size with Xbox bits in `Flags` above
91the PC flags. The shape matches the console `CreatePlacedResourceX`. The local stand-in creates a committed 91the PC flags. The shape matches the console `CreatePlacedResourceX`. A buffer on those pages is imported with
92DEFAULT-heap buffer from the desc, with `Flags` limited to the PC bits and `D3D12_RESOURCE_STATE_COMMON`. It is 92`VK_EXT_external_memory_host` where the driver allows it, so the title's writes are the GPU's reads; a driver that
93not tied to the VA, so what the title writes there doesn't reach the GPU. A real implementation needs the page 93refuses falls back to a committed buffer. A texture gets a committed texture whose `GetGPUVirtualAddress` is the
94mapper (#5378) or an imported host allocation. 94title's address (the console behavior: a title clears a texture through that pointer), but its pixels do not alias
95the title's pages yet. Both paths limit `Flags` to the PC bits; the buffer path also makes the Xbox layout word
96`ROW_MAJOR`.
95 97
96The proxy's slot table must also be longer than the title's highest slot. A shorter table leaves a null pointer, 98The proxy's slot table must also be longer than the title's highest slot. A shorter table leaves a null pointer,
97not an `E_NOTIMPL`. 99not an `E_NOTIMPL`.