Improve post-load GPU memory and pipeline handling (RT-POST-LOAD-GPU-MEMORY) #2098

Manually merged
github merged 12 commits from gh-pr/2098/head into gh-pr/2098/base 2026-11-26 10:17:49 +00:00
Owner

@⁠Moriz82 on GitHub · 2026-11-25 20:31 UTC · original
pr/upstream-1125 → main · +16735 −972 · 113 files · 12 commits · merged 2026-11-26 00:01 UTC

This draft follows #1723. When the shared Vulkan buffer arena fills, an eligible committed buffer can now use a dedicated allocation. An earlier Proton run stopped during upscaler initialization when no arena slice fit the requested buffer.

Claimed as RT-POST-LOAD-GPU-MEMORY. Coordination issue

Changes

  • Update console heap descriptors on the GPU, track invalidated backing ranges, and retain upstream's host-side bitset for live buffer descriptors.
  • Journal completed pipeline cache entries, move eligible compilation work off the submission thread, and reuse compute shader seeds across runs.
  • Replay indirect mesh records through the GPU clamp. Record the original mesh dimensions before clamping and clear the counters when a readback slot is reused.
  • Preserve scripted button presses until the title reads them. Update translator handling for buffer offsets, image views, and wave64 control flow.

Independent review work overlaps the fixed-count and counted indirect mesh paths and pipeline compile workers. Fixed-count mesh dispatches · Count-buffer mesh dispatches · Pipeline compile workers

Verification

Build Result
Public rebase on db1a22d29, Linux 6,327 translator tests across 493 files, zero failing files. The descriptor-cache check passed. The compute pipeline suite ran four tests with one skip.
Public rebase, Windows x64 cross-build Release gta6rt.exe and gta6rt_tls_host.dll linked on Linux with clang-cl and the Windows SDK.
Public rebase, SPIR-V Both embedded runtime compute shaders passed Vulkan 1.2 validation. The regression for the mesh counter instructions passed.
Public rebase, repository checks Tracked-file game-data scan, forbidden extension check, added-content secret scan, and whitespace check passed.
Source integration, Linux and Proton 6,303 translator tests across 491 files, zero failing files. All 12 focused runtime suites passed, including the compute allocation fallback and pipeline cache journal.
Earlier allocation-fix build, Proton Loading ended at 170 seconds. The title frame counter advanced from 2,369 at 300 seconds to 2,830 at 600 seconds. The run recorded zero upscaler exceptions. Whether it exercised the dedicated fallback is unknown.

The public commit still needs a title boot. Native Windows and playable world rendering remain unverified.

GPU used for the source integration was an NVIDIA GeForce RTX 4070 on Linux under Proton. Public-head runtime checks are in progress.

Contributors include Plaaasma and ivanepsilondelta. AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 20:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2098) `pr/upstream-1125` → `main` · +16735 −972 · 113 files · 12 commits · merged 2026-11-26 00:01 UTC This draft follows #1723. When the shared Vulkan buffer arena fills, an eligible committed buffer can now use a dedicated allocation. An earlier Proton run stopped during upscaler initialization when no arena slice fit the requested buffer. Claimed as **RT-POST-LOAD-GPU-MEMORY**. [Coordination issue](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### Changes - Update console heap descriptors on the GPU, track invalidated backing ranges, and retain upstream's host-side bitset for live buffer descriptors. - Journal completed pipeline cache entries, move eligible compilation work off the submission thread, and reuse compute shader seeds across runs. - Replay indirect mesh records through the GPU clamp. Record the original mesh dimensions before clamping and clear the counters when a readback slot is reused. - Preserve scripted button presses until the title reads them. Update translator handling for buffer offsets, image views, and wave64 control flow. Independent review work overlaps the fixed-count and counted indirect mesh paths and pipeline compile workers. [Fixed-count mesh dispatches](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/424) · [Count-buffer mesh dispatches](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/429) · [Pipeline compile workers](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2077) ### Verification | Build | Result | | --- | --- | | Public rebase on `db1a22d29`, Linux | 6,327 translator tests across 493 files, zero failing files. The descriptor-cache check passed. The compute pipeline suite ran four tests with one skip. | | Public rebase, Windows x64 cross-build | Release gta6rt.exe and gta6rt_tls_host.dll linked on Linux with clang-cl and the Windows SDK. | | Public rebase, SPIR-V | Both embedded runtime compute shaders passed Vulkan 1.2 validation. The regression for the mesh counter instructions passed. | | Public rebase, repository checks | Tracked-file game-data scan, forbidden extension check, added-content secret scan, and whitespace check passed. | | Source integration, Linux and Proton | 6,303 translator tests across 491 files, zero failing files. All 12 focused runtime suites passed, including the compute allocation fallback and pipeline cache journal. | | Earlier allocation-fix build, Proton | Loading ended at 170 seconds. The title frame counter advanced from 2,369 at 300 seconds to 2,830 at 600 seconds. The run recorded zero upscaler exceptions. Whether it exercised the dedicated fallback is unknown. | The public commit still needs a title boot. Native Windows and playable world rendering remain unverified. GPU used for the source integration was an NVIDIA GeForce RTX 4070 on Linux under Proton. Public-head runtime checks are in progress. Contributors include Plaaasma and ivanepsilondelta. AI-assisted.
Fall back to a dedicated buffer allocation when the shared arena fills.
Update console descriptors and resource backing, preserve pipeline cache
entries, and replay mesh records using bounded indirect arguments. Keep
scripted input available until read and cover the runtime and translator
paths with synthetic tests.

