Merge task/sadef: sync_ahead is on by default and frame generation runs with it (#1129, #1192)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-25 16:41:47 +03:00
commit 08284c107d
6 files changed
+13 -12

No files matched your search

+1 -1
View File
@@ -220,7 +220,7 @@ static const CfgMeta metas[] = {
{"REPLAY_WORKERS", "0", "0..16", RESTART}, {"REPLAY_CHUNKS", "0", "0..64", RESTART},
{"REPLAY_CHUNK_DRAWS", "128", "1..100000", RESTART}, {"REPLAY_STATE_CHECK", "0", "0|1", RESTART},
{"REPLAY_SKEW_US", "0", "0..100000", RESTART},
{"SYNC_AHEAD", "0", "0|1|check", RESTART}, {"SHADOW_DEFER", "1", "0|1", RESTART},
{"SYNC_AHEAD", "1", "0|1|check", RESTART}, {"SHADOW_DEFER", "1", "0|1", RESTART},
{"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},
+7 -6
View File
@@ -103,7 +103,7 @@ static struct {
unsigned toggle;
uint64_t frame_id, last_prep_ns, made;
// settings read at start (vk_fg_init)
int workers, sync_ahead, hdr, test, debug, times;
int workers, hdr, test, debug, times;
uint64_t shot_at; // TOTK_FG_SHOT: the first present shot, or (shot_w) the first after that world time
int64_t shot_w;
char shot_dir[260];
@@ -295,7 +295,6 @@ static void start(void) {
}
g.win_fmt = VK_FORMAT_R8G8B8A8_UNORM;
g.workers = cfg_int("TOTK_REPLAY_WORKERS");
g.sync_ahead = cfg_bool("TOTK_SYNC_AHEAD") && strcmp(cfg_value("TOTK_SYNC_AHEAD"), "check") != 0; // check: exact
g.hdr = vk_hdr_wanted();
g.test = knob_int("TOTK_FG_TEST");
g.debug = knob_int("TOTK_FG_DEBUG");
@@ -329,14 +328,16 @@ extern "C" int vk_fg_wanted(int dlss) {
if (vk_fg_engine() != VK_FG_FSR3) return 0;
if (!started) start(); // turned on in the menu: the contexts now; the first prepare makes them for the scene
if (!g.live || g.failed) return 0;
// the inputs are this frame's, recorded in replay order: one frame in flight more or chunks recording side by
// side are not handled yet
int why = dlss ? 1 : g.workers > 0 ? 2 : g.sync_ahead ? 3 : g.hdr ? 4 : 0;
// the inputs are this frame's, recorded in replay order: chunks recording side by side are not handled yet.
// sync_ahead only moves the game's frame wait; the replay and the presents keep their order, and the replay's
// next submission waits until the present thread submitted the blit (vk_backend.c submit_sync, vk_present_drain),
// so out[] and hl[] alternate safely with it on.
int why = dlss ? 1 : g.workers > 0 ? 2 : g.hdr ? 3 : 0;
if (why) {
if (!(g.said & 1u << why)) {
g.said |= 1u << why;
static const char *const r[] = {"", "DLSS runs (dlaa = 1)", "the replay records in chunks (replay_workers > 0)",
"sync_ahead = 1", "HDR output (hdr = 1)"};
"HDR output (hdr = 1)"};
rt_log("fg: frame generation off while %s", r[why]);
}
return 0;
+1 -1
View File
@@ -28,7 +28,7 @@ int vk_fg_active(void);
void vk_fg_release(void);
// vk_dlaa.c vk_dlaa_frame, once per present: 1 when frame generation follows the scene in the next frame. 0 while
// DLSS runs (dlss), with replay workers or sync_ahead = 1 (the inputs are per frame and recorded in replay order),
// DLSS runs (dlss), with replay workers (the inputs are per frame and recorded in replay order),
// with HDR output, or while the game shows a menu without its world (vk_fg_menu); each reason is logged once.
int vk_fg_wanted(int dlss);
// vk_dlaa.c, the game's thread at each present: 1 while the map or a loading or event fade is open (sampled there,