mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #2141] [MERGED] d3d12: remap directly-indexed heaps to arena shader VA (RT-DIRECT-HEAP-ARENA-REMAP) #2148
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2148
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2141
Author: @abnalstlll-byte
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:feat/rt-direct-heap-arena-remap📝 Commits (1)
92170fed3d12: remap directly-indexed heaps to arena shader VA (RT-DIRECT-HEAP-ARENA-REMAP)📊 Changes
3 files changed (+36 additions, -10 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+4 -1)📝
runtime/shims/d3d12_com.cpp(+18 -9)📝
runtime/test/d3d12_set_descriptor_heaps_test.cpp(+14 -0)📄 Description
Remap directly indexed CBV/SRV/UAV and sampler heap console base addresses to arena shader virtual addresses in user SGPRs.
Problem
In
write_direct_heaps(), the bound resource and sampler heaps were passed into user SGPRs using rawcbv_srv_uav_base_andsampler_base_. For console descriptor heaps shadowed in the GPU address arena (where the title's pages are mirrored/shadowed into the GPU address arena so thatheap_base + VAreaches them), passing raw console base addresses gave shaders the host title virtual address (e.g.0x34ab42000) rather than the arena copy's shader VA (console_shader_va_).When compute shaders (such as
lib_cs_01405/01410/01455/00863/00867) or graphics shaders index directly into the resource heap usings[end]during the world load transition (~200s), addingheap_base + s[end]attempted to read unmapped memory outside the arena, triggering GPU device loss (READ_INVALID). Notice thatrecord_dispatch()diagnostic logging already distinguishedbound-heap(raw console base) fromshader-heap(console_descriptor_table_va(cbv_srv_uav_base_)), butwrite_direct_heaps()andnote_direct_heap_indexing()passed the raw console base.Solution
write_direct_heaps(): passconsole_descriptor_table_va(cbv_srv_uav_base_)andconsole_descriptor_table_va(sampler_base_)into the user SGPR data dwords. For ordinary unshadowed heaps,console_descriptor_table_va()returns the address unchanged.note_direct_heap_indexing(): trackremember_table(console_descriptor_table_va(cbv_srv_uav_base_), ...)using the translated shader VA so table origin tracking correlates properly.graphics_user_data(): log the remapped shader VA for diagnostic consistency.runtime/test/d3d12_set_descriptor_heaps_test.cpp: assert that recorded dispatch user data dwords receive the remappedconsole_descriptor_table_vaaddresses atcompute_arguments_end.docs/d3d12_vulkan.mdwith the direct heap arena remapping contract.Verification
python -I scripts/check_no_game_data.py runtime/shims/d3d12_com.cpp runtime/test/d3d12_set_descriptor_heaps_test.cpp docs/d3d12_vulkan.md-> 0 violations.python -I tests/test_text_write_line_endings.py-> 3/3 PASS.python -m compileall -q make_game.py tools tests-> Clean.ninja -C runtime/build_portable descriptor_table_test root_signature_test title_va_alias_test console_heap_vsharp_slots_test-> All PASS.AI-assisted (Claude Code, Claude Opus 5.5).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.