Co-authored-by: Plaaasma <[email protected]>
Co-authored-by: ivanepsilondelta <[email protected]>
main d3b8251bc brings #1889 (large compiles within a memory budget), #1987 (unbound T# reasons), #1759, #1860
and others under this branch. Conflicts:

- d3d12_vulkan_device.cpp, includes: both (pipeline_cache_journal.h and large_module_gate.h).
- d3d12_vulkan_device.cpp, fix_console_slot's T# branch: main's form (counts refused_reasons, #1987), with this
  branch's comment on why a slot that is no T# is nulled. The same reason count is added to console_tsharp_check,
  the GPU console-heap path's T# registration, so its log line has the reasons too.
- d3d12_vulkan_device.cpp, the heap log: both blocks (the release filter / GPU heap lines and main's "unbound T#s by
  reason" line).
- d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile
  helper) behind main's entry: the `Work` argument and enter_build, so a large module takes its place at
  big_compile_gate() before variants_mutex_, as #1889 requires (a thread that waits for memory holds no PSO lock).
  build_compute_pipeline's own big_compile mutex now follows main's BigCompiles: taken only with
  LEONIDA_SERIAL_BIG_COMPILES=1 (it was on by default here), so the default is main's budget, not one at a time.
- d3d12_vulkan_device.cpp, queue_locked: this branch's Build-state jobs (claim, defer, finish). main's
  `requested_`/`publication` mechanism they replace is not kept. build_variant passes Work::speculative for a
  "warmup" build and Work::demand otherwise, as main's queue_build did.
- vulkan_replay.h, ComputePipeline: main's comment on `large`, and this branch's `await`.
- vulkan_backend.h: this branch's LEONIDA_SUBMIT_ASYNC block, with main's lock order in the state_mutex_ comment
  (state_mutex_ -> pipeline_mutex_ -> resource_mutex_ -> tracker_mutex_ -> submit_mutex_).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Found building #2098 with clang-cl (Make generator); each also fails on the pull request's own head:

- dxgi_swapchain_count_test: VulkanSwapchain takes a SubmitMutex& now; the test passed a std::mutex.
- vk_store_test: kind_sampled_bit/kind_storage_bit come from descriptor_table.h, which it did not include.
- d3d12_compute_journal_test listed gta6rt_indirect_count_shader's output among its sources, so Make had two rules
  for cs_indirect_dispatch_count.spv and the two glslangValidator runs raced ("Failed to open file"). It depends on
  that target now, and the second shader has a target of its own.
- tests/semantic/test_tsharp_dimension.py began with a UTF-8 BOM, which test_ci_registration's ast.parse refuses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
tests/test_docs_env_vars.py failed: LEONIDA_TEXTURE_REFRESH_ASYNC, LEONIDA_SUBMIT_ASYNC, the LEONIDA_CONSOLE_HEAP_GPU
family, the shadow GPU copies and the diagnostics this branch reads were in no document. One row each in "Switches of
the D3D12 layer for a retail boot", from the comments at the code that reads them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
OreoFR's point on #2098 holds: with LEONIDA_TEXTURE_REFRESH_ASYNC=1 the before-execute hook only wakes the refresh
worker (request_title_refresh), so a slot-133 texture the title maps, writes and uses in its next submission (a video
plane) can be read empty by that submission while the worker has not come to it.

The hook now first fills, on the submitting thread, the mapped textures that were never filled (mapped && !fills),
with try_to_lock on the registry: the worker may hold it for a fill that needs this queue, so it does not wait. A
fill that needs generic staging is left to the worker, as the pass does. Everything else stays on the worker.

Test: d3d12_mapped_plane_async (d3d12_existing_heap_test --mapped-plane-async, which sets the switch itself) maps a
written R8 plane and copies it to a readback buffer in the first submission, with host image copies and with the
staged upload; every byte must be the written one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At the maintainers' decision, main's compile path wins over #2098's second one. #2098 made every lazy PSO
asynchronous (async_build = true) and built what a submission needs in a pre-pass of VulkanQueue::execute, one
pipeline after another on the submitting thread, with a per-variant state machine (replay_get / replay_await) and a
wait budget (LEONIDA_PIPELINE_WAIT_MS, LEONIDA_PIPELINE_WAIT_FRAME_MS). That bypassed PipelineCompiles and
PipelineWorkers (parallel compiles with resource_mutex_ released, #1742) and the LargeModuleGate budget (#1889), which
d3d12_pipeline_workers(_eager) and d3d12_big_compute_* check.

Removed: the pre-pass (collect_pipeline_awaits, await_pipelines, PipelineAwait, ComputePipeline/GraphicsPipeline::
await), PipelineState's Build states, replay_get/replay_await, set_pipeline_build_hook, the wait budget and its 10 s
line, and d3d12_pipeline_wait_test, which tested only that. PipelineState is wired as on main again: async_build =
LEONIDA_ASYNC_PIPELINES, queue_build for asynchronous builds, build_compute / variant through PipelineCompiles
otherwise.

Kept from #2098, adapted to main's path:
- the record-time build request (request_pipeline_build): queue_build without counting a skip;
- compile-helper deferral: a compute build the helper is still making publishes nothing, so its next use asks again;
- big warm-ups left to their first use while the title submits (LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES):
  src/pipeline_wait.h keeps only the last-submission time this reads, noted by VulkanQueue::execute.
docs/d3d12_vulkan.md, "Pipelines still being built", says what is left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#2098's scan_title_table nulls a table V# whose base nothing backs (rebase_title_vsharp's `unbacked`). A V# the
layer wrote itself for one of its own buffers that the driver put below the arena holds the low 48 bits of a negative
offset, which the shaders read sign-extended (vsharp_address accepts it). On the RDNA2 iGPU, upload buffers live in
ReBAR memory below the arena, so the scan took such a V# for an unbacked title address and nulled it before the
dispatch read it: d3d12_compute, d3d12_fspx_compute, d3d12_unmapped_vsharp, d3d12_graphics_indirect_heap_resources
and d3d12_compile_teardown failed there and passed on lavapipe, where the buffers sit above the arena.

rebase_title_vsharp now leaves a base with bit 47 set alone when its sign-extended offset is one of the layer's
backings (gpu_backings), as vsharp_address reads it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
main's warm-up test has the warm-up thread build every compute module after a submission. Its 132 KiB modules are over
#2098's LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES (128 KiB by default), which leaves big warm-ups to their first use while
the title submits, so four of them were never started and the test's "each once" check failed. The limit is a
separate feature from the gate order the test checks; it is set to 0 for this test only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#2098 added a check that XGCreateTextureComputer refuses a render target with no layout mode (E_NOTIMPL). On main the
second (general) layout model lays out the render targets xg_xs_layout.h does not, and xg_xs_test already expects
S_OK for those ("the other render targets still use the general layout model"). The check now says the same for this
one: the explicit-mode model refuses it and the general model makes the computer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#2098's 2D mirror of a 2D-array image (BindlessSet::MirrorViews) copies storage_info, pNext chain and all, after the
block that made the storage view. That chain (VkImageViewUsageCreateInfo, VkImageViewSlicedCreateInfoEXT) was declared
inside the block, so the mirror's vkCreateImageView followed a dangling pointer into stale stack; winevulkan walked it
without end. That was the 120 s hang of d3d12_existing_heap (and its two variants), d3d12_r9g9b9e5_uav,
d3d12_depth_stencil_uav, xbox_depth_storage and xbox_d16s8_storage on lavapipe and the iGPU alike: each makes a UAV
of a 2D-array (or cube) texture. The two structs are declared before the block now.

Found with a winedbg backtrace of the hung test (bind_image_views_locked's make_mirror lambda, line 6604), then
confirmed by disabling the mirror in a scratch tree: all six tests pass then too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two conflicts:

- d3d12_com.cpp, note_direct_heap_indexing: main's console_descriptor_table_va(cbv_srv_uav_base_) for the tracked
  table, with this branch's per-site once() flag instead of note_once on every draw.
- d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile
  helper). main's dev_status::Build around the compute create moves into build_compute_pipeline, next to the
  pipeline_profile::DriverCall, so the status line still names the compute pipeline in the driver.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#2098's LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES defaulted to 128 KiB, so while the title submits it skipped exactly the
large modules main's warm-up (#1889) exists to build, with LargeModuleGate already ordering them behind a submission's
compiles. At the maintainers' decision ("main wins") it is opt-in now: unset or 0 is no limit, as on main; <n> leaves
warm-ups of modules over n bytes to their first use while the title submits, as #2098 measured with 131072.

This reverts the test-side override of fb60a1cf4: d3d12_big_compute_warmup runs with main's environment again. The
switch is documented in runtime/README.md beside the other #2098 switches, and in docs/d3d12_vulkan.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:17:47 +00:00
github manually merged commit fc71534883 into gh-pr/2098/base 2026-11-26 10:17:49 +00:00
Author
Owner

@⁠Snooozs on GitHub · 2026-11-25 20:48 UTC · original

Native Windows boot of this draft (9f98dcc61), one run. Counts only, no game data.

Machine: Windows 10 19045, RTX 5060 Ti 16 GB, NVIDIA 621.01, 32 GB RAM, own 1.0.2.1, MSVC RelWithDebInfo (builds clean). Shaders from my work folder (47,772 loaded, 0 refused), cold pipeline cache, LEONIDA_ARENA_MB=2048 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_DEVICE_TYPE=6 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_MEM_PROBE=20, no other change. Run time 431 s, ended by me. No device loss, no driver error in the event log.

Reached: the loading screens and the world start. Then it stops the same way as my runs without it: the last submission is number 2,216 at t=217 s, list values stays at 7,685 recorded / 7,528 landed (157 pending), 14 gates held, 0 met, 14 timed out (9 of them at the short timeout), while the process sits idle except for one pipeline build thread. So the draft does not cause the stall and does not remove it, on this machine (RT-LIST-VALUES-STALL-SNAPSHOT, tiguan26, is the one to watch). 825 compute and 54 graphics pipelines were made, 141.6 s and 65.2 s in vkCreate*Pipelines; indirect draws: 9,446 recorded, 512 emitted.

What it does save, against my earlier runs:

this draft my runs on main + DadaCap's mesh branch + #1592 + #1896 + #1889 + #1914
lowest free RAM in the run 8.0 GB (world start, 431 s) 2.1 to 3.5 GB (n25, n27 to n33)
peak commit of the system 42.7 GB 51 to 68 GB
longest heaps phase of a submission 88 ms up to 2.6 s without #1887 (n21: 3.6 s); 0.03 s with it (n22) while loading

Not a clean comparison: the runs differ in much (geometry copies, a 1.1 to 1.6 GB heavy pipeline cache in most of mine, host copies). One thing stands out either way: LEONIDA_MEM_PROBE says pipeline cache 0 MiB here, where mine held a 1.1 to 1.6 GB cache in memory, and the journal of this run was 791 files, 1.6 MB.

The loading was slow here: 1 to 4 frames/s from 20 to 60 s, because the cache was cold. Is there anything you want measured with a warm journal or a switch (LEONIDA_COMPILE_HELPER=1, LEONIDA_ASYNC_PIPELINES=1)? I can run it. What I would watch for: whether the helper lowers the RAM peak further.

A question on the stall, since your title frame counter advanced to 2,830 at 600 s under Proton: did list values ... recorded / landed keep moving there, and what are your last counters?

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠Snooozs** on GitHub · 2026-11-25 20:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2098#issuecomment-7174210650) Native Windows boot of this draft (`9f98dcc61`), one run. Counts only, no game data. **Machine:** Windows 10 19045, RTX 5060 Ti 16 GB, NVIDIA 621.01, 32 GB RAM, own 1.0.2.1, MSVC RelWithDebInfo (builds clean). Shaders from my work folder (47,772 loaded, 0 refused), cold pipeline cache, `LEONIDA_ARENA_MB=2048 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_DEVICE_TYPE=6 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_MEM_PROBE=20`, no other change. Run time 431 s, ended by me. No device loss, no driver error in the event log. **Reached:** the loading screens and the world start. Then it stops the same way as my runs without it: the last submission is number 2,216 at t=217 s, `list values` stays at 7,685 recorded / 7,528 landed (157 pending), 14 gates held, 0 met, 14 timed out (9 of them at the short timeout), while the process sits idle except for one pipeline build thread. So the draft does not cause the stall and does not remove it, on this machine (RT-LIST-VALUES-STALL-SNAPSHOT, tiguan26, is the one to watch). 825 compute and 54 graphics pipelines were made, 141.6 s and 65.2 s in `vkCreate*Pipelines`; indirect draws: 9,446 recorded, 512 emitted. **What it does save, against my earlier runs:** | | this draft | my runs on main + DadaCap's mesh branch + #1592 + #1896 + #1889 + #1914 | |---|---|---| | lowest free RAM in the run | **8.0 GB** (world start, 431 s) | 2.1 to 3.5 GB (n25, n27 to n33) | | peak commit of the system | 42.7 GB | 51 to 68 GB | | longest `heaps` phase of a submission | 88 ms | up to 2.6 s without #1887 (n21: 3.6 s); 0.03 s with it (n22) while loading | Not a clean comparison: the runs differ in much (geometry copies, a 1.1 to 1.6 GB heavy pipeline cache in most of mine, host copies). One thing stands out either way: `LEONIDA_MEM_PROBE` says `pipeline cache 0 MiB` here, where mine held a 1.1 to 1.6 GB cache in memory, and the journal of this run was 791 files, 1.6 MB. The loading was slow here: 1 to 4 frames/s from 20 to 60 s, because the cache was cold. Is there anything you want measured with a warm journal or a switch (`LEONIDA_COMPILE_HELPER=1`, `LEONIDA_ASYNC_PIPELINES=1`)? I can run it. What I would watch for: whether the helper lowers the RAM peak further. A question on the stall, since your title frame counter advanced to 2,830 at 600 s under Proton: did `list values ... recorded / landed` keep moving there, and what are your last counters? AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠TheGeogeo on GitHub · 2026-11-25 21:17 UTC · original · edited 2026-11-25 21:19 UTC

Overlap with #1889 (RT-BIG-COMPUTE-BUDGET), so that neither of us finds out at the merge. Read from the code of 9f98dcc6 and from trial merges; I have not built or run this pull request. I do not have the game, so I cannot test on it directly: what I check is the project's own tests and synthetic modules.

  • Conflict: this pull request is clean with main 72006d61, and has six hunks with #1889 at 0bf7ef80: d3d12_vulkan_device.cpp 5, vulkan_replay.h 1. #1889 now lists it in Depends on:; neither builds on the other, and whichever lands second rebases.
  • More than text: build_compute_pipeline keeps the static big_compile mutex for modules over 128 KiB. #1889 replaces it by default with a place at big_compile_gate() (by estimate, what a submission waits for before the warm-up), and keeps the mutex for LEONIDA_SERIAL_BIG_COMPILES=1 only. With both in, the place has to be taken before the PSO's variants_mutex_ (enter_build), because a thread that waits for memory must hold no PSO lock. LEONIDA_COMPILE_HELPER builds are in another process, so the gate does not count them; it only sees that the free memory is lower. If #1889 lands second I do that rebase.
  • A number I need: the comment at LEONIDA_COMPILE_HELPER_THREADS says about 3.5 GB of host memory for a module over 3 MB. #1889 estimates 512 bytes for each byte of SPIR-V, from synthetic modules on NVIDIA and from RADV. If those are modules near 3 MB, 3.5 GB is more than twice that. Which module sizes, GPU and driver was that, and was it one compile alone, as peak private memory of the process? If it holds, the estimate should go up, not down.

AI-assisted (Claude Code).

**@⁠TheGeogeo** on GitHub · 2026-11-25 21:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2098#issuecomment-7174865287) · edited 2026-11-25 21:19 UTC Overlap with #1889 (RT-BIG-COMPUTE-BUDGET), so that neither of us finds out at the merge. Read from the code of 9f98dcc6 and from trial merges; I have not built or run this pull request. I do not have the game, so I cannot test on it directly: what I check is the project's own tests and synthetic modules. - **Conflict:** this pull request is clean with `main` 72006d61, and has six hunks with #1889 at 0bf7ef80: `d3d12_vulkan_device.cpp` 5, `vulkan_replay.h` 1. #1889 now lists it in `Depends on:`; neither builds on the other, and whichever lands second rebases. - **More than text:** `build_compute_pipeline` keeps the static `big_compile` mutex for modules over 128 KiB. #1889 replaces it by default with a place at `big_compile_gate()` (by estimate, what a submission waits for before the warm-up), and keeps the mutex for `LEONIDA_SERIAL_BIG_COMPILES=1` only. With both in, the place has to be taken before the PSO's `variants_mutex_` (`enter_build`), because a thread that waits for memory must hold no PSO lock. `LEONIDA_COMPILE_HELPER` builds are in another process, so the gate does not count them; it only sees that the free memory is lower. If #1889 lands second I do that rebase. - **A number I need:** the comment at `LEONIDA_COMPILE_HELPER_THREADS` says about 3.5 GB of host memory for a module over 3 MB. #1889 estimates 512 bytes for each byte of SPIR-V, from synthetic modules on NVIDIA and from RADV. If those are modules near 3 MB, 3.5 GB is more than twice that. Which module sizes, GPU and driver was that, and was it one compile alone, as peak private memory of the process? If it holds, the estimate should go up, not down. AI-assisted (Claude Code).
Author
Owner

@⁠OreoFR on GitHub · 2026-11-25 21:32 UTC · original

A note on the async texture refresh (LEONIDA_TEXTURE_REFRESH_ASYNC), from working on the same pass (RT-TITLE-EVERY-BUDGET): with async on, the submission only calls request_title_refresh(), so a mapped texture that has never been filled can be sampled empty by its first draw (a video plane, for example). In my local async branch I fill only those textures (mapped && !fills) synchronously in the before-execute hook, with try_to_lock on the registry and no wait if the worker holds it (waiting could deadlock on a fill that needs this queue), then wake the worker for everything else. It only visits textures that have never been filled. Untested on your branch, just a suggestion. Our two PRs also touch the same loop in refresh_title_textures; whichever lands second rebases.

**@⁠OreoFR** on GitHub · 2026-11-25 21:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2098#issuecomment-7175213427) A note on the async texture refresh (`LEONIDA_TEXTURE_REFRESH_ASYNC`), from working on the same pass (RT-TITLE-EVERY-BUDGET): with async on, the submission only calls `request_title_refresh()`, so a mapped texture that has never been filled can be sampled empty by its first draw (a video plane, for example). In my local async branch I fill only those textures (`mapped && !fills`) synchronously in the before-execute hook, with `try_to_lock` on the registry and no wait if the worker holds it (waiting could deadlock on a fill that needs this queue), then wake the worker for everything else. It only visits textures that have never been filled. Untested on your branch, just a suggestion. Our two PRs also touch the same loop in `refresh_title_textures`; whichever lands second rebases.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 00:01 UTC · original

Merged, thanks, @⁠Moriz82, for the post-load memory and pipeline work, and to Snooozs, TheGeogeo and OreoFR for the boot run, the #1889 overlap map and the async-refresh catch.

  • Pipeline path: pipelines build through main's PipelineCompiles/PipelineWorkers path within the #1889 budget again; the pre-pass is gone, at the maintainers' decision. The record-time build request and the compile-helper deferral are kept on top of it.
  • Fixes we made: a dangling pNext chain in the 2D mirror view (the 120 s hangs in d3d12_existing_heap, d3d12_r9g9b9e5_uav, d3d12_depth_stencil_uav and the Xbox depth-storage tests); the table scan no longer nulls V#s of the layer's own upload buffers below the arena (the iGPU compute failures); three test targets that did not build, a byte-order mark, and an xg_xs check that contradicted main.
  • Async refresh: a mapped texture that was never filled is filled before its first submission (OreoFR's point), with d3d12_mapped_plane_async, which fails 3 of 3 runs without the fix.
  • Switches: LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES is opt-in (0 by default, so main's warm-up stays as it was), and 30 switches are documented.
  • Tested: the full Windows suite under Wine on llvmpipe and the gfx1036 iGPU (RADV), on main 33bd07cf8 merged with this: no pass to fail from this PR. d3d12_set_descriptor_heaps fails on main alone too, and xmem and xbox_present pass alone on llvmpipe (xbox_present fails on the iGPU with or without this PR). The translator suite passes (495 files, 6,333 tests).
  • For later: the new vk_presenter_sparse_capture fails under Wine, where creating its temp folder with an owner-rights access rule fails.
  • Checked on main 33bd07cf8 + fc7153488: it merges cleanly; the semantic suite passes (495 files, 6,333 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 113 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-26 00:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2098#issuecomment-7178308059) Merged, thanks, @⁠Moriz82, for the post-load memory and pipeline work, and to Snooozs, TheGeogeo and OreoFR for the boot run, the #1889 overlap map and the async-refresh catch. - **Pipeline path:** pipelines build through `main`'s `PipelineCompiles`/`PipelineWorkers` path within the #1889 budget again; the pre-pass is gone, at the maintainers' decision. The record-time build request and the compile-helper deferral are kept on top of it. - **Fixes we made:** a dangling `pNext` chain in the 2D mirror view (the 120 s hangs in `d3d12_existing_heap`, `d3d12_r9g9b9e5_uav`, `d3d12_depth_stencil_uav` and the Xbox depth-storage tests); the table scan no longer nulls V#s of the layer's own upload buffers below the arena (the iGPU compute failures); three test targets that did not build, a byte-order mark, and an `xg_xs` check that contradicted `main`. - **Async refresh:** a mapped texture that was never filled is filled before its first submission (OreoFR's point), with `d3d12_mapped_plane_async`, which fails 3 of 3 runs without the fix. - **Switches:** `LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES` is opt-in (0 by default, so `main`'s warm-up stays as it was), and 30 switches are documented. - **Tested:** the full Windows suite under Wine on llvmpipe and the gfx1036 iGPU (RADV), on `main` `33bd07cf8` merged with this: no pass to fail from this PR. `d3d12_set_descriptor_heaps` fails on `main` alone too, and `xmem` and `xbox_present` pass alone on llvmpipe (`xbox_present` fails on the iGPU with or without this PR). The translator suite passes (495 files, 6,333 tests). - **For later:** the new `vk_presenter_sparse_capture` fails under Wine, where creating its temp folder with an owner-rights access rule fails. - **Checked on `main` `33bd07cf8` + `fc7153488`:** it merges cleanly; the semantic suite passes (495 files, 6,333 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 113 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠ammonium231 on GitHub · 2026-11-26 14:16 UTC · original

RTX 3090 / 621.40: xbox_present fails the resize present_planes check (xbox_present_test.cpp:1226 on main). First bad is 9f98dcc61; reverting only its captured_ gating in vulkan_present.h passes. After a resize recreate captured_ stays false, so read_back fails. LEONIDA_COMPILE_GATE=0 and the dxgi_swapchain.h hunk don't change the result.

**@⁠ammonium231** on GitHub · 2026-11-26 14:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2098#issuecomment-7194550597) RTX 3090 / 621.40: xbox_present fails the resize present_planes check (xbox_present_test.cpp:1226 on main). First bad is 9f98dcc61; reverting only its captured_ gating in vulkan_present.h passes. After a resize recreate captured_ stays false, so read_back fails. LEONIDA_COMPILE_GATE=0 and the dxgi_swapchain.h hunk don't change the result.
This discussion has been locked. Commenting is limited to contributors.
No description provided.