diff --git a/docs/architecture.md b/docs/architecture.md index 662fe91b..8ca20045 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -266,7 +266,15 @@ keeps per-core data without locks and relies on that, so the host models it (`ru swapchain, DLSS and frame generation features); `mem: host` gives the host-visible allocations, the process's commit and working set and the game's heap; `vk: released textures` how often released textures came back and how old they were, and how many were made again after a drop (`vk_memory.c` `owner_log`). A figure that only climbs over - a session is a leak. `vram_use` (`cfg.c` `VRAMLOW`) trades these caches for work done again. + a session is a leak. +- Released textures by age: the game releases a texture when what uses it leaves the view and takes it back when that + returns; the cache keeps the released image so that the take-back finds it. In play the take-backs came within a + minute of the release or never, so a released texture goes once it has gone unused for a hold of three minutes, six + for content only the GPU made (`vk_texture.c` `drop_aged`, `vk_tex_release.h`, `tex_released_hold`). The size bound + (a quarter of the video memory budget) stays as the safety net for a burst of area changes, and young textures may + pass it, up to twice it, while the card and the system's commit have room. Times are wall seconds from a clock of + the presents, not present counts. `vram_use = high` (`cfg.c` `vram_use_value`) turns the hold off and keeps what a + switched-off upscaler or SMAA holds; the default, low, frees both. - Allocation: Vulkan Memory Allocator. Debugging: Vulkan validation layers, per-pass frame dumps (`NX2NAVI_DUMP`, `vk_dump.c`), a sampling profiler (`NX2NAVI_PROFILE`, `tools/prof_report.py`) and a flight recorder (`NX2NAVI_FLIGHT`). RenderDoc cannot capture, because it hides `VK_EXT_external_memory_host` from the application. diff --git a/nx2navi.ini.example b/nx2navi.ini.example index bbea2a82..6d7840e9 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -333,8 +333,21 @@ # Percent of the video memory in use above which textures give way: first those the game released, then those no # shader sampled for a while (tex_disuse); each is made again when used. The default lies under the 87 percent past # which game memory gets no copy in video memory (memory = mirror), which costs far more frame time than a texture -# uploaded again. 0: textures never give way for video memory. +# uploaded again. 0: textures never give way for video memory. 70 frees more on a card short of memory, and more +# textures are made again (the low of the 0.10 previews set it). # tex_vram_pressure = 80 +# Seconds a texture the game released is kept once nothing uses it (0 to 900); then it goes, however much room is +# left. In play the game took released textures back within a minute or not at all; one taken back after its drop is +# made again and shows its stand-in for a frame. A texture whose content only the GPU made waits twice as long, and one +# the GPU drew into since its last copy back to game memory stays. 0: released textures stay up to tex_released_mb for +# the whole session (as before 0.10). Default: 180; vram_use = high sets 0. Read at start. +# tex_released_hold = 180 +# Megabytes the released textures may hold (0: no bound). Past it the oldest go even when young; while tex_released_hold +# is on, young ones may stay past it, up to twice it, as long as video memory and the system's commit have room. +# Default: a quarter of the video memory budget where the PC has an eighth of its memory to match, at least a +# thirty-second of the PC's memory (512 to 2048), at most 8192. 1024 (the low of the 0.10 previews) holds less, but +# textures the game takes back after their drop are made again and show their stand-in for a frame. Read at start. +# tex_released_mb = 4096 # Texture compaction (experimental). Video memory is taken in blocks (vma_block_mb), and a block goes back to the # driver only once everything in it is freed: after a long session the blocks hold textures scattered between holes, # and the game holds a gigabyte or two of video memory it does not use. 1: textures no shader sampled for ten seconds @@ -540,14 +553,15 @@ # cpu or astc_bc = 0) and the budget is under 20480 MiB, auto goes one step lower, as they take four times the memory. # The log says what was picked ("texture detail:"). Read at start. # texture_detail = auto -# Video memory use (the Screen tab's row): low, balanced or high. balanced, the default, frees what DLSS, frame -# generation's HUD-less picture, FSR 1 and SMAA held once they have been switched off for a while (about 0.9 GiB with -# DLSS off at 5120x2142); high keeps it, so switching them on again makes nothing. low also sets, unless set here: -# tex_released_mb = 1024 (released textures keep at most 1 GiB instead of a quarter of the video memory budget; one -# the game takes back after its drop is made and uploaded again and shows its stand-in for a frame), -# tex_vram_pressure = 70 (textures give way from 70% of the budget) and pipe_seed_boot = 0 (0.3-0.6 GiB of video -# memory and 2-4 GB of commit less; a first visit to an area can miss a few objects for a frame). Read at start. -# vram_use = balanced +# Video memory use (the Screen tab's row): low or high. low, the default, lets go of released textures once nothing has +# used them for tex_released_hold (180 s), and frees what DLSS, frame generation's HUD-less picture, FSR 1 and SMAA +# held once they have been switched off for a while (about 0.9 GiB with DLSS off at 5120x2142). high keeps both for the +# whole session (tex_released_hold = 0: released textures up to tex_released_mb), so switching those features on again +# makes nothing. balanced, the default before 0.10, means low. The low of the 0.10 previews traded memory for work +# done again; its values are keys of their own: tex_released_mb = 1024, tex_vram_pressure = 70 and pipe_seed_boot = 0 +# (0.3-0.6 GiB of video memory and 2-4 GB of commit less, but a first visit to an area misses objects for a frame +# while their pipelines are made). Read at start. +# vram_use = low # Sun shadow map size: game (the game's own, which changes with the view and drops to about 400 near the ground, so # leaf shadows look blocky and jump) or a fixed 256, 512, 768, 1024, 1536 or 2048. Above 960 the texture heap grows with # it. 256 is coarser than the game's own and is for integrated GPUs short of memory bandwidth. Read at start. diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 64bf3c71..f4ad767d 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -766,13 +766,14 @@ static void row_texture_detail(void) { opt_choice_list("NX2NAVI_TEXTURE_DETAIL", UI_MENU_TEX_DETAIL, vals, names, 4, UI_MENU_TEX_DETAIL_DESC); } -// Video memory use (cfg.c VRAMLOW, cfg_vram_keep): low sets smaller texture caches and builds the shared pipeline list -// at first use, high keeps what switched-off features made. Read at the start, so the row notes the restart. +// Video memory use (cfg.c vram_use_value, cfg_vram_keep): low, the default, lets released textures go after the hold +// (vk_texture.c drop_aged) and frees what switched-off features made; high keeps both. Any value but high is low, as +// cfg.c reads it (balanced, the default before 0.10, among them). Read at the start, so the row notes the restart. static void row_vram_use(void) { - static const char *const vals[] = {"low", "balanced", "high"}; - const char *names[] = {menu_text(UI_MENU_VRAM_USE_LOW), menu_text(UI_MENU_VRAM_USE_BALANCED), - menu_text(UI_MENU_VRAM_USE_HIGH)}; - opt_choice_list("NX2NAVI_VRAM_USE", UI_MENU_VRAM_USE, vals, names, 3, UI_MENU_VRAM_USE_DESC); + static const char *const vals[] = {"low", "high"}; + const char *names[] = {menu_text(UI_MENU_VRAM_USE_LOW), menu_text(UI_MENU_VRAM_USE_HIGH)}; + opt_choice_list("NX2NAVI_VRAM_USE", UI_MENU_VRAM_USE, vals, names, 2, UI_MENU_VRAM_USE_DESC, + cfg_vram_keep() ? 1 : 0); } static void row_shadow_scale(void) { diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 5fc5a30e..bb787a42 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -99,12 +99,12 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_TEX_DETAIL_AUTO] = "Automatic: %s", [UI_MENU_TEX_DETAIL_FULL] = "Full", [UI_MENU_TEX_DETAIL_REDUCED] = "Reduced", [UI_MENU_TEX_DETAIL_LOW] = "Low", [UI_MENU_VRAM_USE] = "Video memory use", - [UI_MENU_VRAM_USE_DESC] = "How much video memory the game keeps for later. Low keeps fewer textures of places you " - "left and builds some graphics only when first needed: returning to a place can show " - "simpler surfaces for a moment, and a first visit can miss a few objects for a frame. High " - "also keeps what an upscaler or anti-aliasing switched off had made. Takes effect after a " - "restart.", - [UI_MENU_VRAM_USE_LOW] = "Low", [UI_MENU_VRAM_USE_BALANCED] = "Balanced", [UI_MENU_VRAM_USE_HIGH] = "High", + [UI_MENU_VRAM_USE_DESC] = "How much video memory the game keeps for later. Low, the default, lets go of the textures " + "of places you left once they have gone unused for three minutes, and of what an upscaler " + "or anti-aliasing switched off had made; in play the game asked for such textures again " + "within a minute or not at all. High keeps both for the whole session. Takes effect after " + "a restart.", + [UI_MENU_VRAM_USE_LOW] = "Low", [UI_MENU_VRAM_USE_HIGH] = "High", [UI_MENU_LOWEND_INTRO] = "The settings of the low-end GPU mode. Each can be changed here; most take effect after a restart.", [UI_MENU_LOWEND_RESTART] = "The mode turns on after a restart. Its settings are listed here then.", [UI_MENU_LOWEND_NOT_FOR_CARD] = "Not for this graphics card: it has mesh shaders and 8 GB of video memory or more. " @@ -924,12 +924,12 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_TEX_DETAIL_AUTO] = "Авто: %s", [UI_MENU_TEX_DETAIL_FULL] = "Полная", [UI_MENU_TEX_DETAIL_REDUCED] = "Сниженная", [UI_MENU_TEX_DETAIL_LOW] = "Низкая", [UI_MENU_VRAM_USE] = "Расход видеопамяти", - [UI_MENU_VRAM_USE_DESC] = "Сколько видеопамяти игра держит про запас. «Низкий» хранит меньше текстур покинутых мест и " - "создаёт часть графики только при первой надобности: при возвращении поверхности могут на " - "миг выглядеть проще, а при первом посещении на кадр могут пропасть несколько объектов. " - "«Высокий» также хранит то, что создали отключённые масштабирование или сглаживание. " - "Действует после перезапуска.", - [UI_MENU_VRAM_USE_LOW] = "Низкий", [UI_MENU_VRAM_USE_BALANCED] = "Сбалансированный", [UI_MENU_VRAM_USE_HIGH] = "Высокий", + [UI_MENU_VRAM_USE_DESC] = "Сколько видеопамяти игра держит про запас. «Низкий», по умолчанию, освобождает текстуры " + "покинутых мест, не использованные три минуты, и то, что создали отключённые " + "масштабирование или сглаживание; в игре такие текстуры запрашивались снова в течение " + "минуты или не запрашивались вовсе. «Высокий» хранит и то и другое всю сессию. Действует " + "после перезапуска.", + [UI_MENU_VRAM_USE_LOW] = "Низкий", [UI_MENU_VRAM_USE_HIGH] = "Высокий", [UI_MENU_SHARPNESS] = "Резкость FSR", [UI_MENU_SHARPNESS_DESC] = "Насколько FSR повышает резкость. 0 отключает.", [UI_MENU_SHARPNESS_NEEDS_FSR] = "только с AMD FSR 1", @@ -1902,12 +1902,12 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_TEX_DETAIL_AUTO] = "Automático: %s", [UI_MENU_TEX_DETAIL_FULL] = "Completo", [UI_MENU_TEX_DETAIL_REDUCED] = "Reduzido", [UI_MENU_TEX_DETAIL_LOW] = "Baixo", [UI_MENU_VRAM_USE] = "Uso da memória de vídeo", - [UI_MENU_VRAM_USE_DESC] = "Quanta memória de vídeo o jogo guarda para depois. Baixo guarda menos texturas dos " - "lugares que você deixou e cria parte dos gráficos só quando são precisos pela primeira " - "vez: ao voltar a um lugar, as superfícies podem parecer mais simples por um instante, e " - "numa primeira visita alguns objetos podem faltar por um quadro. Alto também guarda o que " - "um escalonador ou antisserrilhamento desligado criou. Vale depois de reiniciar.", - [UI_MENU_VRAM_USE_LOW] = "Baixo", [UI_MENU_VRAM_USE_BALANCED] = "Equilibrado", [UI_MENU_VRAM_USE_HIGH] = "Alto", + [UI_MENU_VRAM_USE_DESC] = "Quanta memória de vídeo o jogo guarda para depois. Baixo, o padrão, libera as texturas " + "dos lugares que você deixou após três minutos sem uso, e o que um escalonador ou " + "antisserrilhamento desligado criou; em jogo, essas texturas foram pedidas de novo em " + "menos de um minuto ou nunca. Alto guarda tudo isso durante a sessão inteira. Vale depois " + "de reiniciar.", + [UI_MENU_VRAM_USE_LOW] = "Baixo", [UI_MENU_VRAM_USE_HIGH] = "Alto", [UI_MENU_COLOR] = "Cor", [UI_MENU_COLOR_PRESET] = "Perfil de cor", [UI_MENU_COLOR_PRESET_DESC] = "Define os quatro valores abaixo. Vívido: mais contraste e saturação, sombras um " @@ -2741,9 +2741,9 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_TEX_DETAIL_AUTO] = "自动:%s", [UI_MENU_TEX_DETAIL_FULL] = "完整", [UI_MENU_TEX_DETAIL_REDUCED] = "降低", [UI_MENU_TEX_DETAIL_LOW] = "低", [UI_MENU_VRAM_USE] = "显存占用", - [UI_MENU_VRAM_USE_DESC] = "游戏为之后保留多少显存。“低”保留较少已离开地点的纹理,部分图形在首次需要时才创建:回到某地时表面可能" - "短暂显得较简单,首次到访时可能有几个物体缺失一帧。“高”还会保留已关闭的放大或抗锯齿创建的内容。重启后生效。", - [UI_MENU_VRAM_USE_LOW] = "低", [UI_MENU_VRAM_USE_BALANCED] = "平衡", [UI_MENU_VRAM_USE_HIGH] = "高", + [UI_MENU_VRAM_USE_DESC] = "游戏为之后保留多少显存。“低”(默认)会释放已离开地点中三分钟未使用的纹理,以及已关闭的放大或抗锯齿" + "创建的内容;实际游玩中,这类纹理要么在一分钟内再次被使用,要么不再使用。“高”在整个游戏过程中保留两者。重启后生效。", + [UI_MENU_VRAM_USE_LOW] = "低", [UI_MENU_VRAM_USE_HIGH] = "高", [UI_MENU_HDR_GROUP] = "HDR", [UI_MENU_HDR] = "HDR 输出", [UI_MENU_HDR_DESC] = "在 HDR 显示器上呈现更亮的高光。请先在 Windows 中开启 HDR。", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index d2d41995..b5a1d41f 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -50,7 +50,7 @@ typedef enum { UI_MENU_TEX_DETAIL, UI_MENU_TEX_DETAIL_DESC, UI_MENU_TEX_DETAIL_AUTO, // "Automatic: %s", %s the level it picks on this card UI_MENU_TEX_DETAIL_FULL, UI_MENU_TEX_DETAIL_REDUCED, UI_MENU_TEX_DETAIL_LOW, - UI_MENU_VRAM_USE, UI_MENU_VRAM_USE_DESC, UI_MENU_VRAM_USE_LOW, UI_MENU_VRAM_USE_BALANCED, UI_MENU_VRAM_USE_HIGH, + UI_MENU_VRAM_USE, UI_MENU_VRAM_USE_DESC, UI_MENU_VRAM_USE_LOW, UI_MENU_VRAM_USE_HIGH, UI_MENU_SHARPNESS, UI_MENU_SHARPNESS_DESC, UI_MENU_SHARPNESS_NEEDS_FSR, UI_MENU_COLOR, // group heading over the colour rows UI_MENU_COLOR_PRESET, UI_MENU_COLOR_PRESET_DESC, UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY,