mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #2166] d3d12: fill the readable smaller mips of a title texture whose larger ones are not there yet (RT-TITLE-PARTIAL-MIPS) #2170
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2170
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2166
Author: @DadaCap
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:title-texture-partial-mips📝 Commits (2)
a1df171d3d12: LEONIDA_TITLE_PARTIAL_MIPS fills the readable smaller mips of a title texture whose larger ones are not theref36d89eMerge remote-tracking branch 'origin/main' into title-texture-partial-mips📊 Changes
7 files changed (+263 additions, -55 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+9 -0)📝
runtime/README.md(+2 -0)📝
runtime/shims/d3d12_title_image_upload.h(+5 -4)📝
runtime/shims/d3d12_vulkan_device.cpp(+156 -41)📝
runtime/shims/xg_xs_layout.h(+16 -0)📝
runtime/src/title_texture_memory.h(+16 -10)📝
runtime/test/xg_xs_test.cpp(+59 -0)📄 Description
Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7178047182
Depends on: nothing. Conflicts textually with #2021 (
TitleImageUpload::write) and #2050 (d3d12_vulkan_device.cpp); whichever lands second rebases. Merges cleanly with #2122.What and why
A slot-70 texture whose pages are not all readable waits on the fallback until every page is, even when the
smaller mips are already there. The XG layout of a 2D texture of one slice stores its mips from the smallest to
the largest, so the mips from
mon are a prefix of its footprint:mip_chain_bytes(layout, m)bytes from the base.With
LEONIDA_TITLE_PARTIAL_MIPS=1(off by default):texture_memory_readable_bytes,title_texture_memory.h);first_mip_withinturns that into the first mip held with every smaller one(
xg_xs_layout.h).path and the staged
TitleImageUploadtake a first mip), and only the descriptor keys of views that start thereor later are published. Keys of views that start above stay on the fallback (
PendingImage::first_mip), so noshader samples a mip that was not filled. A later fill with more mips publishes them; a filled range is never
left half old (
fill_limit).the next pass fills it instead of the round-robin sweep many passes later.
Unset, the behaviour is the one on
main: a texture is readable only when all of it is, and fills start at mip 0.LEONIDA_TITLE_PARTIAL_MIPS_MB(2048) limits the image memory of the textures filled in part: the image still hasmemory for every mip (a
shortcut:comment says when to make it without the missing ones). The census line gains acount of textures filled in part, their image memory and how much of it is filled.
Why off by default: the VRAM cost. In a 420 s game run of this branch with it on, about 3,000 textures were filled in
part at the end (about 7,400 over the run, 11,200 partial fills, about 800 of them later got their larger mips),
holding about 1.5 GB of image memory for about 315 MB of filled mips. That is a fair trade on a 16 GB card, not on an
8 GB one.
README rows for both switches, and a paragraph in
docs/d3d12_vulkan.mdnext to the deferred slot-70 images.Tested
xg_xs_test, new cases: for tiled (64 KiB and 4 KiB blocks, with a mip tail), odd extents, one mip, a chain tooshort for a tail and linear layouts, the first
mip_chain_bytes(t, m)bytes detile every element of mipsm..exactly as the whole texture does; a larger mip needs a longer prefix and mip 0 the whole texture;
first_mip_withinfinds the largest mip a prefix holds; a cube is readable whole or not at all;texture_memory_readable_bytesstops at a guarded first page. The cases do not build without the change (thefunctions are new).
gta6rtand ranxg_xs,d3d12_texture_memory,d3d12_title_va,d3d12_existing_heap,d3d12_descriptor,title_memory_mapandvulkan_title_image_pool(10 CTest entries with their variants): allpass (MSVC, RelWithDebInfo, Ninja). These run with the switch unset; the device path with it set has no unit test.
mainplus this change), retail title, counts only, 420 s each: withLEONIDA_TITLE_PARTIAL_MIPS=1, three runs, no device loss; the figures above are from the third. No run of thisbuild with the switch unset (that path is
main's). The census line needsLEONIDA_FSDRAW_PROBE=1(or any probe that enables it) to be printed.A picture comparison was not made: whether a texture now shows its smaller mips instead of the fallback was not
checked by eye.
GPUs tested: NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 (unit tests and the game observation).
AI-assisted: yes (Claude Code).
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.