upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 21:05:02 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 21:05:02 -0500
commita3d4db807c03462a446fda4e7082cec163d6abe2 (patch)
tree707cc5aba0395b6667d4e64eb11083ea11e60b5d /runtime
parent7067ec7ced5a9f3bda003bf4a646eb8ffcb198ae (diff)
Attribution: four patches of graphics-runtime-patches at d9a0bc1b (GPL-3.0, smg)
graphics-root-layout, descriptor-table-refresh, descriptor-write-through and sampler-table-refresh of Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches are in #939 almost as published, about 390 lines, and only one sentence of docs/first_run_ui.md said so. That sentence now names the four, their licence and author and the files they are in, and each code region carries a comment naming its patch. Comments and one doc paragraph only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/shims/d3d12_com.h2
-rw-r--r--runtime/shims/d3d12_vulkan_device.cpp4
-rw-r--r--runtime/shims/d3d12_xs_device.cpp3
-rw-r--r--runtime/shims/d3d12_xs_device.h2
-rw-r--r--runtime/src/vulkan_backend.h2
-rw-r--r--runtime/test/d3d12_title_va_test.cpp2
6 files changed, 15 insertions, 0 deletions
diff --git a/runtime/shims/d3d12_com.h b/runtime/shims/d3d12_com.h
index 3bdb5801d..1a0a36c6b 100644
--- a/runtime/shims/d3d12_com.h
+++ b/runtime/shims/d3d12_com.h
@@ -456,6 +456,8 @@ std::unique_ptr<WindowPresenter> create_window_presenter(ID3D12Device* device, H
456// A layout that refuses the signature is marked unusable; binding the signature there invalidates the list. 456// A layout that refuses the signature is marked unusable; binding the signature there invalidates the list.
457// LEONIDA_GRAPHICS_STAGE_LAYOUT=0 keeps rt::rootsig::pack() (from s0, two dwords per address) for every graphics 457// LEONIDA_GRAPHICS_STAGE_LAYOUT=0 keeps rt::rootsig::pack() (from s0, two dwords per address) for every graphics
458// signature instead of the console layout of the vertex, pixel and geometry stages described above. 458// signature instead of the console layout of the vertex, pixel and geometry stages described above.
459// (The switch between the two packings is from the patch graphics-root-layout of
460// Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches at d9a0bc1b, author smg as "Codex", GPL-3.0.)
459inline bool local_graphics_stage_layout() { 461inline bool local_graphics_stage_layout() {
460 static const bool on = [] { const char* v = std::getenv("LEONIDA_GRAPHICS_STAGE_LAYOUT"); return !(v && *v == '0'); }(); 462 static const bool on = [] { const char* v = std::getenv("LEONIDA_GRAPHICS_STAGE_LAYOUT"); return !(v && *v == '0'); }();
461 return on; 463 return on;
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp
index 8c8f4c3b4..c272e03e9 100644
--- a/runtime/shims/d3d12_vulkan_device.cpp
+++ b/runtime/shims/d3d12_vulkan_device.cpp
@@ -1058,6 +1058,10 @@ ShadowPagesPtr make_shadow_pages(const std::uint8_t* pages, std::uint8_t* shadow
1058 1058
1059// The furthest range end is the span to refresh at submission. Sampler ranges use their full hardware 1059// The furthest range end is the span to refresh at submission. Sampler ranges use their full hardware
1060// heap limit. Buffer-view translation retains its existing per-table budget. 1060// heap limit. Buffer-view translation retains its existing per-table budget.
1061// The refresh of title-backed sampler tables (this count, the sampler entries of DeviceState::visible_heaps and the
1062// sampler-heap case of scan_title_table) is adapted from the patch sampler-table-refresh of
1063// Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches at d9a0bc1b (author smg, as "Codex"), GPL-3.0; the
1064// descriptor mapping provider registered in set_device_outer is from its patch descriptor-write-through.
1061constexpr std::uint32_t kViewScanLimit = 1024; 1065constexpr std::uint32_t kViewScanLimit = 1024;
1062std::uint32_t table_descriptor_count(const rt::rootsig::RootParameter& param) { 1066std::uint32_t table_descriptor_count(const rt::rootsig::RootParameter& param) {
1063 if (param.type != rt::rootsig::ParamType::Table || param.ranges.empty()) return 0; 1067 if (param.type != rt::rootsig::ParamType::Table || param.ranges.empty()) return 0;
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp
index 3288d9c7b..59b38ce16 100644
--- a/runtime/shims/d3d12_xs_device.cpp
+++ b/runtime/shims/d3d12_xs_device.cpp
@@ -259,6 +259,9 @@ D3D12_CPU_DESCRIPTOR_HANDLE translate_cpu_handle(const DeviceProxy* device, D3D1
259// no API call, so (1) every descriptor the layer writes for a title-backed slot is also stored at the title's address, 259// no API call, so (1) every descriptor the layer writes for a title-backed slot is also stored at the title's address,
260// and (2) when a table is bound, what the title wrote at that table's address is carried into the real heap. 260// and (2) when a table is bound, what the title wrote at that table's address is carried into the real heap.
261// LEONIDA_DESC_MIRROR=0 turns both off. 261// LEONIDA_DESC_MIRROR=0 turns both off.
262// Adapted from the patches descriptor-write-through (1) and descriptor-table-refresh (2) of
263// Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches at d9a0bc1b (author smg, as "Codex"), GPL-3.0: the functions
264// from here to local_mirror_table, DescriptorRange's stride and mapped fields and local_real_gpu_start.
262constexpr SIZE_T kLocalDescriptorBytes = 32; 265constexpr SIZE_T kLocalDescriptorBytes = 32;
263constexpr SIZE_T kLocalMirrorSlots = 64; 266constexpr SIZE_T kLocalMirrorSlots = 64;
264 267
diff --git a/runtime/shims/d3d12_xs_device.h b/runtime/shims/d3d12_xs_device.h
index a2033ca52..7e4660953 100644
--- a/runtime/shims/d3d12_xs_device.h
+++ b/runtime/shims/d3d12_xs_device.h
@@ -196,6 +196,8 @@ using ConsoleConstantView = bool (*)(ID3D12Device*, const D3D12_CONSTANT_BUFFER_
196void set_constant_view_provider(void* device, ConsoleConstantView provider); 196void set_constant_view_provider(void* device, ConsoleConstantView provider);
197// Installed by the Vulkan backend before handing the device to callers. Reports whether the exact 197// Installed by the Vulkan backend before handing the device to callers. Reports whether the exact
198// CPU span belongs to the heap's live mapped allocation. PC descriptor handles may be opaque. 198// CPU span belongs to the heap's live mapped allocation. PC descriptor handles may be opaque.
199// (From the patch descriptor-write-through of Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches at d9a0bc1b,
200// GPL-3.0.)
199using DescriptorMappingProvider = bool (*)(ID3D12DescriptorHeap* heap, SIZE_T start, SIZE_T bytes); 201using DescriptorMappingProvider = bool (*)(ID3D12DescriptorHeap* heap, SIZE_T start, SIZE_T bytes);
200void set_descriptor_mapping_provider(void* device, DescriptorMappingProvider provider); 202void set_descriptor_mapping_provider(void* device, DescriptorMappingProvider provider);
201// Called before publishing an Xbox resource when the backend can implement its depth/stencil UAV views. 203// Called before publishing an Xbox resource when the backend can implement its depth/stencil UAV views.
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index 9aad5a219..9652fd51b 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -1595,6 +1595,8 @@ public:
1595 void set_before_execute(std::function<void()> before) { before_execute_ = std::move(before); } 1595 void set_before_execute(std::function<void()> before) { before_execute_ = std::move(before); }
1596 1596
1597 // Table VAs are offsets in this device's arena. Install its scanner before creating any queues. 1597 // Table VAs are offsets in this device's arena. Install its scanner before creating any queues.
1598 // (The per-device scan is from the patch descriptor-table-refresh, part 2, of
1599 // Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches at d9a0bc1b, GPL-3.0.)
1598 using TableScanner = std::function<void(std::uint64_t, std::uint32_t)>; 1600 using TableScanner = std::function<void(std::uint64_t, std::uint32_t)>;
1599 void set_table_scanner(TableScanner scan) { table_scanner_ = std::move(scan); } 1601 void set_table_scanner(TableScanner scan) { table_scanner_ = std::move(scan); }
1600 void set_cpu_texture_publisher(std::function<bool()> f) { cpu_texture_publisher_ = std::move(f); } 1602 void set_cpu_texture_publisher(std::function<bool()> f) { cpu_texture_publisher_ = std::move(f); }
diff --git a/runtime/test/d3d12_title_va_test.cpp b/runtime/test/d3d12_title_va_test.cpp
index 75748f1e4..0adb72d25 100644
--- a/runtime/test/d3d12_title_va_test.cpp
+++ b/runtime/test/d3d12_title_va_test.cpp
@@ -553,6 +553,8 @@ int check_geometry_slab_tails(Context& c) {
553 553
554// Bind the same interior GPU handle first through a short graphics table, then a wide compute table. 554// Bind the same interior GPU handle first through a short graphics table, then a wide compute table.
555// Update its last CBV after Close and again before resubmitting the identical list. 555// Update its last CBV after Close and again before resubmitting the identical list.
556// (Adapted from the tests of the patches descriptor-table-refresh and descriptor-write-through of
557// Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches at d9a0bc1b, GPL-3.0.)
556int check_rebound_tables(Context& c, ID3D12RootSignature* narrow, bool mirror, bool api_copy) { 558int check_rebound_tables(Context& c, ID3D12RootSignature* narrow, bool mirror, bool api_copy) {
557 constexpr UINT selected = 64; 559 constexpr UINT selected = 64;
558 const auto alloc_backing = [](std::size_t n, std::uint64_t) -> void* { 560 const auto alloc_backing = [](std::size_t n, std::uint64_t) -> void* {