Repository navigation
runtime: add O(1) envelope fast path and explicit wrap to title_texture_refresh (RT-TITLE-TEXTURE-REFRESH-ENVELOPE-AND-WRAP) - #2012
Merged
aslan2142 merged 1 commit intoNov 27, 2026
Conversation
Contributor
|
Profile M data point with #1705 and #2012 applied together (RTX 4070 SUPER 12 GB, NVIDIA 621.01, Windows 11). Counts only. AI-assisted (Claude Code). The
Not a one-variable A/B: G1d also changed |
aslan2142
added a commit
that referenced
this pull request
Nov 27, 2026
DadaCap
added a commit
to DadaCap/leonida
that referenced
this pull request
Nov 27, 2026
Conflicts, main's code kept and the branch's change applied on top: - d3d12_title_image_upload.h, write(): takes both the branch's `busy` and ProjectLeonida#2012's `from` (partial mips); the range starts at `from` and the copy still gets the queue and the earlier queues' progress to wait for on the GPU. - d3d12_vulkan_device.cpp, upload_staged_title() and its two callers (fill_unlocked, fill_title_texture): pass `busy` and `from`. - fill_title_texture(): main's comment and its span = fill_bytes(t) after the readability check; the branch's upload_room() helper and its no-slot put-off kept, without the branch's old span = layout.size line. - title texture log: the branch's "put off for an upload slot" count and main's partial-mips line both kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gt9hwSKP7weM2P7sk5skto
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.
Claim:
RT-TITLE-TEXTURE-REFRESH-ENVELOPE-AND-WRAP(claim comment#7170422103on #1608).Problem
In
runtime/src/title_texture_refresh.h:title_write_overlaps()always executedstd::upper_boundbefore checkingbegin >= end,writes.empty(), or whether[begin, end)falls outside the merged dirty envelope[writes.front().first, writes.back().second)— paying binary search overhead for thousands of unaffected waiting textures on every refresh pass.merge_title_writes()unconditionally invokedstd::sorteven on empty/single-entry or already-sorted write-range lists.poll_title_textures()incrementedcursor = address + 1, relying on implicit unsigned wrap ifaddress == UINT64_MAX.Fix
title_write_overlaps()on empty/inverted queries, outside-envelope ranges (end <= writes.front().first || begin >= writes.back().second), and single-range merges before falling back tostd::upper_bound.merge_title_writes()on 0/1-element inputs and skipstd::sortwhen already ordered.poll_title_textures()cursor wrap atUINT64_MAXexplicit (address == UINT64_MAX ? 0u : address + 1u).title_texture_refresh(runtime/test/title_texture_refresh_test.cpp).Benchmark (
clang++ -std=c++20 -O2, bit-exact A/B, 20,000 waiting textures x 2,000 passes)154.67 ms->18.72 ms(8.26x faster)43.08 ms->21.48 ms(2.01x faster)merge_title_writes()on 256 already-sorted ranges (50,000 calls):17.72 ms->12.48 ms(1.42x faster)Verification
runtime/test/title_texture_refresh_test.cppcleanly under:clang++ -std=c++20 -O1 -g -fsanitize=address,undefined -Wall -Wextra -Werrorclang++ -std=c++20 -O1 -g -fsanitize=thread -Wall -Wextra -Werrorclang++ -std=c++20 -O2 -Wall -Wextra -Werrorpython3 -I scripts/check_no_game_data.py runtime/src/title_texture_refresh.h runtime/test/title_texture_refresh_test.cpp runtime/CMakeLists.txtandpython3 -I tests/test_text_write_line_endings.py: all passed.