mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 08:39:57 -04:00
Pace DLSS Frame Generation with Reflex from the frame's start, so it no longer halves the game's frame rate.
Reflex's markers sat at the host present with frame numbers unlike the frame's tags, slReflexSleep was never called, and the low-latency mode was set before any swapchain existed, so it never applied. GfxBackend.frame_start, called from nvnWindowAcquireTexture, now sets the simulation and submit-start markers after Reflex's sleep (skipped once nothing was presented for 200 ms); submit end is set when the frame's submissions went out; the mode is set again after each swapchain (NX2NAVI_REFLEX: 1 on, 0 off, 2 boost); frames are numbered by the game's presents; and the fps counter counts what was shown. NX2SL_VERSION is 3, so nx2navi_dlssg.dll must be rebuilt. From a tester's fixes: 42-45 fps game, 84-90 on screen (was 24). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "vk_exec.h"
|
||||
#include "platform/platform.h"
|
||||
#include "vk_dlaa.h"
|
||||
#include "vk_dlssg.h"
|
||||
|
||||
#define WEAK __attribute__((weak))
|
||||
|
||||
@@ -59,6 +60,7 @@ static void present_main(void *arg) {
|
||||
plat_cond_broadcast(&pcv);
|
||||
plat_mutex_unlock(&pl);
|
||||
if (flight_on || vk_dump_white) vk_thumbs_frame(j.frame); // NX2NAVI_DUMP_WHITE reads them too
|
||||
vk_dlssg_present_frame(j.frame);
|
||||
vk_present_blit(j.image, VK_IMAGE_LAYOUT_GENERAL, j.format, j.w, j.h, j.has_crop ? j.crop : NULL);
|
||||
uint64_t f = vk_sync_submit(NULL, 0); // a timeline value after the blit: deferred destruction waits for the blit too
|
||||
if (j.value && f != j.value)
|
||||
@@ -222,6 +224,7 @@ static void replay_main(void *arg) {
|
||||
free((void *)it.tex);
|
||||
} else {
|
||||
uint64_t frame = __atomic_add_fetch(&gfx_counters.frames, 1, __ATOMIC_RELAXED);
|
||||
vk_dlssg_submitted(frame); // the frame's submissions were replayed before its present
|
||||
present_image(it.tex, it.has_crop ? it.crop : NULL, it.at, it.queued, frame, it.value);
|
||||
}
|
||||
plat_mutex_lock(&rl);
|
||||
@@ -327,8 +330,10 @@ void gfx_exit_log(void) {
|
||||
|
||||
static void vk_be_present(const tex_t *t, const int crop[4], uint64_t at_ns) {
|
||||
vk_sync_start();
|
||||
vk_dlssg_game_present();
|
||||
if (!gfx_replay_async()) {
|
||||
uint64_t frame = __atomic_add_fetch(&gfx_counters.frames, 1, __ATOMIC_RELAXED);
|
||||
vk_dlssg_submitted(frame);
|
||||
perf_present(frame); // before vk_exec_frame_log, which resets the frame's exec counts the flight recorder reads
|
||||
present_image(t, crop, at_ns, kern_now_ns(), frame, 0);
|
||||
return;
|
||||
@@ -524,6 +529,7 @@ const GfxBackend gfx_vulkan_backend = {
|
||||
.fence_wait = vk_sync_fence_wait,
|
||||
.fence_done = vk_sync_fence_done,
|
||||
.present = vk_be_present,
|
||||
.frame_start = vk_dlssg_frame_start,
|
||||
.finish = vk_be_finish,
|
||||
.read_texels = vk_be_read_texels,
|
||||
.write_texels = vk_be_write_texels,
|
||||
|
||||
Reference in New Issue
Block a user