diff options
| author | Moriz82 <72836413+Moriz82@users.noreply.github.com> | 2026-11-24 15:01:43 -0600 |
|---|---|---|
| committer | Moriz82 <72836413+Moriz82@users.noreply.github.com> | 2026-11-24 15:01:43 -0600 |
| commit | c8f7515e2e6fb2a2a61eb1e986ee8c6fd4431399 (patch) | |
| tree | 68fbac6e316de0e86b8cba404b6c1ab3058c99c6 /docs | |
| parent | 66d4f5aa36bb6bcd006fa4b311c7a84d809fdbad (diff) | |
d3d12: supply directly indexed heaps to compute dispatches (RT-DIRECT-HEAP-COMPUTE)
Compute shaders using direct resource indexing received a zero heap
pointer. Snapshot each bound heap offset after the explicit inline root
arguments on direct and indirect dispatches, so each command retains the
bindings it had when recorded. When the explicit arguments leave no
SGPR, keep them and report the missing heap slot once.
The placement is a hypothesis with partial evidence. Of 2,959
direct-indexing compute entries, seven could be paired with recorded
layouts. All seven resource reads agree with the predicted slot. The
other 2,952 have no paired layout, and no paired sampler read
establishes the relative heap order. tools/compute_heap_layout_census.py
reproduces the count, with synthetic tests for agreement, disagreement
and missing evidence.
Built gta6rt and d3d12_compute_test with clang-cl. The Proton Vulkan
fixture passed 64 buffer reads and 64 null controls on an RTX 4070. With
the rollback switch, all 128 controls read zero. Both runs check the
recorded arguments for bundle inheritance, indirect heap rebinding and
the last inline SGPR. The synthetic SPIR-V fixture passed validation.
AI-assisted (Codex and Claude Code agents).
Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/d3d12_vulkan.md | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index 90828d409..d2ae9d500 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -1611,8 +1611,22 @@ The game can use D3D12 descriptors in three ways, and the layer must handle all | |||
| 1611 | translator input. No stride is read at run time: static offsets of T# loads are multiples of 32 and of S# loads | 1611 | translator input. No stride is read at run time: static offsets of T# loads are multiples of 32 and of S# loads |
| 1612 | multiples of 16, so the stride is compiled into the code. In the runtime shim, `CreateRootSignature` records the | 1612 | multiples of 16, so the stride is compiled into the code. In the runtime shim, `CreateRootSignature` records the |
| 1613 | `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` and `SAMPLER_HEAP_DIRECTLY_INDEXED` root-signature flags and `SetDescriptorHeaps` | 1613 | `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` and `SAMPLER_HEAP_DIRECTLY_INDEXED` root-signature flags and `SetDescriptorHeaps` |
| 1614 | tracks the bound shader-visible heap GPU bases (`d3d12_set_descriptor_heaps`), while placing those bases into | 1614 | tracks the bound shader-visible heap GPU bases (`d3d12_set_descriptor_heaps`). |
| 1615 | per-stage user SGPRs remains open on question 3. | 1615 | |
| 1616 | **Inline compute layout (integration #984).** Run | ||
| 1617 | `python -I tools/compute_heap_layout_census.py <carve>/disasm` on each compute carve. Of 5,450 indexed compute | ||
| 1618 | entries, 2,959 advertise direct indexing and none of those embeds its root signature. Adding | ||
| 1619 | `--group fspx_compute --dispatch-log <dispatch-log>` joined seven resource-indexing entries to independently | ||
| 1620 | recorded layouts. In all seven, a dynamically indexed resource descriptor used the first SGPR after the explicit | ||
| 1621 | arguments. There were zero mismatches and zero cases without room **among those seven**. For the remaining | ||
| 1622 | 2,952 entries the layout is unknown. These are entries across carves, which can contain the same program. | ||
| 1623 | No sampler-indexing entry had a matched layout. Putting the resource heap first when both flags are set, then the | ||
| 1624 | sampler in the next dword, remains a hypothesis. D3D-329's adjacent SGPR examples alone do not establish it. | ||
| 1625 | |||
| 1626 | Each direct or indirect compute dispatch records the 32-bit arena offsets at those positions. An unbound heap | ||
| 1627 | contributes zero. Rebinding affects subsequent commands. A heap that cannot fit in the inline user data is | ||
| 1628 | reported once. `LEONIDA_COMPUTE_DIRECT_HEAPS=0` restores the previous arguments. Spilled signatures and graphics | ||
| 1629 | stages remain open on question 3. | ||
| 1616 | 3. **Game-built descriptor memory.** The game writes raw T#/S# bytes into a heap itself, without calling | 1630 | 3. **Game-built descriptor memory.** The game writes raw T#/S# bytes into a heap itself, without calling |
| 1617 | `CreateShaderResourceView`. The shaders then read those bytes exactly as in case 1. | 1631 | `CreateShaderResourceView`. The shaders then read those bytes exactly as in case 1. |
| 1618 | 1632 | ||