mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 21:55:57 +00:00
Frame generation gets a row on the Game tab under the frame limit (Off or AMD FSR 3) that applies at once, and the fps overlay reads "N fps drawn, M shown" while it runs
The row and its description (for displays of 120 Hz and more, the game at half the limit, about half a frame more input delay, not with DLSS or HDR) are in the menu's catalog for English, Russian, Portuguese (Brazil) and Simplified Chinese. frame_gen is live: vk_fg.cpp vk_fg_engine reads it again after a settings change, the contexts are made at the first frame after it is turned on (a hitch of about 0.1 s once), turned off they stay unused until exit, and gfx_present.c builds the swapchain again when the extra image for the pair comes or goes. The full overlay gets a Shown row. totk.ini.example describes frame_gen. The shown-frames counter and the overlay lines follow PR #1089 by xellow78-lgtm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: xellow78-lgtm <336264245+xellow78-lgtm@users.noreply.github.com>
This commit is contained in:
1 parent
451813aa17
commit
efee9bcf16
9 files changed
+101
-24
No files matched your search
+1
-1
@@ -161,7 +161,7 @@ static const CfgMeta metas[] = {
|
||||
{"PCSS", "0", "0..200", RESTART},
|
||||
// Game
|
||||
{"FPS_LIMIT", "60", "30|40|45|60|90|120|144|display", LIVE}, {"FPS60", "1", "0|1", LIVE}, {"FRAME_QUEUE", "0", "0|1", LIVE},
|
||||
{"FRAME_GEN", "off", "off|fsr3", RESTART}, // the generator; vk_fg.cpp vk_fg_engine maps it
|
||||
{"FRAME_GEN", "off", "off|fsr3", LIVE}, // the generator; vk_fg.cpp vk_fg_engine maps it
|
||||
{"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART},
|
||||
{"MODS_REBUILD", "auto", "auto|off", RESTART},
|
||||
{"MODS_WITHOUT_CODE", "0", "0|1", RESTART}, // 1: a mod is used without the code module it cannot run (mods.c)
|
||||
|
||||
@@ -152,6 +152,7 @@ static uint32_t g_flip_idx[2];
|
||||
static int g_flip_gen[2]; // that blit shows a generated picture: its present carries no present ID
|
||||
static volatile int64_t g_shown; // presents queued since the start (gfx_presents_shown)
|
||||
static int g_overlay_on; // the pair's generated picture laid the menu out: the game's frame draws it again
|
||||
static int g_fg_images = -1; // the swapchain was built with frame generation's extra image (build_swapchain)
|
||||
|
||||
// ---- TOTK_FLIGHT thumbnails (flight.c; g_pl): each present also blits the swapchain image down into slot frame % g_th_n
|
||||
// of a host-visible ring. A slot's tag names the frame it holds complete; recording a new frame clears the tag first,
|
||||
@@ -266,6 +267,8 @@ static void window_settings_live(void) {
|
||||
snprintf(present, sizeof present, "%s", e);
|
||||
if (started) plat_xchg32(&g_dirty, 1);
|
||||
}
|
||||
// frame_gen switched in the menu: the swapchain is built again with its image count
|
||||
if (started && g_fg_images >= 0 && (vk_fg_engine() != VK_FG_OFF) != g_fg_images) plat_xchg32(&g_dirty, 1);
|
||||
if (started) gfx_window_apply_settings();
|
||||
reflex_apply_locked();
|
||||
started = 1;
|
||||
@@ -557,7 +560,7 @@ static int build_swapchain(void) {
|
||||
if (fmts[i].format == VK_FORMAT_R8G8B8A8_UNORM && fmts[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { sf = fmts[i]; found = 1; }
|
||||
// Frame generation's pair holds two images acquired at once (the generated picture's blit waits while the game's
|
||||
// frame is blitted): one image more, while frame_gen names a generator
|
||||
int fg_images = vk_fg_engine() != VK_FG_OFF;
|
||||
int fg_images = g_fg_images = vk_fg_engine() != VK_FG_OFF;
|
||||
uint32_t count = caps.minImageCount + 1 + (fg_images ? 1u : 0u);
|
||||
if (caps.maxImageCount && count > caps.maxImageCount) count = caps.maxImageCount;
|
||||
if (count > 8) count = 8;
|
||||
|
||||
+34
-6
@@ -54,6 +54,8 @@ void vk_queue_unlock(void);
|
||||
int vk_exec_replay_workers(void);
|
||||
void res_sizes(unsigned out[2], unsigned scene[2]);
|
||||
double frame_step_limit_hz(void);
|
||||
uint64_t gfx_presents_shown(void); // gfx_present.c
|
||||
int gfx_frame_gen_live(void); // vk_backend.c
|
||||
extern const int rt_game_version;
|
||||
extern const char rt_port_version[];
|
||||
void cheats_frame(uint64_t frame); // cheats.c
|
||||
@@ -831,6 +833,8 @@ static void row_play_time(void) {
|
||||
static void tab_game(float scale) {
|
||||
opt_begin("##game", scale);
|
||||
row_fps_limit();
|
||||
static const UiTextId frame_gen[] = {UI_MENU_FRAME_GEN_OFF, UI_MENU_FRAME_GEN_FSR3};
|
||||
opt_choice("TOTK_FRAME_GEN", UI_MENU_FRAME_GEN, frame_gen, 2, UI_MENU_FRAME_GEN_DESC);
|
||||
opt_toggle("TOTK_FRAME_QUEUE", UI_MENU_FRAME_QUEUE, UI_MENU_FRAME_QUEUE_DESC);
|
||||
row_game_lang();
|
||||
static const UiTextId mode[] = {UI_MENU_MODE_DOCKED, UI_MENU_MODE_HANDHELD};
|
||||
@@ -1579,6 +1583,24 @@ static uint64_t g_perf_last_ns, g_perf_win_ns, g_perf_max_ns;
|
||||
static int g_perf_frames;
|
||||
static char g_perf_text[96];
|
||||
|
||||
// Frame generation shows more pictures than the game draws (vk_backend.c present_pair): the presents a second over the
|
||||
// last half second while it runs, else 0. The overlay's frame counts stay the frames the game drew. (PR #1089's
|
||||
// shown_tick, by xellow78-lgtm.)
|
||||
static double g_shown_fps;
|
||||
|
||||
static void shown_tick(uint64_t now) {
|
||||
static uint64_t t0, n0;
|
||||
uint64_t n = gfx_presents_shown();
|
||||
int live = gfx_frame_gen_live();
|
||||
if (!live || !t0 || now - t0 > 2000000000ull) {
|
||||
t0 = now, n0 = n;
|
||||
if (!live) g_shown_fps = 0;
|
||||
} else if (now - t0 >= 500000000ull) {
|
||||
g_shown_fps = (double)(n - n0) * 1e9 / (double)(now - t0);
|
||||
t0 = now, n0 = n;
|
||||
}
|
||||
}
|
||||
|
||||
static int perf_mode_of(const char *s) { return !strcmp(s, "full") ? 2 : !strcmp(s, "fps") ? 1 : 0; }
|
||||
|
||||
extern "C" void menu_perf_cycle(void) {
|
||||
@@ -1624,6 +1646,7 @@ static void perf_tick(uint64_t now, const MenuTarget *t) {
|
||||
}
|
||||
g_perf_mode = m;
|
||||
}
|
||||
if (g_perf_mode) shown_tick(now);
|
||||
if (g_perf_mode != 1) return;
|
||||
uint64_t d = now - g_perf_last_ns;
|
||||
if (!g_perf_last_ns || d > 2000000000ull) { // first frame, or a stall the window should not average in
|
||||
@@ -1634,7 +1657,9 @@ static void perf_tick(uint64_t now, const MenuTarget *t) {
|
||||
g_perf_frames++;
|
||||
if (d > g_perf_max_ns) g_perf_max_ns = d;
|
||||
if (g_perf_win_ns >= 500000000ull) {
|
||||
snprintf(g_perf_text, sizeof g_perf_text, menu_text(UI_PERF_LINE_FPS), g_perf_frames * 1e9 / g_perf_win_ns);
|
||||
double drawn = g_perf_frames * 1e9 / g_perf_win_ns;
|
||||
if (g_shown_fps > 0) snprintf(g_perf_text, sizeof g_perf_text, menu_text(UI_PERF_LINE_FPS_GEN), drawn, g_shown_fps);
|
||||
else snprintf(g_perf_text, sizeof g_perf_text, menu_text(UI_PERF_LINE_FPS), drawn);
|
||||
g_perf_win_ns = g_perf_max_ns = 0;
|
||||
g_perf_frames = 0;
|
||||
}
|
||||
@@ -1689,7 +1714,7 @@ static float perf_gb(float mb) { return mb < 0 ? -1 : mb / 1024; }
|
||||
static void perf_picture(const MenuTarget *t, const ImVec4 &c) {
|
||||
unsigned out[2], scene[2];
|
||||
res_sizes(out, scene);
|
||||
char v[6][64];
|
||||
char v[7][64];
|
||||
snprintf(v[0], sizeof v[0], menu_text(UI_MENU_OV_FMT_SIZE), t->width, t->height);
|
||||
snprintf(v[1], sizeof v[1], menu_text(UI_MENU_OV_FMT_SIZE), (unsigned)t->image_w, (unsigned)t->image_h);
|
||||
snprintf(v[2], sizeof v[2], menu_text(UI_MENU_OV_FMT_SCENE), scene[0], scene[1], scene[0] * 100.0 / out[0]);
|
||||
@@ -1708,14 +1733,17 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) {
|
||||
if (hz > 0) snprintf(v[4], sizeof v[4], menu_text(UI_MENU_OV_FPS), hz);
|
||||
const char *pm = present_name(gfx_window_present_mode());
|
||||
snprintf(v[5], sizeof v[5], "%s", pm ? pm : menu_text(UI_MENU_OV_NONE));
|
||||
static const UiTextId labels[6] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE,
|
||||
UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT};
|
||||
// with frame generation: the pictures shown a second, of which the FPS row above counts the ones the game drew
|
||||
int n = 6;
|
||||
if (g_shown_fps > 0) snprintf(v[n++], sizeof v[6], menu_text(UI_MENU_OV_FPS), g_shown_fps);
|
||||
static const UiTextId labels[7] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_SCALING,
|
||||
UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT, UI_MENU_OV_SHOWN};
|
||||
if (!ImGui::BeginTable("##perfp", 2, ImGuiTableFlags_SizingFixedFit)) return;
|
||||
float vw = 0;
|
||||
for (auto &s : v) vw = fmaxf(vw, ImGui::CalcTextSize(s).x);
|
||||
for (int i = 0; i < n; i++) vw = fmaxf(vw, ImGui::CalcTextSize(v[i]).x);
|
||||
ImGui::TableSetupColumn("##p0", ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn("##p1", ImGuiTableColumnFlags_WidthFixed, vw);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
perf_label(labels[i], c);
|
||||
ImGui::TableNextColumn();
|
||||
perf_right(v[i], false);
|
||||
|
||||
+22
-3
@@ -61,6 +61,7 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_PERF_OFF] = "Off", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Full",
|
||||
// printf format of the overlay line in FPS mode: the frame rate
|
||||
[UI_PERF_LINE_FPS] = "%.0f fps",
|
||||
[UI_PERF_LINE_FPS_GEN] = "%.0f fps drawn, %.0f shown",
|
||||
[UI_MENU_GRAPHICS] = "Picture",
|
||||
[UI_MENU_OUTPUT_RES] = "Game resolution",
|
||||
[UI_MENU_OUTPUT_RES_DESC] = "The size the game draws its picture and interface in. Above 1920 x 1080 the game needs "
|
||||
@@ -193,6 +194,10 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_FRAME_QUEUE] = "Frame queue",
|
||||
[UI_MENU_FRAME_QUEUE_DESC] = "The game starts a frame while the previous one waits for its turn on screen: far fewer "
|
||||
"dropped frames at the limit, up to one frame more input delay. Applies at once.",
|
||||
[UI_MENU_FRAME_GEN] = "Frame generation", [UI_MENU_FRAME_GEN_OFF] = "Off", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3",
|
||||
[UI_MENU_FRAME_GEN_DESC] = "A generated picture between each two the game draws: twice the pictures on screen, the "
|
||||
"game at half the frame limit and the controls about half a frame later. For displays "
|
||||
"of 120 Hz and more. Not with DLSS or HDR. Applies at once.",
|
||||
[UI_MENU_REALTIME] = "Game speed follows the clock",
|
||||
[UI_MENU_REALTIME_DESC] = "Steps the game by real time, so a slow frame does not slow the game down.",
|
||||
[UI_MENU_CLOTH_REALTIME] = "Cloth on the clock",
|
||||
@@ -600,7 +605,7 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_OV_FMT_MHZ] = "%.0f MHz", [UI_MENU_OV_FMT_GB] = "%.1f GB", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f GB",
|
||||
[UI_MENU_OV_GAME_GB] = "game %.1f GB", [UI_MENU_OV_FMT_MS] = "%.2f ms", [UI_MENU_OV_PER_FRAME] = "%.1f per frame",
|
||||
[UI_MENU_OV_WINDOW] = "Window", [UI_MENU_OV_OUTPUT] = "Game image", [UI_MENU_OV_SCENE] = "3D scene",
|
||||
[UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation",
|
||||
[UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation", [UI_MENU_OV_SHOWN] = "Shown",
|
||||
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%",
|
||||
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, sharpness %d%%", [UI_MENU_OV_SCALE_NONE] = "none (1:1)",
|
||||
[UI_MENU_OV_SCALE_BILINEAR] = "bilinear",
|
||||
@@ -690,6 +695,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
"режимы.",
|
||||
[UI_MENU_PERF_OFF] = "Выкл.", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Полный",
|
||||
[UI_PERF_LINE_FPS] = "%.0f к/с",
|
||||
[UI_PERF_LINE_FPS_GEN] = "%.0f к/с отрисовано, %.0f показано",
|
||||
[UI_MENU_GRAPHICS] = "Изображение",
|
||||
[UI_MENU_OUTPUT_RES] = "Разрешение игры",
|
||||
[UI_MENU_OUTPUT_RES_DESC] = "Размер, в котором игра рисует картинку и интерфейс. Выше 1920 × 1080 игре нужно больше "
|
||||
@@ -822,6 +828,10 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_FRAME_QUEUE] = "Очередь кадров",
|
||||
[UI_MENU_FRAME_QUEUE_DESC] = "Игра начинает кадр, пока предыдущий ждёт показа: намного меньше пропущенных кадров на "
|
||||
"лимите, задержка ввода больше не более чем на кадр. Применяется сразу.",
|
||||
[UI_MENU_FRAME_GEN] = "Генерация кадров", [UI_MENU_FRAME_GEN_OFF] = "Выкл.", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3",
|
||||
[UI_MENU_FRAME_GEN_DESC] = "Сгенерированный кадр между каждыми двумя, что рисует игра: на экране вдвое больше "
|
||||
"кадров, игра идёт на половине лимита, управление отвечает примерно на полкадра позже. "
|
||||
"Для мониторов от 120 Гц. Не работает с DLSS и HDR. Применяется сразу.",
|
||||
[UI_MENU_REALTIME] = "Скорость игры по часам",
|
||||
[UI_MENU_REALTIME_DESC] = "Игра идёт по реальному времени, медленный кадр её не замедляет.",
|
||||
[UI_MENU_CLOTH_REALTIME] = "Ткань по часам",
|
||||
@@ -1234,7 +1244,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_OV_FMT_MHZ] = "%.0f МГц", [UI_MENU_OV_FMT_GB] = "%.1f ГБ", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f ГБ",
|
||||
[UI_MENU_OV_GAME_GB] = "игра %.1f ГБ", [UI_MENU_OV_FMT_MS] = "%.2f мс", [UI_MENU_OV_PER_FRAME] = "%.1f за кадр",
|
||||
[UI_MENU_OV_WINDOW] = "Окно", [UI_MENU_OV_OUTPUT] = "Изображение игры", [UI_MENU_OV_SCENE] = "3D-сцена",
|
||||
[UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров",
|
||||
[UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров", [UI_MENU_OV_SHOWN] = "Показано",
|
||||
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%",
|
||||
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, резкость %d%%", [UI_MENU_OV_SCALE_NONE] = "нет (1:1)",
|
||||
[UI_MENU_OV_SCALE_BILINEAR] = "билинейное",
|
||||
@@ -1360,6 +1370,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
"renderização. F10 alterna os modos.",
|
||||
[UI_MENU_PERF_OFF] = "Desligado", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Completo",
|
||||
[UI_PERF_LINE_FPS] = "%.0f fps",
|
||||
[UI_PERF_LINE_FPS_GEN] = "%.0f fps desenhados, %.0f exibidos",
|
||||
[UI_MENU_GRAPHICS] = "Imagem",
|
||||
[UI_MENU_OUTPUT_RES] = "Resolução do jogo",
|
||||
[UI_MENU_OUTPUT_RES_DESC] = "O tamanho em que o jogo desenha a imagem e a interface. Acima de 1920 x 1080 o jogo "
|
||||
@@ -1407,6 +1418,10 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_FRAME_QUEUE] = "Fila de quadros",
|
||||
[UI_MENU_FRAME_QUEUE_DESC] = "O jogo começa um quadro enquanto o anterior espera a vez de aparecer: muito menos quadros "
|
||||
"perdidos no limite, com até um quadro a mais de atraso na entrada. Vale na hora.",
|
||||
[UI_MENU_FRAME_GEN] = "Geração de quadros", [UI_MENU_FRAME_GEN_OFF] = "Desligado", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3",
|
||||
[UI_MENU_FRAME_GEN_DESC] = "Um quadro gerado entre cada dois que o jogo desenha: o dobro de quadros na tela, o "
|
||||
"jogo na metade do limite e os controles cerca de meio quadro mais tarde. Para telas de "
|
||||
"120 Hz ou mais. Não funciona com DLSS nem HDR. Vale na hora.",
|
||||
[UI_MENU_REALTIME] = "Velocidade do jogo pelo relógio",
|
||||
[UI_MENU_REALTIME_DESC] = "Avança o jogo pelo tempo real, para que um quadro lento não deixe o jogo mais lento.",
|
||||
[UI_MENU_CLOTH_REALTIME] = "Tecidos pelo relógio",
|
||||
@@ -1684,7 +1699,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_OV_FMT_MHZ] = "%.0f MHz", [UI_MENU_OV_FMT_GB] = "%.1f GB", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f GB",
|
||||
[UI_MENU_OV_GAME_GB] = "jogo %.1f GB", [UI_MENU_OV_FMT_MS] = "%.2f ms", [UI_MENU_OV_PER_FRAME] = "%.1f por quadro",
|
||||
[UI_MENU_OV_WINDOW] = "Janela", [UI_MENU_OV_OUTPUT] = "Imagem do jogo", [UI_MENU_OV_SCENE] = "Cena 3D",
|
||||
[UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação",
|
||||
[UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação", [UI_MENU_OV_SHOWN] = "Exibidos",
|
||||
[UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%",
|
||||
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1, nitidez %d%%", [UI_MENU_OV_SCALE_NONE] = "nenhuma (1:1)",
|
||||
[UI_MENU_OV_SCALE_BILINEAR] = "bilinear",
|
||||
@@ -2039,6 +2054,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_PERF_FULL] = "完整",
|
||||
|
||||
[UI_PERF_LINE_FPS] = "%.0f fps",
|
||||
[UI_PERF_LINE_FPS_GEN] = "绘制 %.0f fps,显示 %.0f",
|
||||
|
||||
[UI_MENU_GRAPHICS] = "画面",
|
||||
[UI_MENU_OUTPUT_RES] = "游戏分辨率",
|
||||
@@ -2108,6 +2124,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_FPS_DISPLAY_HZ] = "显示器刷新率(%.0f Hz)",
|
||||
[UI_MENU_FRAME_QUEUE] = "帧队列",
|
||||
[UI_MENU_FRAME_QUEUE_DESC] = "前一帧等待显示时游戏就开始绘制下一帧:在帧率上限下掉帧大幅减少,输入延迟最多增加一帧。立即生效。",
|
||||
[UI_MENU_FRAME_GEN] = "帧生成", [UI_MENU_FRAME_GEN_OFF] = "关", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3",
|
||||
[UI_MENU_FRAME_GEN_DESC] = "在游戏绘制的每两帧之间插入一帧生成画面:屏幕上的帧数翻倍,游戏以帧率上限的一半运行,操作响应约晚半帧。适合 120 Hz 及以上的显示器。不能与 DLSS 或 HDR 同时使用。立即生效。",
|
||||
[UI_MENU_REALTIME] = "游戏速度跟随时钟",
|
||||
[UI_MENU_REALTIME_DESC] = "按真实时间推进游戏,帧率低时游戏速度也不会变慢。",
|
||||
[UI_MENU_CLOTH_REALTIME] = "布料跟随时钟",
|
||||
@@ -2489,6 +2507,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_OV_SCALING] = "缩放",
|
||||
[UI_MENU_OV_LIMIT] = "帧率上限",
|
||||
[UI_MENU_OV_PRESENT] = "呈现模式",
|
||||
[UI_MENU_OV_SHOWN] = "显示帧率",
|
||||
[UI_MENU_OV_FMT_SIZE] = "%ux%u",
|
||||
[UI_MENU_OV_FMT_SCENE] = "%ux%u,%.0f%%",
|
||||
[UI_MENU_OV_FMT_FSR] = "AMD FSR 1,锐度 %d%%",
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
UI_MENU_GPU, UI_MENU_GPU_DESC, UI_MENU_GPU_AUTO,
|
||||
UI_MENU_PERF_OVERLAY, UI_MENU_PERF_OVERLAY_DESC, UI_MENU_PERF_OFF, UI_MENU_PERF_FPS, UI_MENU_PERF_FULL,
|
||||
UI_PERF_LINE_FPS,
|
||||
UI_PERF_LINE_FPS_GEN, // "%.0f fps drawn, %.0f shown": frame generation on
|
||||
UI_MENU_GRAPHICS, // group heading over the resolution rows
|
||||
UI_MENU_OUTPUT_RES, UI_MENU_OUTPUT_RES_DESC,
|
||||
UI_MENU_HUD_WIDTH, UI_MENU_HUD_WIDTH_DESC, UI_MENU_HUD_WIDTH_FULL,
|
||||
@@ -69,6 +70,7 @@ typedef enum {
|
||||
UI_MENU_FPS_120, UI_MENU_FPS_144,
|
||||
UI_MENU_FPS_DISPLAY, UI_MENU_FPS_DISPLAY_HZ,
|
||||
UI_MENU_FRAME_QUEUE, UI_MENU_FRAME_QUEUE_DESC,
|
||||
UI_MENU_FRAME_GEN, UI_MENU_FRAME_GEN_OFF, UI_MENU_FRAME_GEN_FSR3, UI_MENU_FRAME_GEN_DESC,
|
||||
UI_MENU_REALTIME, UI_MENU_REALTIME_DESC,
|
||||
UI_MENU_CLOTH_REALTIME, UI_MENU_CLOTH_REALTIME_DESC,
|
||||
UI_MENU_HIGHFPS_FIX, UI_MENU_HIGHFPS_FIX_DESC,
|
||||
@@ -284,6 +286,7 @@ typedef enum {
|
||||
UI_MENU_OV_FMT_GB_OF, UI_MENU_OV_GAME_GB, UI_MENU_OV_FMT_MS, UI_MENU_OV_PER_FRAME,
|
||||
// the picture lines: window, game image and 3D scene sizes, the scaling to the window, frame limit and presentation
|
||||
UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT,
|
||||
UI_MENU_OV_SHOWN, // frame generation: the pictures shown a second
|
||||
UI_MENU_OV_FMT_SIZE, // "%ux%u"
|
||||
UI_MENU_OV_FMT_SCENE, // "%ux%u, %.0f%%": the scene and its share of the game image's width
|
||||
UI_MENU_OV_FMT_FSR, // "AMD FSR 1, sharpness %d%%"
|
||||
|
||||
+26
-8
@@ -252,17 +252,29 @@ static int knob_int(const char *key) {
|
||||
}
|
||||
|
||||
extern "C" VkFgEngine vk_fg_engine(void) {
|
||||
static int e = -1;
|
||||
if (e < 0) {
|
||||
const char *v = cfg_value("TOTK_FRAME_GEN");
|
||||
e = !strcmp(v, "fsr3") ? VK_FG_FSR3 : VK_FG_OFF;
|
||||
if (e == VK_FG_OFF && strcmp(v, "off")) rt_log("fg: frame_gen = %s is not off or fsr3: off", v);
|
||||
static volatile int e = VK_FG_OFF;
|
||||
static volatile unsigned seen; // the cfg_version read, + 1 (0: never)
|
||||
unsigned v = cfg_version();
|
||||
if (__atomic_load_n(&seen, __ATOMIC_ACQUIRE) != v + 1) {
|
||||
const char *s = cfg_value("TOTK_FRAME_GEN");
|
||||
int n = !strcmp(s, "fsr3") ? VK_FG_FSR3 : VK_FG_OFF;
|
||||
static char said[16];
|
||||
if (strncmp(said, s, sizeof said - 1)) {
|
||||
snprintf(said, sizeof said, "%s", s);
|
||||
if (n == VK_FG_OFF && strcmp(s, "off")) rt_log("fg: frame_gen = %s is not off or fsr3: off", s);
|
||||
else if (seen) rt_log("fg: frame_gen = %s", s);
|
||||
}
|
||||
e = n;
|
||||
__atomic_store_n(&seen, v + 1, __ATOMIC_RELEASE);
|
||||
}
|
||||
return (VkFgEngine)e;
|
||||
}
|
||||
|
||||
extern "C" void vk_fg_init(void) {
|
||||
if (vk_fg_engine() != VK_FG_FSR3) return;
|
||||
// The settings and the contexts, once: at start with frame_gen = fsr3, else at the first frame after the menu turns it
|
||||
// on (vk_fg_wanted).
|
||||
static bool started;
|
||||
static void start(void) {
|
||||
started = true;
|
||||
VkCtx *c = vk_ctx();
|
||||
if (!c) return;
|
||||
// The first contexts at the output size from the settings; vk_fg_prepare makes them again for the real scene
|
||||
@@ -301,11 +313,17 @@ extern "C" void vk_fg_init(void) {
|
||||
g.debug ? "; TOTK_FG_DEBUG: the SDK's debug view" : "");
|
||||
}
|
||||
|
||||
extern "C" int vk_fg_active(void) { return g.live; }
|
||||
extern "C" void vk_fg_init(void) {
|
||||
if (vk_fg_engine() == VK_FG_FSR3) start();
|
||||
}
|
||||
|
||||
extern "C" int vk_fg_active(void) { return g.live && vk_fg_engine() != VK_FG_OFF; }
|
||||
|
||||
extern "C" void vk_fg_menu(int open) { __atomic_store_n(&g.menu, open, __ATOMIC_RELAXED); }
|
||||
|
||||
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
|
||||
|
||||
+5
-4
@@ -14,14 +14,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// The frame generator frame_gen names (TOTK_FRAME_GEN, read at start): off, or AMD FSR 3 on the FidelityFX SDK. The
|
||||
// one place that reads the string; an unknown value is off.
|
||||
// The frame generator frame_gen names (TOTK_FRAME_GEN, live: read again after a settings change): off, or AMD FSR 3 on
|
||||
// the FidelityFX SDK. The one place that reads the string; an unknown value is off.
|
||||
typedef enum { VK_FG_OFF, VK_FG_FSR3 } VkFgEngine;
|
||||
VkFgEngine vk_fg_engine(void);
|
||||
// vk_device.c, after the device exists: with frame_gen = fsr3 makes the shared backend, the optical flow and the
|
||||
// frame interpolation contexts and logs one line; otherwise does nothing.
|
||||
// frame interpolation contexts and logs one line; otherwise does nothing, and vk_fg_wanted makes them at the first
|
||||
// frame after the menu turns frame generation on. Turned off, the contexts stay until exit (unused).
|
||||
void vk_fg_init(void);
|
||||
// 1 while the contexts exist.
|
||||
// 1 while the contexts exist and frame_gen names a generator.
|
||||
int vk_fg_active(void);
|
||||
// vk_device.c destroy_all, before the device goes away; harmless when nothing was made.
|
||||
void vk_fg_release(void);
|
||||
|
||||
Reference in new issue
Block a user