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-25 06:43:25 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-25 06:43:32 -0500
commit6aa5f0b0d4eae5766b56d64fc91aa2443117d5eb (patch)
treec32d8a89f524c186e8fb4d863a79d91b96217915 /runtime
parentf005d7ab223ef10adf404d62272542bf3a90f0da (diff)
parented94fbef9888f6d30970d1426d544581c2baca32 (diff)
Merge main (#1723 merged) into #622 (list value writes)
No conflicts. Brings #1723's final form: the README rows for 32 LEONIDA_* variables and indirect_clamp_test's ctest registration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt8
-rw-r--r--runtime/README.md32
2 files changed, 39 insertions, 1 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index e1a3083fa..e9cb8d434 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -1842,6 +1842,10 @@ if(TARGET Vulkan::Headers)
1842 if(MSVC) 1842 if(MSVC)
1843 target_compile_options(indirect_clamp_test PRIVATE /W4 /permissive- /utf-8) 1843 target_compile_options(indirect_clamp_test PRIVATE /W4 /permissive- /utf-8)
1844 endif() 1844 endif()
1845 if(BUILD_TESTING)
1846 add_test(NAME indirect_clamp COMMAND indirect_clamp_test)
1847 set_tests_properties(indirect_clamp PROPERTIES SKIP_RETURN_CODE 77)
1848 endif()
1845 # OpFmaKHR width gate of vk_shader_fma.h (shaderFmaFloat32 / shaderFmaFloat64): no Vulkan instance, no GPU. 1849 # OpFmaKHR width gate of vk_shader_fma.h (shaderFmaFloat32 / shaderFmaFloat64): no Vulkan instance, no GPU.
1846 add_executable(vk_shader_fma_test test/vk_shader_fma_test.cpp) 1850 add_executable(vk_shader_fma_test test/vk_shader_fma_test.cpp)
1847 target_link_libraries(vk_shader_fma_test PRIVATE Vulkan::Headers) 1851 target_link_libraries(vk_shader_fma_test PRIVATE Vulkan::Headers)
@@ -1906,7 +1910,9 @@ if(TARGET Vulkan::Headers)
1906 add_test(NAME depth24_convert COMMAND depth24_convert_test) 1910 add_test(NAME depth24_convert COMMAND depth24_convert_test)
1907 set_tests_properties(depth24_convert PROPERTIES SKIP_RETURN_CODE 77) 1911 set_tests_properties(depth24_convert PROPERTIES SKIP_RETURN_CODE 77)
1908 # Self-checking Vulkan tests with no shaders or game data; each exits 77 without a Vulkan device (TEST-514). 1912 # Self-checking Vulkan tests with no shaders or game data; each exits 77 without a Vulkan device (TEST-514).
1909 foreach(test vk_command_replay vk_predicated_copy vk_predicate_capture vk_queue indirect_clamp) 1913 # indirect_clamp is registered next to its own add_executable above, where tests/test_ctest_registration.py
1914 # can see it.
1915 foreach(test vk_command_replay vk_predicated_copy vk_predicate_capture vk_queue)
1910 add_test(NAME ${test} COMMAND ${test}_test) 1916 add_test(NAME ${test} COMMAND ${test}_test)
1911 set_tests_properties(${test} PROPERTIES SKIP_RETURN_CODE 77) 1917 set_tests_properties(${test} PROPERTIES SKIP_RETURN_CODE 77)
1912 endforeach() 1918 endforeach()
diff --git a/runtime/README.md b/runtime/README.md
index a5f0280f8..1573b8883 100644
--- a/runtime/README.md
+++ b/runtime/README.md
@@ -362,6 +362,38 @@ ones marked *diagnostic* only add log lines or exist to compare a run with and w
362| `LEONIDA_WINDOW` | unset | `WxH` resizes the title's window when the presenter attaches to it. | 362| `LEONIDA_WINDOW` | unset | `WxH` resizes the title's window when the presenter attaches to it. |
363| `LEONIDA_PRESENT_DUMP` | unset | *Diagnostic.* `DIR` or `DIR,N` writes every Nth presented frame (60 by default) as a PNG into `DIR` (`src/present_dump.h`). The files are pictures of the title: keep them out of commits, issues and pull requests. | 363| `LEONIDA_PRESENT_DUMP` | unset | *Diagnostic.* `DIR` or `DIR,N` writes every Nth presented frame (60 by default) as a PNG into `DIR` (`src/present_dump.h`). The files are pictures of the title: keep them out of commits, issues and pull requests. |
364| `LEONIDA_LOCAL_SPEECH` | unset | `1` forwards the title's speech-synthesis calls to the host's installed `xgameruntime.dll` where there is one. Unset, and wherever that library is missing, the silent voice answers. No profile sets it. | 364| `LEONIDA_LOCAL_SPEECH` | unset | `1` forwards the title's speech-synthesis calls to the host's installed `xgameruntime.dll` where there is one. Unset, and wherever that library is missing, the silent voice answers. No profile sets it. |
365| `LEONIDA_CONSOLE_FIX_US` | `4000` | Microseconds one submission may spend fixing the changed slots of a console descriptor heap's copy. Past it, each further changed slot is written as a null descriptor and queued for `LEONIDA_CONSOLE_RETRY_US`, so a shader reads it as empty until its turn comes. `0` removes the limit. |
366| `LEONIDA_CONSOLE_RETRY_US` | `500` | Microseconds one submission may spend retrying, round robin, the console heap slots not settled yet (a T# whose texture does not exist yet, or one deferred by `LEONIDA_CONSOLE_FIX_US`). `0` retries all of them at every submission. |
367| `LEONIDA_SHADOW_ALIAS_MS` | `0` | The shortest time, in milliseconds, between two copies of the title-memory pages that XMem maps at two addresses (no write guard can watch them) into the slot-133 shadows and title windows. `0` copies them at every submission; a larger value lets a GPU read of them be up to that many milliseconds behind the title's writes. |
368| `LEONIDA_REFRESH_PER_FRAME` | `0` | Trades correctness for speed. `1`: the slot-133 shadows, title windows and geometry copies are brought up to date only by the first submission after each present, not by every submission; `2`: the console descriptor heaps too. A GPU read of them can then be a frame behind the title's writes (wrong pixels). `0` refreshes all of them at every submission. |
369| `LEONIDA_GEOMETRY_ASYNC` | unset | Trades correctness for speed. `1` refreshes the geometry copies (`shims/d3d12_geometry_views.h`) on a worker thread of the layer, started at submission and not waited for, instead of on the title's submitting thread. A draw may read a copy the worker is still writing: wrong vertices for a frame. |
370| `LEONIDA_GEOMETRY_WHOLE_VIEWS` | unset | A geometry copy that is already filled copies only the 64 KiB tiles of title memory written since the last refresh (`shims/d3d12_geometry_views.h`). Any value other than `0` copies every view over a written tile whole, as before. |
371| `LEONIDA_TITLE_FILL_ASYNC` | unset | Trades correctness for speed. `1` stops device slot 70 views from hashing and filling the texture they name on the title's thread: a texture never filled or known stale is queued for a worker thread that fills one texture at a time. Until then a shader samples the image as it is, empty or a frame behind. |
372| `LEONIDA_TITLE_VIEW_REFRESH_MS` | `0` | The shortest time, in milliseconds, between two checks of a title texture's bytes when a device slot 70 view of it is written. `0` checks at every view. The periodic pass still checks the texture on its own period, and a texture known stale is checked at once. Has no effect with `LEONIDA_TITLE_FILL_ASYNC=1`. |
373| `LEONIDA_TITLE_TEXTURE_FILL_MS` | `8` | Milliseconds one pass over the textures filled from the title's memory may spend filling; a texture already started is finished. `0` removes the time limit and leaves `LEONIDA_TITLE_TEXTURE_FILL_MB` to bound the pass. |
374| `LEONIDA_MAP_READBACK` | unset | `1` writes the GPU's texels of a small render or unordered-access target the title placed into the title's pages when the title maps it, so a CPU read of the target sees what the GPU rendered (the title reads its exposure statistics that way). Only a single-row, single-mip, single-layer, single-sample 2D target of at most 4 KiB a row; the copy waits for the GPU's work already submitted, and a page that is not writable is left as it is. Unset, the title reads its own pages, which the GPU never writes. |
375| `LEONIDA_SLOT133_IMPORT` | on | *Diagnostic.* `0` imports no title-placed buffer (device slot 133) as host memory: each takes the shadow-buffer fallback, so no GPU store can reach the title's memory through an import. |
376| `LEONIDA_ARENA_NULL_MB` | `0` | `n` (MiB) keeps the first `n` MiB of the descriptor arena, at `heap_base + 0`, zeroed and never allocated, and moves the zero page and the quad indices above it. A translated shader whose address arithmetic starts from a null base then reads or writes there instead of in a title buffer or the shared zero page. Ignored when it would take half of the arena or more; the device logs the region it made. |
377| `LEONIDA_COMPUTE_HEAP_RECORDS` | unset | *Diagnostic.* With the compute input probe (`LEONIDA_COMPUTE_INPUTS`, `LEONIDA_DEVICE_FAULT=1`; [docs/d3d12_vulkan.md](../docs/d3d12_vulkan.md)), up to eight comma-separated `<table>/<slot>:<stride>:<dword>:<heap>[:<first>:<count>]` specs (`shims/d3d12_compute_input_probe.h`). Each logs `compute-heap-record` lines for the records of `stride` bytes in the buffer at root `s<table>`, descriptor `<slot>`, whose dword `<dword>` holds a resource-heap index in its low 24 bits, with `s<heap>` holding the heap's 32-bit shader address. `<first>` and `<count>` name the root dwords that hold the dispatch's first record and record count; without them the first records of the buffer are read. |
378| `LEONIDA_SLOT31_ASYNC` | unset | Trades correctness for speed. `1` makes queue slot 31 (`CopyPageMappingsBatchX`) signal the queue, hand a copy of its batches to one worker thread and return; the worker waits for that signal and maps them in call order (`shims/d3d12_xs_device.cpp`). A copy of the GPU-only window made before the worker gets there reads the old pages for a moment. Unset, the caller waits for the mapping. |
379| `LEONIDA_SLOT31_RUNS` | unset | `1` makes queue slot 31 unmap a run of pages whose mapping changes once and map one view for each stretch of consecutive pages of one section, instead of page by page (`shims/xmem.cpp`). Off by default because it was measured slower. |
380| `LEONIDA_SLOT31_CPU_TWIN` | unset | `1` repeats the page mappings queue slot 31 makes in the GPU view of the title's stream pool at the matching addresses of its CPU view (`shims/xmem.cpp`, read when the second of the pool's two reservations is noted). |
381| `LEONIDA_QUEUE_PAGE_MAPPINGS` | on | Read by `rt::xmem::queue_page_mappings_enabled()` (`shims/xmem.cpp`), where `0` turns it off. Nothing in the runtime calls that function, so the variable has no effect at present, and what it was meant to switch is not clear from the code. |
382| `LEONIDA_POOL_ZERO_PAGES` | unset | `1` answers a read by title code of an unmapped page of an XMem physical-page window by mapping a zeroed read-only page there (a "zero plant", logged), taken under the physical-mapping lock (`shims/xmem.cpp`). Unset, only a write into such a page is backed with a zeroed page. |
383| `LEONIDA_TITLE_HEAP` | unset | `1` makes the title's `XMemAlloc` blocks come from a Win32 heap of their own instead of the CRT heap (`shims/xmem.cpp`), so a GPU store through a slot-133 import past a buffer's end, or into a freed block, cannot corrupt the runtime's own objects on the same page. |
384| `LEONIDA_XMEM_SEC_COMMIT` | on under Wine | XMem's physical-page sections are committed whole under Wine; `0` reserves them and commits each page at its first touch, as on Windows, where the variable has no effect (`shims/xmem.cpp`). |
385| `LEONIDA_HANG_EXIT_S` | `0` | `s` seconds with work pending on the queues and no submission retired counts as a GPU hang the driver may recover from without reporting the device lost: the stall is reported (with checkpoints under `LEONIDA_STALL_CHECKPOINTS=1`) and the process ends with exit code `0x47` (`src/vulkan_backend.h`), so a boot does not sit until its time limit. `0` or unset never ends the process. |
386| `LEONIDA_STALL_CHECKPOINTS` | unset | *Diagnostic.* `1` makes a device-stall report also collect the NVIDIA checkpoints of every queue (`src/vulkan_device_fault.h`), which name the programs in flight. The extension only promises them for a lost device, so outside that state the call is outside its contract. |
387| `LEONIDA_PASS_TRACE` | unset | *Diagnostic.* `n`, with `LEONIDA_DEVICE_FAULT=1`: in the frame after every `n`-th present, each submission logs its compute programs in order, repeats folded (`src/vulkan_backend.h`), for the frame's pass order. |
388| `LEONIDA_GPU_LATENCY` | unset | *Diagnostic.* `1` logs, every 10 s for each queue kind, how long the GPU took from a submission's `vkQueueSubmit` to it being seen done, and the share of the wall time the queue had work (`src/vulkan_backend.h`). |
389| `LEONIDA_SUBMIT_PHASES_SECONDS` | `5` | *Diagnostic.* The period, in seconds, of the always-on line that says how many submissions there were and where their CPU time went, phase by phase (`src/submit_phases.h`). `0` turns the line off. |
390| `LEONIDA_SAMPLE_MS` | unset | *Diagnostic.* `ms` starts the thread sampler (`src/thread_sampler.h`): every `ms` milliseconds each thread of the process that used CPU since the last look is suspended just long enough to copy its context, its stack is unwound afterwards, and a periodic report lists the busiest threads and their most frequent call chains (eight frames, innermost first). |
391| `LEONIDA_SAMPLE_REPORT_S` | `10` | *Diagnostic.* Seconds between two reports of the thread sampler (`LEONIDA_SAMPLE_MS`). |
392| `LEONIDA_SAMPLE_WAITS` | unset | *Diagnostic.* `1` makes the thread sampler sample waiting threads too, not only those that used CPU, and list each thread's most frequent chain, so a thread that waits shows where. |
393| `LEONIDA_SAMPLE_DETAIL` | unset | *Diagnostic.* Comma-separated thread IDs whose samples the thread sampler also unwinds 16 frames deep, listing each such thread's ten most frequent chains. |
394| `LEONIDA_SAMPLE_SHIMS` | unset | *Diagnostic.* `1` makes the thread sampler unwind each sample deep enough to tell whether a title thread is inside the runtime (a frame of `gta6rt` called from title code) and where, and report it. |
395| `LEONIDA_AFTERMATH_SHADER_ERRORS` | unset | *Diagnostic.* With `LEONIDA_AFTERMATH=1`, `1` also sets `VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV` (`src/vulkan_aftermath.cpp`): the driver reports more shader errors, so a run can fault where it otherwise does not. |
396| `LEONIDA_AFTERMATH_KEEP_SPIRV` | unset | *Diagnostic.* With `LEONIDA_AFTERMATH=1`, `1` keeps a copy of every SPIR-V module created, for the crash-dump decoder. Off by default because the title creates gigabytes of them; the decoder then reads `<LEONIDA_SHADERS>/<name>.spv` back when its hash matches the module's. The runtime's own modules are always kept. |
365| `LEONIDA_AUDIO` | unset | `silent` (any case) makes the title's `MMDeviceEnumerator` answer every render question with the runtime's silent output endpoint, even on a host that has an output (`shims/silent_audio.cpp`, read at each `CoCreateInstance`): no host audio device is opened and every sample is thrown away, for muted test runs. Unset, or any other value, the host's endpoint answers when there is one and the silent endpoint only when the host has none. Capture keeps the host's answer either way. See [docs/runtime_imports.md](../docs/runtime_imports.md#audio-output-off-the-console-wasapi). | 397| `LEONIDA_AUDIO` | unset | `silent` (any case) makes the title's `MMDeviceEnumerator` answer every render question with the runtime's silent output endpoint, even on a host that has an output (`shims/silent_audio.cpp`, read at each `CoCreateInstance`): no host audio device is opened and every sample is thrown away, for muted test runs. Unset, or any other value, the host's endpoint answers when there is one and the silent endpoint only when the host has none. Capture keeps the host's answer either way. See [docs/runtime_imports.md](../docs/runtime_imports.md#audio-output-off-the-console-wasapi). |
366 398
367The two serializer functions and `D3D12XboxCreateDevice` are the only `d3d12_xs` imports used by the 399The two serializer functions and `D3D12XboxCreateDevice` are the only `d3d12_xs` imports used by the