Turn the settings for older graphics cards on with one key, low_end_gpu = 1, and leave them off without it.

Mesh shaders as compute, the texture that gets memory of its own, staged mirror uploads and the shorter wait for the GPU, widened write-watch queries, the video memory limits and reserve, early upload batches, the asynchronous replay, the hot-pool rule and the recording thread on AMD cards without mesh shaders were measured on a Radeon RX 580 and run on no other card. Each keeps what 0.9.1 did unless the key or its own setting says otherwise; the key gives the defaults the way the device profile does. The notes describe them as that option, hold main's two new entries in one Changed section, and list the white edges in towns as a known issue.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 13:00:13 -05:00
parent 052c60dc0d
commit 2324a74602
10 changed files with 105 additions and 58 deletions

View File

@@ -11,24 +11,32 @@
**Requirements:** Windows 10 or 11; an x86-64 CPU with SSE4.2; 16 GB of RAM; about 30 GB free for the game and 1.5 GB
for the launcher; a GPU with Vulkan 1.3 and `VK_EXT_external_memory_host` (current NVIDIA and AMD cards). A GPU without
`VK_EXT_mesh_shader` runs the game's mesh shaders as compute shaders (new in this release, see below).
`VK_EXT_mesh_shader` gets the mesh shader fallback as before, or runs the game's mesh shaders as compute shaders with
`low_end_gpu = 1` (new, see below).
## New
- **Grass and foliage on graphics cards without mesh shaders** (AMD before RDNA 2, such as the RX 400 and 500 series
and Vega; NVIDIA before the GTX 16 and RTX 20 series). The game draws its grass, moss and other foliage with mesh
shaders. On a card without them these now run as compute shaders, and what they make is drawn as ordinary
triangles. It is on by default on such a card and does nothing on any other; `mesh_emulation = 0` in nx2navi.ini
goes back to what 0.9.1 did there. Written and run on a Radeon RX 580 by Tobim6.
- **Video memory kept within what the card has free.** Textures and buffers are allocated within the budget the
driver reports for each memory heap, with 512 MB kept free (`vram_reserve_mb`), and a texture that does not fit the
first heap goes to the next one with room. A large batch of texture uploads is handed to the GPU early instead of
growing until a submit runs out of memory. By Tobim6.
- **A settings tab for older and slower cards**, *Lama patches*, by Tobim6: how many released textures are kept, the
video memory reserve, the upload batch size, mesh shader emulation, foliage detail (`foliage = full`, `reduced` or
`off`), and three settings that stay off unless you choose them: preparing frames on a thread of their own
(`replay_async`), keeping memory pools the game refills every frame in system memory (`mirror_hot`), and compiling
the game's code at -O2 at the next *Rebuild the Game* (`guest_opt = 2`, a build several times longer).
- **An option for older graphics cards: `low_end_gpu = 1` in nx2navi.ini.** It turns on a set of changes written by
Tobim6 and measured on a Radeon RX 580. They are off by default, because they were not run by us on other cards:
- Grass, moss and other foliage on cards without mesh shaders (AMD before RDNA 2, such as the RX 400 and 500 series
and Vega; NVIDIA before the GTX 16 and RTX 20 series): the game's mesh shaders run as compute shaders and what
they make is drawn as ordinary triangles.
- Video memory kept within what the driver reports free, with 512 MB in reserve, and a texture that does not fit
the first memory heap placed in the next one with room. Large batches of texture uploads go to the GPU early
instead of growing until a submit runs out of memory.
- Less waiting for the GPU: the game memory a submission needs is copied while the frame is recorded, and the game
goes on once a frame's first submission is handed over. On the RX 580 the replay's part of that wait went from
12 ms to 6.9, with the recording thread used on AMD cards without mesh shaders.
- Frames prepared on a thread of their own (this one can show a dark or flickering frame now and then), and memory
pools the game refills every frame kept in system memory.
- A texture the game reads after another image was drawn over its memory gets memory of its own, which removed
teal splotches from the fog of Kokiri Forest on that card.
Each of these also has a key of its own, listed with `low_end_gpu` in nx2navi.ini.example.
- **A settings tab for those cards**, *Lama patches*, by Tobim6: how many released textures are kept, the video
memory reserve, the upload batch size, mesh shader emulation, foliage detail (`foliage = full`, `reduced` or
`off`) and compiling the game's code at -O2 at the next *Rebuild the Game* (`guest_opt = 2`, a build several times
longer).
- **Link's own motion for DLSS, FSR 3.1 and frame generation** (`selective_motion = 1` in nx2navi.ini, off by
default): Link and the equipment attached to him are drawn a second time with last frame's pose, so the upscaler
gets their real motion in fast turns, attacks and jumps instead of an estimate. It has not been played by us yet. By
@@ -70,9 +78,6 @@ for the launcher; a GPU with Vulkan 1.3 and `VK_EXT_external_memory_host` (curre
the same memory in another format. That texture was dropped every 600 frames as overwritten although the game still
read it, and the frame that dropped it made it again from the scene's raw bits: in a player's recording one frame at
a sixth of its brightness. A texture that is still read is kept now.
- **Teal splotches in the fog of Kokiri Forest.** The game puts its per-frame render targets over each other in
memory, and the fog read its volume after the bloom target had been drawn over it. A texture read in that state gets
memory of its own from then on. By Tobim6.
- **The game hanging with the draw replay on several cores.** Two replay threads could wait for each other at the
end of a render pass, each holding the lock the other needed. By leonardochappuis (pull request #697).
- **Lines drawn one pixel wide whatever width the game set.** The width is passed on now where the card supports wide
@@ -92,21 +97,12 @@ for the launcher; a GPU with Vulkan 1.3 and `VK_EXT_external_memory_host` (curre
## Changed
- **Draws and uploads wait less for the GPU.** The pages of game memory a submission needs are copied while the draw
replay records it, so the game's wait after a frame's first submission ends once the replay has handed it over instead
of when the GPU has run it; a submission whose results the game reads back is still waited for. The texture pool has
8 descriptor sets in turn instead of 4. By Tobim6.
- **The recording thread is used on AMD cards without mesh shaders** (RX 400 and 500, Vega, RX 5000). It stays off on
the newer AMD cards, where it lost the device. On a Radeon RX 580 the replay's part of the game's wait after a
frame's first submission went from 12 ms to 6.9. By Tobim6.
- **The flight recorder** (`flight = 1`, F8) keeps its pictures at 640x360 instead of 320x180 and notes texture slots
that lose their picture, what an upload read and slot registrations. A captured frame also lists the draws that were
rejected while it was prepared (by DeepDaddyTTV, pull request #501). New for reports: a key that dumps the next
frame (`dump_key`), the GPU's time per render pass (`pass_times = 1`) and, in a crash report, what the crashing
thread was building (by Tobim6).
## Changed
- **FSR 3.1 is sharper at Balanced, Performance and Ultra Performance.** It was soft there, most of all while the
camera moved: turning the camera at a steady rate, FSR 3.1 Performance kept 60 % of Native AA's fine detail and Ultra
Performance 50 %, where FSR 4 keeps 89 and 81 %. Below a render scale of three quarters, FSR 3.1's own sharpening now
@@ -129,8 +125,9 @@ for the launcher; a GPU with Vulkan 1.3 and `VK_EXT_external_memory_host` (curre
Performance and 3.9 ms at Native AA on a Radeon RX 7900 XT (FSR 3.1: 0.5 ms). Measured standing in Hyrule Field at
3416x1440: FSR 4 Native AA 52 fps, Quality 53, Ultra Performance 55; FSR 3.1 Native AA 55, Ultra Performance 66;
without an upscaler 70.
- The changes for older cards (mesh shaders as compute, the video memory budgets, the shorter waits for the GPU) were
run by their author on a Radeon RX 580. Please report how they behave on other cards.
- In towns, the edges of kerbs, stairs and wall tops can be drawn white for one frame when the game brings in a
batch of sharper textures. Its cause is not found yet.
- `low_end_gpu = 1` was run by its author on a Radeon RX 580, not by us. Please report how it behaves on your card.
- FSR 4, its frame generation and the AMD-only fixes were not run by us on the cards they are for before this
release.
- The first visit to an area after an install can still pause for a moment while its textures are decoded.

View File

@@ -288,6 +288,16 @@
# 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.
# tex_vram_pressure = 80
# Older graphics cards, and ones short of video memory: 1 turns on the settings written for them and measured on a
# Radeon RX 580, for every key below that this file does not set itself. Mesh shaders run as compute where the card
# has none (mesh_emulation), video memory stays within what the driver reports free (vram_heap_limit = auto,
# vram_reserve_mb = 512), large texture upload batches go to the GPU early (upload_batch_mb = 256), game memory is
# copied for the GPU while a frame is recorded and the game waits less for the GPU (mirror_stage = 1,
# submit_finish_gpu = 0), frames are prepared on a thread of their own (replay_async = 1, which can show a dark or
# flickering frame now and then), pools the game refills every frame stay in system memory (mirror_hot = 25), and a
# texture read after another image was drawn over its memory gets memory of its own (tex_clobber = 1). 0, the
# default: each of these stays as it was in 0.9.1. Read at start.
# low_end_gpu = 0
# Textures the game released that are kept as they are (1 to 16384); past this count only those that lose nothing
# when dropped go. Default: one per 2 MB of the video memory budget, 2048 to 8192. Read at start.
# tex_released_max = 4096
@@ -435,7 +445,7 @@
# and task shaders (grass and other foliage) as compute shaders and draws what they make; 0 skips those draws. The
# arena for their vertices and triangles is mesh_emu_mb MiB of video memory, with mesh_emu_tasks task records (3 KiB
# each) per submission; with trace = perf the log says how much a submission used. Read at start.
# mesh_emulation = 1
# mesh_emulation = 0
# mesh_emu_mb = 256
# mesh_emu_tasks = 16384
# Scaling to the window when it is larger than the game resolution: fsr (AMD FSR 1) or bilinear, and FSR's sharpening

View File

@@ -75,7 +75,7 @@ static const char *const known[] = {
"SET_AT", "SWKBD_TEST", "TAA", "DBG_TEST", "DEBUG_MENU", "MENU_TEST_DEBUG", "FSR4", "FSR4_FG", "FG4_VERSION", "FG4_SWAPCHAIN", "TEST_PAD", "TEST_PAD_AT", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "DEPTH_INIT_INLINE", "DEPTH_ALIAS_LOG", "TEX_DISUSE", "TEX_DISUSE_EVICT", "TEX_GEN_UNDO", "TEX_MEMO", "TEX_VRAM_PRESSURE", "TEX_RELEASED_MB", "TEX_RELEASED_MAX", "TEX_REUSE", "TEX_SPLIT_FILL", "TEX_COMMIT_FREE_MB", "TEX_PROC_COMMIT_MB", "TEX_EVICT", "TEX_COMMIT_EVICT", "MIRROR_EVICT", "VRAM_BUDGET_MB", "TIMER_1MS", "TRACE", "TXD_TRANSPOSE", "UBO_SNAPSHOT", "EVO_TRACE", "EVENT_AT_SYNC", "UPSCALER", "VK_DYN_A2C", "VK_DYN_VERTEX", "VK_NAN_PRESERVE", "VK_NOOPT", "VK_NO_FLOAT64",
"VK_PRESENT", "VK_RECONVERGE", "VK_NAN_BITS", "VK_RECORDER", "VK_SSBO_ALIGN", "VK_SUBGROUP", "VK_SUBGROUP_PIN", "VK_VALIDATION", "VOLUME", "VRAM_HEADROOM", "VS_OUTS", "WATER_PROJECTIVE",
"WAIT_WATCH_S", "WALK_KEY", "WALK_SCALE", "WB_EXACT", "WB_FENCE_LIMIT", "WB_MERGE", "WB_NO_REUP", "WB_MERGE_MAX", "WB_PROBE", "WB_SPLIT", "WB_LAZY", "WB_LAZY_CHUNK", "WB_LAZY_TOUCH", "WINDOW_SIZE", "XLATE", "XLATE_ID", "XLATE_KEEP", "XLATE_PROCS",
"UPLOAD_BATCH_MB", "VRAM_HEAP_LIMIT", "VRAM_RESERVE_MB", "TEX_CLOBBER",
"UPLOAD_BATCH_MB", "VRAM_HEAP_LIMIT", "VRAM_RESERVE_MB", "TEX_CLOBBER", "LOW_END_GPU",
"ZSTD_CHECK", "ZSTD_NATIVE",
"BIND_REUSE", "DYN_DELTA", "STG_ARENA", "SUBMIT_BATCH", "SUBMIT_THREAD", "ASTC_GPU_DESWIZZLE", "ASTC_SCRATCH_KEEP", "ASTC_ARENA", "ASTC_BC1",
"TEXUP_LOG_MS", "DYN_RES", "DYN_RES_TARGET", "DYN_RES_STEP", "TEXTURE_DETAIL",
@@ -146,7 +146,7 @@ static const struct { const char *key, *section; } sections[] = {
{"PREWARM_XLATE", "performance"}, {"GPL", "performance"}, {"ASTC", "performance"}, {"MEMORY", "performance"},
{"TEX_ALIAS", "performance"}, {"DEPTH_INIT_INLINE", "performance"}, {"DEPTH_ALIAS_LOG", "diagnostics"}, {"TEX_DISUSE", "performance"}, {"TEX_DISUSE_EVICT", "performance"}, {"TEX_GEN_UNDO", "performance"}, {"TEX_REUSE", "performance"}, {"TEX_SPLIT_FILL", "performance"}, {"TEX_VRAM_PRESSURE", "performance"}, {"TEX_PROC_COMMIT_MB", "performance"}, {"ASTC_BC", "performance"}, {"LOD_GUARD", "performance"}, {"FIX_C0", "performance"}, {"FIX_ZERO", "performance"}, {"WATER_PROJECTIVE", "performance"},
{"BIND_SKIP", "performance"}, {"SHADER_CACHE_FLUSH", "performance"}, {"SHADER_CARRY", "performance"}, {"PIPELINE_CACHE_PLAY", "performance"}, {"PIPELINE_CACHE_PLAY_MB", "performance"}, {"FFX_PIPE_CACHE", "performance"}, {"SHADER_MEMO", "performance"}, {"PIPE_MEMO", "performance"}, {"TEX_MEMO", "performance"}, {"DESC_TEMPLATE", "performance"},
{"TEX_CLOBBER", "performance"},
{"TEX_CLOBBER", "performance"}, {"LOW_END_GPU", "performance"},
{"PUSH_SKIP", "performance"}, {"SPLIT_DRAWS", "performance"}, {"SPLIT_IDLE", "performance"}, {"SPLIT_IN_PASS", "performance"}, {"SPLIT_US", "performance"}, {"VK_VALIDATION", "performance"},
{"VK_DYN_VERTEX", "performance"}, {"VK_DYN_A2C", "performance"}, {"VK_SUBGROUP_PIN", "performance"}, {"VK_RECONVERGE", "performance"},
{"VK_NAN_PRESERVE", "performance"}, {"VK_NAN_BITS", "performance"},
@@ -316,17 +316,18 @@ static const CfgMeta metas[] = {
{"MIRROR_HOT", "0", "0..1000", RESTART}, {"FREEZE_IDLE", "1800", "0..100000", RESTART},
{"SUBMIT_FINISH_KINDS", "31", "0..31", RESTART}, // vk_sync.c res_mask
{"FOLIAGE", "full", "full|reduced|off", RESTART}, // vk_exec_draw.c foliage_skip
{"VRAM_HEAP_LIMIT", "auto", NULL, RESTART}, // vk_device.c vram_heap_limits: auto, 0 or MiB
{"VRAM_RESERVE_MB", "512", "0..4096", RESTART}, // vk_vma_budget.c: video memory kept free of VMA's allocations
{"UPLOAD_BATCH_MB", "256", NULL, RESTART}, // vk_memory.c: MiB of staging before a batch goes early, 0 no limit
{"MESH_EMULATION", "1", "0|1", RESTART}, {"MESH_EMU_MB", "256", "32..2048", RESTART},
{"VRAM_HEAP_LIMIT", "0", NULL, RESTART}, // vk_device.c vram_heap_limits: auto, 0 or MiB
{"VRAM_RESERVE_MB", "0", "0..4096", RESTART}, // vk_vma_budget.c: video memory kept free of VMA's allocations
{"UPLOAD_BATCH_MB", "0", NULL, RESTART}, // vk_memory.c: MiB of staging before a batch goes early, 0 no limit
{"MESH_EMULATION", "0", "0|1", RESTART}, {"MESH_EMU_MB", "256", "32..2048", RESTART},
{"MESH_EMU_TASKS", "16384", "256..262144", RESTART}, {"MESH_EMU_BATCH", "1", "0|1", RESTART}, {"VEC_INDEX_FIX", "0", "0|auto|1", RESTART},
{"GUEST_OPT", "1", "1|2", RESTART}, // tools/make_game.py: the next Rebuild the Game
{"PASS_TIMES", "0", "0|1", RESTART}, {"DUMP_KEY", "", NULL, RESTART}, // vk_crumbs.c, vk_dump.c
// textures and memory
{"ASTC", "auto", "auto|gpu|native|cpu", RESTART}, {"MEMORY", "auto", "auto|import|mirror|verify", RESTART},
{"TEX_ALIAS", "1", "0|1", RESTART}, {"DEPTH_INIT_INLINE", "1", "0|1", RESTART}, {"DEPTH_ALIAS_LOG", "0", "0|1", RESTART}, {"TEX_DISUSE", "1", "0|1|2", RESTART}, {"TEX_DISUSE_EVICT", "0", "0|1", RESTART}, {"TEX_GEN_UNDO", "1", "0|1", RESTART}, {"TEX_REUSE", "1", "0|1", RESTART}, {"TEX_SPLIT_FILL", "1", "0|1|2", RESTART}, {"TEX_VRAM_PRESSURE", "80", "0..100", RESTART}, {"ASTC_BC", "", "0|1", RESTART}, {"ZSTD_NATIVE", "1", "0|1", RESTART}, {"ZSTD_CHECK", "0", "0|1", RESTART},
{"TEX_CLOBBER", "1", "0|1", RESTART},
{"TEX_CLOBBER", "0", "0|1", RESTART},
{"LOW_END_GPU", "0", "0|1", RESTART}, // LOWEND below
{"STG_ARENA", "1", "0|1", RESTART}, {"ASTC_GPU_DESWIZZLE", "1", "0|1", RESTART},
{"ASTC_SCRATCH_KEEP", "1", "0|1", RESTART}, {"ASTC_ARENA", "1", "0|1", RESTART}, // vk_astc.c scratch_get, vk_texture.c astc_arena
// render fixes
@@ -557,6 +558,38 @@ static int on_steam_deck(void) {
static const char *raw_get(const char *name);
// low_end_gpu = 1 in nx2navi.ini (NX2NAVI_LOW_END_GPU): defaults for the keys the player does not set, as the device
// profile gives them. They turn on what was written for older graphics cards and ones short of video memory or bus
// bandwidth, and measured on a Radeon RX 580: mesh shaders run as compute where the card has none (vk_pipeline.c
// mesh_emu_on), a texture read after another image drew over its pool memory gets memory of its own (vk_texture.c
// mark_clobbered), game memory is copied for the GPU while the replay records and the game's wait after a frame's
// first submission ends once the replay has submitted it (vk_memory.c stage_on, vk_sync.c vk_sync_recorded_wait),
// texture checks share their write-watch queries (vk_memory.c snap_widen_n), video memory stays within the heaps'
// budgets (vk_device.c vram_heap_limits, vk_vma_budget.c), large upload batches go to the queue early (vk_memory.c
// vk_upload_end), frames are prepared on a thread of their own and pools the game refills every frame stay in system
// memory (vk_backend.c, vk_memory.c hot_check). Without the key each of these keeps what 0.9.1 did, and a player can
// still set any of them alone.
static const struct { const char *key, *value; } LOWEND[] = {
{"MESH_EMULATION", "1"}, {"TEX_CLOBBER", "1"}, {"MIRROR_STAGE", "1"}, {"SUBMIT_FINISH_GPU", "0"}, {"SNAP_WIDEN", "8"},
{"VRAM_HEAP_LIMIT", "auto"}, {"VRAM_RESERVE_MB", "512"}, {"UPLOAD_BATCH_MB", "256"}, {"REPLAY_ASYNC", "1"},
{"MIRROR_HOT", "25"},
};
static int lowend = -1;
static int lowend_of(void) {
int p = __atomic_load_n(&lowend, __ATOMIC_ACQUIRE);
if (p >= 0) return p;
const char *set = raw_get(PREFIX "LOW_END_GPU");
p = set && *set && strcmp(set, "0") != 0;
__atomic_store_n(&lowend, p, __ATOMIC_RELEASE);
return p;
}
static const char *lowend_value(const char *key) {
if (lowend_of())
for (size_t i = 0; i < sizeof LOWEND / sizeof *LOWEND; i++)
if (!strcasecmp(LOWEND[i].key, key)) return LOWEND[i].value;
return NULL;
}
static int profile_of(void) {
int p = __atomic_load_n(&profile, __ATOMIC_ACQUIRE);
if (p >= 0) return p;
@@ -581,10 +614,11 @@ static const char *raw_get(const char *name) {
static const char *cfg_get_now(const char *name) {
const char *v = raw_get(name);
if (v || strncmp(name, PREFIX, PREFIX_LEN) || !profile_of()) return v;
for (size_t i = 0; i < sizeof DECK / sizeof *DECK; i++)
if (!strcasecmp(DECK[i].key, name + PREFIX_LEN)) return DECK[i].value;
return NULL;
if (v || strncmp(name, PREFIX, PREFIX_LEN)) return v;
if (profile_of())
for (size_t i = 0; i < sizeof DECK / sizeof *DECK; i++)
if (!strcasecmp(DECK[i].key, name + PREFIX_LEN)) return DECK[i].value;
return lowend_value(name + PREFIX_LEN);
}
// Whether name's value comes from the player (the environment or nx2navi.ini), not a profile or the table.
@@ -684,6 +718,8 @@ const char *cfg_default(const char *key) {
if (profile_of())
for (size_t i = 0; i < sizeof DECK / sizeof *DECK; i++)
if (!strcasecmp(DECK[i].key, name)) return DECK[i].value;
const char *low = lowend_value(name);
if (low) return low;
const CfgMeta *m = cfg_meta(key);
return m ? m->def : NULL;
}
@@ -1124,6 +1160,10 @@ void cfg_init(void) {
if (profile_of())
rt_log("cfg: device profile Steam Deck: defaults for the keys nx2navi.ini does not set (NX2NAVI_DEVICE_PROFILE=desktop "
"turns it off)");
if (lowend_of())
rt_log("cfg: low_end_gpu = 1: the settings for older graphics cards are on for the keys nx2navi.ini does not set "
"(mesh shaders as compute, video memory budgets, staged uploads and the shorter wait for the GPU, frames "
"prepared on their own thread)");
start_values();
}

View File

@@ -321,10 +321,10 @@ retry:
// the next memory type that allows it (the other device-local heap first), for every allocation: textures, render
// targets, VRAM mirrors, pools. The limit is each device-local heap's budget when the device is made (VK_EXT_memory_budget,
// what other programs leave) less a margin for memory VMA does not see (swapchain, FidelityFX): a tenth, at least
// 256 MiB. NX2NAVI_VRAM_HEAP_LIMIT: auto (default), 0 (no limits), or a number of MiB for the largest device-local heap.
// 256 MiB. NX2NAVI_VRAM_HEAP_LIMIT: auto (with low_end_gpu = 1), 0 (no limits, the default), or a number of MiB for the largest device-local heap.
static int vram_heap_limits(VkDeviceSize *limit) {
const char *e = cfg_get("NX2NAVI_VRAM_HEAP_LIMIT");
long mb = e && *e && strcmp(e, "auto") ? atol(e) : -1;
long mb = !e || !*e ? 0 : strcmp(e, "auto") ? atol(e) : -1; // unset: no limits, as before (low_end_gpu sets auto)
if (!mb) return 0;
VkPhysicalDeviceMemoryBudgetPropertiesEXT b = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT};
VkPhysicalDeviceMemoryProperties2 p2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,

View File

@@ -5923,7 +5923,7 @@ static int mesh_emu_draw_prim(VkExec *ex) {
static int mesh_emu_on(void) {
static int on = -1;
if (on < 0) {
on = !vk_ctx()->has_mesh_shader && rt_knob("MESH_EMULATION", "1");
on = !vk_ctx()->has_mesh_shader && rt_knob("MESH_EMULATION", "0");
if (on) rt_log("vk: mesh shaders emulated with compute (NX2NAVI_MESH_EMULATION)");
}
return on;

View File

@@ -999,7 +999,7 @@ static uint64_t snap_regions(uint64_t r0, uint64_t r1, uint32_t epoch) {
return calls;
}
// NX2NAVI_SNAP_WIDEN=<regions> (default 8, 0 off): a texture check that has to query widens the query to up to this
// NX2NAVI_SNAP_WIDEN=<regions> (8 with low_end_gpu = 1, else 0, off): a texture check that has to query widens the query to up to this
// many 2 MiB regions on each side, inside the import pool that holds the texture, so the textures of one pool are
// snapped by one query a submission instead of one each. With freezing off (NX2NAVI_FREEZE_IDLE) an RX 580 in Hyrule
// Field made about 1,130 texture queries a frame, about 6 MiB each on average incl. repeats, 9.4 ms with the pools'.
@@ -1007,7 +1007,7 @@ static int snap_widen_n(void) {
static int n = -1;
if (n < 0) {
const char *e = cfg_get("NX2NAVI_SNAP_WIDEN");
n = e && *e ? atoi(e) : 8;
n = e && *e ? atoi(e) : 0;
if (n < 0) n = 0;
rt_log("mem: a texture check's write-watch query takes up to %d neighbouring 2 MiB regions of its pool on each "
"side (NX2NAVI_SNAP_WIDEN)", n);
@@ -3650,7 +3650,7 @@ int vk_mem_mirror_pending(void) { return npend || snl_copied < nsnl; }
// and when its device address table writes reach guest memory as well (a twin: what they write is not recorded); so
// does a range with a page that cannot be read without a fault (mem_copy_readable: a lazily armed range). The
// whole-pool copy of a mirror's first use is larger than the limit and stays with the GPU.
// Unset or 0 with NX2NAVI_MIRROR_STAGE=1 (the default here): CAPTURE_STAGE_KB. A submission whose prologue copied
// Unset or 0 with NX2NAVI_MIRROR_STAGE=1 (what low_end_gpu = 1 sets): CAPTURE_STAGE_KB. A submission whose prologue copied
// everything this way reads nothing of guest memory late, so its submit wait ends once the replay has submitted it
// (vk_sync_recorded_wait); one with a range left to the GPU-time copy, or a draw that reads a pool without a mirror,
// is noted (vk_mem_note_live) and its submit wait is the GPU's. The first form of this (0.8.0) copied while the replay
@@ -3660,7 +3660,7 @@ static volatile int32_t mirror_live; // the submission being recorded had the
static int stage_on(void) {
static int on = -1;
if (on < 0) on = rt_knob("MIRROR_STAGE", "1") != 0;
if (on < 0) on = rt_knob("MIRROR_STAGE", "0") != 0;
return on;
}
@@ -4676,7 +4676,7 @@ VkCommandBuffer vk_upload_begin(void) {
return open_b.cb;
}
// NX2NAVI_UPLOAD_BATCH_MB (default 256; 0 = no limit): once the open batch's staging buffers hold that much, the
// NX2NAVI_UPLOAD_BATCH_MB (256 with low_end_gpu = 1; 0, the default, = no limit): once the open batch's staging buffers hold that much, the
// outermost vk_upload_end submits it. A save load made thousands of textures between two replay submissions, and every
// one of them went into one batch: about 1.5 GB of raw ASTC blocks plus the decoder's work in a single submission,
// which AMD's 23.10 driver on an RX 580 refused with VK_ERROR_OUT_OF_DEVICE_MEMORY. Submitted early, a batch still
@@ -4687,7 +4687,7 @@ static uint64_t n_early;
void vk_upload_end(void) {
if (upload_cap == UINT64_MAX - 1) {
const char *e = cfg_get("NX2NAVI_UPLOAD_BATCH_MB");
long mb = e && *e ? atol(e) : 256;
long mb = e && *e ? atol(e) : 0;
upload_cap = mb > 0 ? (uint64_t)mb << 20 : UINT64_MAX;
if (mb > 0) rt_log("vk: upload batches submitted early above %ld MiB of staging (NX2NAVI_UPLOAD_BATCH_MB)", mb);
else rt_log("vk: upload batches not limited (NX2NAVI_UPLOAD_BATCH_MB=0)");

View File

@@ -2847,7 +2847,7 @@ static Layout *layout_get(Bindings *B) {
// set 0 gets a template per bind point. Caller holds P.lock.
static int mesh_emu_on(void) {
static int on = -1;
if (on < 0) on = rt_knob("MESH_EMULATION", "1");
if (on < 0) on = rt_knob("MESH_EMULATION", "0");
return on;
}

View File

@@ -166,15 +166,15 @@ void rec_begin(VkCommandBuffer cb, uint64_t fence) {
// past it). Keeping objects until their submission completed and ending a part from the recorder
// (rec_end_cb) fixed the white scene on an RX 6700 XT, but not this: 0.2.8 turned the recorder on for every
// GPU and the AMD reports came back the same day. NX2NAVI_VK_RECORDER=1 turns it on for an A/B run.
// On AMD GPUs without mesh shaders (GCN: RX 400/500, Vega; RDNA 1) it is on: every report above is from an
// On AMD GPUs without mesh shaders (GCN: RX 400/500, Vega; RDNA 1) it is on with low_end_gpu = 1: every report above is from an
// RDNA 2-4 card, and those all have mesh shaders. An RX 580 ran with it and NX2NAVI_REC_CHECK
// (no hazards), the replay's part of the game's wait after a frame's first submission 6.9 ms instead of 12.
const char *set = cfg_get("NX2NAVI_VK_RECORDER");
int amd_off = vk_caps.amd && vk_ctx()->has_mesh_shader;
int amd_off = vk_caps.amd && (vk_ctx()->has_mesh_shader || !rt_knob("LOW_END_GPU", "0")); // on only with low_end_gpu = 1
mode = rt_knob("VK_RECORDER", amd_off ? "0" : "1");
if (!mode && amd_off && !(set && *set))
rt_log("vk_rec: no recorder thread on AMD GPUs with mesh shaders (RDNA 2 and newer; NX2NAVI_VK_RECORDER=1 "
"turns it on)");
rt_log("vk_rec: no recorder thread on AMD GPUs (NX2NAVI_VK_RECORDER=1 turns it on; low_end_gpu = 1 does on "
"cards without mesh shaders)");
if (mode) {
plat_event_init(&wake_ev, 0, 0);
rec_prio = plat_thread_priority_get();

View File

@@ -1404,7 +1404,7 @@ int vk_sync_recorded_wait(uint64_t value, uint64_t timeout_ns, int (*gpu_wait)(u
rt_log("vk: the wait after a frame's first submission also waits for %s (NX2NAVI_SUBMIT_FINISH_RESULTS=%d)",
res_mode == 2 ? "every submission before it" : res_mode ? "the newest submission up to it that hands the "
"CPU results at its completion (events, counter reports, write-backs)" : "nothing more", res_mode);
gpu = rt_knob("SUBMIT_FINISH_GPU", "0") != 0;
gpu = rt_knob("SUBMIT_FINISH_GPU", "1") != 0; // 0 with low_end_gpu = 1
rt_log("vk: the wait after a frame's first submission ends %s (NX2NAVI_SUBMIT_FINISH_GPU=%d)",
gpu ? "when the GPU has run it" : "when the replay has submitted it, or the GPU has run it where it reads guest "
"memory itself", gpu);

View File

@@ -13,7 +13,7 @@
// Here each allocation leaves out the memory types of a device-local heap whose use, as the driver reports it
// (VK_EXT_memory_budget: VMA's budget, which counts the memory VMA does not see), is within the reserve of its budget,
// and VMA places it in the other device-local heap, or system memory, as it does past the fixed limits. The reserve
// (NX2NAVI_VRAM_RESERVE_MB, default 512, 0 off) is room left for allocations VMA does not make, which can come at
// (NX2NAVI_VRAM_RESERVE_MB, 512 with low_end_gpu = 1, else 0, off) is room left for allocations VMA does not make, which can come at
// once: AMD's contexts are made when the upscaler or the frame generation setting changes. An allocation that finds
// no room that way is made as asked, as before. Allocations from a VMA pool and those for one memory type alone (the
// headroom's anchors, vk_headroom.c) are made as asked.
@@ -28,7 +28,7 @@ static VkDeviceSize reserve_bytes(void) {
static int64_t r = -1;
if (r < 0) {
const char *e = cfg_get("NX2NAVI_VRAM_RESERVE_MB");
long mb = e && *e ? atol(e) : 512;
long mb = e && *e ? atol(e) : 0;
r = (int64_t)(mb < 0 ? 0 : mb) << 20;
}
return (VkDeviceSize)r;