mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 21:29:58 -04:00
framegen_multiplier (2, 3 or 4, live) sets how many frames the display gets per rendered frame while NVIDIA DLSS frame generation runs, and a DLSS multiplier row under Frame generation in the Screen tab sets it. nx2navi_dlssg.dll now passes that count to Streamline and reports the GPU's limit (numFramesToGenerateMax) through a new optional export, nx2sl_frames_max; with an older DLL the game keeps to 2x. A value above the limit is clamped to it with a log line, and the menu lists only what the GPU and driver allow, with a note saying why the rest are missing. The Frame generation row now says "in use: off" and why when DLSS frame generation was set but does not run. The pacer divides the frame limit by the multiplier in effect, as it already halved it for FSR 3.1, so the display gets the limit and VSync at the display's rate drops no generated frames; RivaTuner Statistics Server stays out while DLSS frame generation runs, since it counts generated frames. With DLSS 2x a limit of 60 now shows 60 on screen instead of 120. nx2navi_dlssg.dll has to be rebuilt (tools/build_dlssg.py) for 3x and 4x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
4.0 KiB
C
51 lines
4.0 KiB
C
// DLSS Frame Generation through NVIDIA Streamline (vk_dlssg.c, nx2navi_dlssg.dll).
|
|
#pragma once
|
|
#include <stdint.h>
|
|
#include <vulkan/vulkan.h>
|
|
|
|
int vk_dlssg_wanted(void); // NX2NAVI_FRAMEGEN = dlss with DLSS or FSR 3.1 upscaling on (read once)
|
|
int vk_dlssg_early(void); // before the instance exists: loads the DLL and Streamline; 1 when its proxies are there
|
|
// vk_device.c: the instance and device through Streamline's proxies when vk_dlssg_early succeeded, else the loader's
|
|
VkResult vk_dlssg_create_instance(const VkInstanceCreateInfo *ci, VkInstance *out);
|
|
VkResult vk_dlssg_enumerate(VkInstance inst, uint32_t *n, VkPhysicalDevice *pd); // through the interposer too
|
|
PFN_vkVoidFunction vk_dlssg_instance_proc(VkInstance inst, const char *name); // the interposer's, or NULL
|
|
VkResult vk_dlssg_create_device(VkInstance inst, VkPhysicalDevice pd, const VkDeviceCreateInfo *ci, VkDevice *out);
|
|
void vk_dlssg_device_ready(VkDevice dev); // after the device: checks DLSS-G and takes the swapchain hooks
|
|
PFN_vkGetDeviceProcAddr vk_dlssg_dpa(void); // Streamline's device entry points, or NULL when it is not in use
|
|
int vk_dlssg_active(void);
|
|
// gfx_present.c's swapchain calls while active
|
|
VkResult vk_dlssg_create_swapchain(VkDevice d, const VkSwapchainCreateInfoKHR *ci, VkSwapchainKHR *sc);
|
|
void vk_dlssg_destroy_swapchain(VkDevice d, VkSwapchainKHR sc);
|
|
VkResult vk_dlssg_get_images(VkDevice d, VkSwapchainKHR sc, uint32_t *n, VkImage *img);
|
|
VkResult vk_dlssg_acquire(VkDevice d, VkSwapchainKHR sc, uint64_t timeout, VkSemaphore sem, uint32_t *idx);
|
|
VkResult vk_dlssg_present(VkQueue q, const VkPresentInfoKHR *pi);
|
|
void vk_dlssg_frame(VkCommandBuffer cb, VkExtent2D ext); // each present, before its command buffer is submitted
|
|
// Frames are numbered by the game's presents (frame n ends with the n-th). Reflex's frame timing while active:
|
|
void vk_dlssg_frame_start(void); // the game starts a frame (nvn_api_obj.c nvnWindowAcquireTexture): Reflex's sleep
|
|
void vk_dlssg_game_present(void); // the game presents it (vk_backend.c vk_be_present): counts it
|
|
// its submissions went out (vk_backend.c: vk_be_present, or replay_main with asynchronous replay): the render-submit-end
|
|
// marker; frame is gfx_counters.frames of its present, the same count
|
|
void vk_dlssg_submitted(uint64_t frame);
|
|
void vk_dlssg_present_frame(uint64_t frame); // the present thread's next blit and present are of this frame
|
|
uint64_t vk_dlssg_shown(void); // the frames the display got, generated ones included (present thread); 0 when off
|
|
void vk_dlssg_release(void);
|
|
|
|
// The multiplier: the frames the display gets per rendered frame, 2, 3 or 4 (one to three generated), set by
|
|
// NX2NAVI_FRAMEGEN_MULTIPLIER and applied at once.
|
|
// What a setting value gives where the GPU and driver allow up to max (2 to 4): the value when it is 2, 3 or 4 ("3x"
|
|
// too) and at most max, else the nearest that is; unset or empty, 2. *why (may be NULL): the reason the value was not
|
|
// taken as it is, for the log, or NULL.
|
|
int vk_dlssg_multiplier_of(const char *value, int max, const char **why);
|
|
// The highest multiplier while DLSS-G runs: 2 to 4 from Streamline's numFramesToGenerateMax; 0 while DLSS-G does not
|
|
// run, or before Streamline reported its limit (the first frames; one frame is generated until then). *old_dll (may be
|
|
// NULL): 1 when the limit of 2 is nx2navi_dlssg.dll's, a build older than its nx2sl_frames_max, not the GPU's.
|
|
int vk_dlssg_multiplier_max(int *old_dll);
|
|
// The frames the display gets per game frame now: the multiplier while generation runs, 1 while it is off or paused
|
|
// (the menu). frame_rate.c paces the game at the frame limit over it. Any thread.
|
|
int vk_dlssg_multiplier(void);
|
|
// Why DLSS-G runs or not: DLSSG_NOT_WANTED (NX2NAVI_FRAMEGEN was not dlss at start, or no DLSS or FSR 3.1 upscaling),
|
|
// DLSSG_NO_FILES (nx2navi_dlssg.dll, Streamline or its swapchain hooks missing or failing), DLSSG_NO_GPU (Streamline
|
|
// loaded, but DLSS-G does not run on this GPU or driver).
|
|
enum { DLSSG_NOT_WANTED, DLSSG_RUNS, DLSSG_NO_FILES, DLSSG_NO_GPU };
|
|
int vk_dlssg_status(void);
|