mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
barrier_merge is on by default
With the unwritten-read rule every read that stays merged comes from a draw that samples a target it also writes, the case Savage Wind runs the same way on every GPU. Shrine on the RDNA2 iGPU (AMD Windows driver, 1080p): passes 581 -> 128 a frame, GPU time unchanged (37.2 ms off, 38.0 and 36.5 ms on), the picture the same. PR #1237 measured the waterfall on RADV at 1105 -> 117 passes and GPU 8.3 -> 4.1 ms, and an RTX 4080 shrine at +3% mean fps with the 1% low 83 -> 98. barrier_merge = 0 brings back a full barrier at each such Barrier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5aaa718eb6
commit
dca69306fb
4 files changed
+21
-15
No files matched your search
+1
-1
@@ -28,7 +28,7 @@ Many rows below are developer tools that only act together with another setting
|
||||
| `bind_stats` | `1` counts bindings and descriptors per draw of each stage and how much of the bound state changes between draws. | Adds per-draw bookkeeping to the render thread and extra log output; frames get slower. | Caution |
|
||||
| `contact_debug` | `1` draws the contact-shadow factor in grey in place of the picture; `2` draws the sun visibility the shadows are scaled by (white in the sun, black in shade and underground). | The frame shows a grey debug image while it is set; has no effect when contact shadows are off. | Caution |
|
||||
| `core_diag` | `1` records why ready guest threads wait for a virtual core and for how long, with a histogram every 60 presents. | Turns on host-call and SVC depth tracking and writes many log lines (one per present over 25 ms); frames get slower. | Caution |
|
||||
| `barrier_merge` (default `0`) | Experimental. `1` keeps a render pass open through the game's Barrier calls that ask only for fragment ordering and texture invalidation, when no draw of the pass can write a storage buffer or image; the next draw that samples a written target gets a by-region barrier in the pass (the feedback layout). In scenes with about a thousand such barriers a frame this cuts the passes from about 1200 to 130 and the GPU time from 24.5 to 7.8 ms. | The game's barrier orders every pixel, the in-pass by-region barrier only the pixel a draw writes: a driver that runs it per screen tile can show flicker or squares at the edges of water, decals or particles. | Caution |
|
||||
| `barrier_merge` (default `1`) | `1` keeps a render pass open through the game's Barrier calls that ask only for fragment ordering and texture invalidation, when no draw of the pass can write a storage buffer or image; the next draw that samples a target it also writes gets a by-region barrier in the pass (the feedback layout), and a draw that samples a written target without writing it ends the pass. In scenes with about a thousand such barriers a frame this cuts the passes from about 1200 to 130 and, on RADV, the GPU time from 24.5 to 7.8 ms; AMD's Windows driver shows no GPU time change. `0` ends the pass at every such Barrier. | The game's barrier orders every pixel, the in-pass by-region barrier only the pixel a draw writes: a driver that runs it per screen tile could show flicker or squares at the edges of water, decals or particles; `0` rules that out. | Caution |
|
||||
| `menu_cursor_log` | `1` logs what the menu cursor code reads at every screen change. | Only adds log lines. | Safe |
|
||||
| `plugin_tick_offset` (default `0`) | Added to every GetSystemTick in the plugin service run (`totk.exe --plugin-init DIR`), so `tools/exefs_plugins.py` can run a plugin's init twice with other ticks and compare the records. | Has no effect outside `--plugin-init`; a plugin's init at the start of the game gets the plain ticks. | Safe |
|
||||
| `plugin_trace` (default `0`) | `1` logs the first call of each entry of a mod plugin's hooks (its callbacks, replace and call targets) as `plugins: hook entry ... reached`. | Each such call goes through a counting step; nothing changes without a mod plugin. | Safe |
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ static const CfgMeta metas[] = {
|
||||
{"FREE_CORES", "0", "0|1", RESTART}, {"TIMER_1MS", "1", "0|1", RESTART},
|
||||
// shaders and pipelines
|
||||
{"PIPE_WAIT", "default", "default|draw", RESTART}, {"PIPE_SKIP", "fullscreen", "strict|any|fullscreen", RESTART},
|
||||
{"BARRIER_MERGE", "0", "0|1", RESTART}, {"LIB_PREBUILD", "1", "0|1", RESTART}, {"LIB_PREBUILD_THREADS", "", "1..64", RESTART},
|
||||
{"BARRIER_MERGE", "1", "0|1", RESTART}, {"LIB_PREBUILD", "1", "0|1", RESTART}, {"LIB_PREBUILD_THREADS", "", "1..64", RESTART},
|
||||
{"PIPE_PREBUILD", "1", "0|1", RESTART}, {"PREWARM_XLATE", "", "1..64", RESTART}, {"GPL", "1", "0|1", RESTART},
|
||||
// textures and memory
|
||||
{"ASTC", "auto", "auto|gpu|native|cpu", RESTART}, {"MEMORY", "auto", "auto|import|mirror|verify", RESTART},
|
||||
|
||||
+9
-5
@@ -984,7 +984,7 @@ static void clear_ds(VkExec *ex, const p_clear_ds *c) {
|
||||
|
||||
// ---- the op loop
|
||||
|
||||
// barrier_merge (TOTK_BARRIER_MERGE, off by default): TotK calls Barrier(ORDER_FRAGMENTS | INVALIDATE_TEXTURE) about
|
||||
// barrier_merge (TOTK_BARRIER_MERGE, on by default): TotK calls Barrier(ORDER_FRAGMENTS | INVALIDATE_TEXTURE) about
|
||||
// 1200 times a frame in some scenes (water, decals): the next draw reads the render targets the last one wrote. A full
|
||||
// barrier there ends the Vulkan pass and flips every target's layout. What such a barrier asks for, an attachment write
|
||||
// made visible to a later fragment shader read of the open pass, feedback_prepare / feedback_barrier already do before the
|
||||
@@ -992,10 +992,14 @@ static void clear_ds(VkExec *ex, const p_clear_ds *c) {
|
||||
// that may write a storage buffer or image (pass_storage), which only a full barrier makes visible, or the barrier asks for
|
||||
// more than those two bits, or the feedback layout is not in use, or a target is a 3D BC stand-in (its texture gets the
|
||||
// pass's writes only at the pass end, bc_copy_back). The reads the by-region barrier does not cover end the pass at the
|
||||
// draw that makes them (vk_exec_draw.c merge_guard). The by-region barrier orders only reads of the pixel a fragment
|
||||
// writes; NVN's ORDER_FRAGMENTS orders every pixel (ORDER_FRAGMENTS_TILED is the per-region one), so a draw that reads a
|
||||
// neighbouring pixel of a target written in the pass relies on the driver running the barrier for the whole target, as
|
||||
// RADV does; hence experimental.
|
||||
// draw that makes them (vk_exec_draw.c merge_guard), and so do reads of a target the draw does not write itself
|
||||
// (vk_exec_draw.c merge_unwritten_reads): the by-region barrier orders only reads of the pixel a fragment writes, while
|
||||
// NVN's ORDER_FRAGMENTS orders every pixel (ORDER_FRAGMENTS_TILED is the per-region one). What stays merged is a draw
|
||||
// that samples a target it also writes, which Savage Wind runs the same way on every GPU. If such a draw read a
|
||||
// neighbouring pixel, it would rely on the driver running the barrier for the whole target, as RADV and the desktop
|
||||
// drivers do. On 1.4.3 every read after a merged Barrier in the shrine, the town and the field is of that kind. Passes
|
||||
// a frame in the shrine: 581 -> 128 on an RDNA2 iGPU with no GPU time change on AMD's Windows driver; the waterfall
|
||||
// on RADV: 1105 -> 117, GPU 8.3 -> 4.1 ms.
|
||||
int vk_exec_barrier_merge_on(void) {
|
||||
static int on = -1;
|
||||
if (on < 0) on = cfg_bool("TOTK_BARRIER_MERGE");
|
||||
|
||||
+10
-8
@@ -98,14 +98,16 @@
|
||||
# the CPU threads).
|
||||
# lib_prebuild = 1
|
||||
# lib_prebuild_threads = 4
|
||||
# Experimental: 1 keeps a render pass open through the game's own Barrier calls (ORDER_FRAGMENTS | INVALIDATE_TEXTURE) when
|
||||
# none of the pass's draws can write a storage buffer or image, making the writes visible to the next draw with a by-region
|
||||
# barrier instead of ending the pass. Scenes where the game issues about a thousand such barriers a frame (the water in
|
||||
# the Nachoyah Shrine, terrain decals) go from about 1200 passes and 10000 layout changes to about 130 passes and 150;
|
||||
# the GPU time there fell from 24.5 to 7.8 ms a frame. The game's barrier orders every pixel, the one inside the pass only
|
||||
# the pixel a draw writes: a driver that runs it per screen tile can show flicker or squares at the edges of water, decals
|
||||
# or particles (report any). Needs the feedback layout (the default). Read at start. Default: 0.
|
||||
# barrier_merge = 0
|
||||
# 1 keeps a render pass open through the game's own Barrier calls (ORDER_FRAGMENTS | INVALIDATE_TEXTURE) when none of the
|
||||
# pass's draws can write a storage buffer or image, making the writes visible to the next draw with a by-region barrier
|
||||
# instead of ending the pass. A draw that samples a target written in the pass without writing it itself still ends the
|
||||
# pass. Scenes where the game issues about a thousand such barriers a frame (the water in the Nachoyah Shrine, terrain
|
||||
# decals) go from about 1200 passes and 10000 layout changes to about 130 passes and 150; the GPU time there fell from
|
||||
# 24.5 to 7.8 ms a frame on Linux (RADV). The game's barrier orders every pixel, the one inside the pass only the pixel a
|
||||
# draw writes: a driver that runs it per screen tile could show flicker or squares at the edges of water, decals or
|
||||
# particles; 0 brings back a full barrier each time (report it). Needs the feedback layout (the default). Read at start.
|
||||
# Default: 1.
|
||||
# barrier_merge = 1
|
||||
# Build known pipelines ahead of time.
|
||||
# pipe_prebuild = 1
|
||||
# Threads that translate known shaders at start (1 to 64; default: half the CPU threads, at most 16).
|
||||
|
||||
Reference in new issue
Block a user