Repository navigation
d3d12: the title texture pass can time-box its mapped and stale visits (RT-TITLE-EVERY-BUDGET) - #2122
Merged
Merged
Conversation
…s (RT-TITLE-EVERY-BUDGET) LEONIDA_TITLE_EVERY_BUDGET_US (0, the default: unchanged) limits how long one pass of refresh_title_textures spends on the textures it visits every pass (mapped by the title, or known stale). The visits resume from a cursor of their own, so every marked texture gets its turn; the texture that crosses the limit is finished. A mapped texture never filled yet is visited first whatever the limit, so a video plane is not left empty until its turn. The pass stays synchronous, before the submission, as today. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JordanWebDev
approved these changes
Nov 25, 2026
ProjectLeonida#2098 split the every-pass loop of refresh_title_textures by mode: with LEONIDA_TEXTURE_REFRESH_ASYNC every persistent mapping is polled each pass and only stale unmapped textures are visited, without it all mapped or stale ones are. The async branch is kept as main has it. LEONIDA_TITLE_EVERY_BUDGET_US applies to the synchronous pass, the one before a submission on the submitting thread; under async the pass runs on the refresh worker and the limit does not apply (README says so). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Merged, thanks! A good lever for the streaming bursts that stall the submitting thread.
AI-assisted (Claude Code, Claude Opus 5.5). |
4 tasks done
Kokonotcu
added a commit
to Kokonotcu/leonida
that referenced
this pull request
Nov 26, 2026
16 upstream commits after 33bd07c, mostly ProjectLeonida#2098 (post-load GPU memory and pipeline handling) and ProjectLeonida#2122 (the title-texture pass time box). The rules of the earlier merges stand; what this one decided: ProjectLeonida#2098 - GPU console-heap fix (console_heap_gpu.h, console_heap_fix.comp/.inc): taken, opt-in (LEONIDA_CONSOLE_HEAP_GPU, with LEONIDA_CONSOLE_HEAP_VA for the console-addressed heap). Our CPU title-heap sync with the dirty-page watch stays the default: the pass fixes descriptors of a heap at console VAs, and ours reaches title VAs through the page table, so in our default layout it has nothing to do. - Pipeline cache journal and compile helper (pipeline_cache_journal.h, d3d12_compile_helper.h): built, and main.cpp has their precompile/compile-server commands beside ours; our pipeline states do not feed them (as upstream itself went back to PipelineCompiles over the pre-pass, b83ae01). Our per-GPU cache with checkpoints stays. - Post-load memory: the opt-in switches and the stream-queue GPU-only reservation (with our gpu_only_protect) are taken. Not taken: the dedicated-buffer fallback when the arena is full (a VA past the arena is a page-table title VA here; ours answers E_OUTOFMEMORY, d3d12_compute's no_slice case adapted) and LEONIDA_TITLE_HEAP on by default (it conflicts with our 40-bit 64 KiB blocks; it stays opt-in). - Taken: the compile gate (SubmitMutex/SubmitTurn around vkQueueSubmit, vkQueueWaitIdle and the present submit; our compute creates through DriverTurn), async submit with synchronous staging queues and held failures picked up in execute_lists, the prelude pass (wired into our execute_lists and teardown), depth bounds (dynamic state in our PSO recipe, draw capture and replay; DepthBoundsTestSupported from the device feature), the descriptor-table kind word (our insert_key keeps its try/catch), the fsdraw backing hook. request_pipeline_build is a no-op for our PSOs. Others - ProjectLeonida#2122 title-texture refresh, async and time-boxed: taken (on TitleViewTexture). - Indirect mesh draws: taken; our raster-indirect clamp passes the mesh record kind, and a mesh indirect draw is let through when the device asks for the clamp (vk.require_indirect_clamp). Upstream's second clamp call before a stateful indirect draw is dropped: ours runs with the other helper passes, outside rendering. - rdna2spirv: upstream's `fits` check and our `small_index` check, both. - Restored: five lines of our IndirectRasterDraw clamp branch git had dropped outside the hunk (every heavily changed file was checked for such losses). Fixes for new failures - vulkan_present.h: read_back returns the frame whose copy was submitted again (9f98dcc made it wait for a shown present, so a resize with an out-of-date swapchain read nothing); only the disk sample needs a shown frame. - d3d12_indirect_rt(+_upload_sysmem): the new replay part takes vulkan_buffer_range() (upload and readback buffers are arena ranges here) and sets require_indirect_clamp. gameinput_script: reads the pad 6 times before the sleep, as 9f98dcc's held-press rule needs. Tests (runtime\build, 502): 491 pass. Not passing: the known ones (d3d12_clear, run_startup_cmdline, run_tiny_game_eh; d3d12_xdxr_rt(+_check), d3d12_existing_heap (x3), xbox_linear_texture_map; d3d12_set_descriptor_heaps), and d3d12_mapped_plane_async, ProjectLeonida#2122's async twin of the persistent slot-133 plane case that d3d12_existing_heap already fails (the texture does not take its mapped pages' bytes), to fix together with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-TITLE-EVERY-BUDGET (#1608 (comment))
Depends on: nothing. Conflicts textually with #2050 and #2098, which change the same loop in
refresh_title_textures; whichever lands second rebases.What and why
Each pass of
refresh_title_texturesvisits every texture that is mapped by the title or known stale. During a streaming burst on retail that is thousands of textures, 30-75 ms a pass, before every submission on the title's submitting thread.LEONIDA_TITLE_EVERY_BUDGET_US(default0: unchanged) limits how long one pass spends on those visits:title_every_cursor_), in address order, so every marked texture gets its turn however many there are. The texture that crosses the limit is finished; one not reached keeps its mark and waits for a later pass.The walk is
leonida::visit_marked_title_texturesinruntime/src/title_texture_refresh.h, next topoll_title_textures, so it is tested without a device.The asynchronous variant is left out on purpose: #2098 already adds
LEONIDA_TEXTURE_REFRESH_ASYNC.Tested
xg_xs_test(new cases: unlimited pass visits every marked texture once and in order; one visit a pass rotates and wraps; the cursor survives an erased entry; an urgent texture comes first and is not visited twice in the same pass; empty registry). Built with MSVC 2022 RelWithDebInfo,xg_xspasses,gta6rtbuilds.In game, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11, earlier base (
main+ replay: copies between depth formats that differ go through transfer scratch (RT-DEPTH-FORMAT-COPY-STAGED) #1893 + d3d12: changed console heap slots are fixed without a time limit by default, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL) #1849), same build and inputs, 7 min runs:LEONIDA_TITLE_FILL_ASYNC=1)LEONIDA_TITLE_EVERY_BUDGET_US=4000, with the earlier asynchronous pass andLEONIDA_REFRESH_MAPPED_TEXTURES=0That run also had the asynchronous pass on and mapped refresh off, so the submission gain is not the budget's alone.
@DadaCap ran an earlier version on an RTX 5080 (621.24), with the budget and the asynchronous pass together: the pass itself went from 20.3 to 6.3 ms and the textures visited from 2,237 to 24 a pass, with no change in submissions per second on that machine (limited elsewhere). The gain depends on the machine.
No in-game run of this exact branch (budget alone, synchronous) yet.
Not checked: video planes over a long run. The urgent rule is meant for them, but no run here compared a video before and after.
GPUs tested: NVIDIA GeForce RTX 4070 Laptop GPU, driver 621.40, Windows 11 Pro (in game); NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 (in game, by @DadaCap)
AI-assisted: yes (Claude Code, Claude Opus 5.5 wrote the change, the tests and this text)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code