diff --git a/runtime/dlssg/nx2_sl.cpp b/runtime/dlssg/nx2_sl.cpp index 12c11a31..0307e7e3 100644 --- a/runtime/dlssg/nx2_sl.cpp +++ b/runtime/dlssg/nx2_sl.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -151,12 +152,22 @@ extern "C" NX2SL_API int nx2sl_available(void) { sl::DLSSGState s{}; if (g_available && p_dlssg_state && p_dlssg_state(sl::ViewportHandle(0), s, nullptr) == sl::Result::eOk) g_max.store(s.numFramesToGenerateMax); - if (!g_available) say("dlssg: DLSS Frame Generation not available on this GPU or driver"); + if (!g_available) say("dlssg: frame generation unavailable (DLSS-G plugin loaded: %d, DLSS-G options: %d, PCL marker: %d)", + loaded, p_dlssg_options != nullptr, p_marker != nullptr); else if (g_max.load()) say("dlssg: DLSS Frame Generation available, up to %ux", g_max.load() + 1); else say("dlssg: DLSS Frame Generation available (its most frames per rendered frame not reported yet)"); return g_available; } +extern "C" NX2SL_API void nx2sl_log_unavailable(VkPhysicalDevice physical) { + auto supported = proc("slIsFeatureSupported"); + if (!supported) return say("dlssg: Streamline has no adapter support query"); + sl::AdapterInfo adapter{}; + adapter.vkPhysicalDevice = physical; + sl::Result r = supported(sl::kFeatureDLSS_G, adapter); + say("dlssg: frame generation support on the selected Vulkan adapter: %s (%d)", sl::getResultAsStr(r), (int)r); +} + // Streamline sets Reflex's mode on the swapchain it was told of last (VK_NV_low_latency2) and drops it while there is // none, so it is set again after each swapchain. extern "C" NX2SL_API void nx2sl_reflex(int mode) { diff --git a/runtime/dlssg/nx2_sl.h b/runtime/dlssg/nx2_sl.h index 9728e7db..ab97a5c0 100644 --- a/runtime/dlssg/nx2_sl.h +++ b/runtime/dlssg/nx2_sl.h @@ -44,6 +44,8 @@ typedef PFN_vkGetInstanceProcAddr (*PFN_nx2sl_instance_proc)(void); typedef PFN_vkGetDeviceProcAddr (*PFN_nx2sl_device_proc)(void); // 1 when DLSS-G loaded and supports this GPU (after the device exists) typedef int (*PFN_nx2sl_available)(void); +// Optional: log Streamline's support result on the selected Vulkan device after availability failed. +typedef void (*PFN_nx2sl_log_unavailable)(VkPhysicalDevice physical); // Reflex's low-latency mode, 0 off, 1 on, 2 on with boost: after the device, and after each swapchain the game creates // through the interposer (the mode is the swapchain's) typedef void (*PFN_nx2sl_reflex)(int mode); diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 9e7fd90b..15dd3beb 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -1042,7 +1042,7 @@ static void row_framegen(void) { // NVIDIA's set since the start but not running: "in use: off" and why (vk_dlssg_status; the log has the details). // Through NGX that is NVIDIA's frame generation library missing beside the game, or a GPU it does not run on. const int st = cur != 2 || restart ? DLSSG_RUNS : ngx ? (vk_ngxfg_max() ? DLSSG_RUNS : DLSSG_NO_FILES) : vk_dlssg_status(); - if (st == DLSSG_NO_GPU) note = UI_MENU_FRAMEGEN_OFF_GPU; + if (st == DLSSG_UNAVAILABLE) note = UI_MENU_FRAMEGEN_UNAVAILABLE; else if (st == DLSSG_NO_FILES) note = UI_MENU_FRAMEGEN_OFF_FILES; int nv = opt_choice_index("NX2NAVI_FRAMEGEN", UI_MENU_FRAMEGEN, names, n, at, 0, desc, menu_text(note)); if (nv >= 0 && nv < n) opt_apply("NX2NAVI_FRAMEGEN", values[nv]); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 74fff1d9..d2f3cb75 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -582,7 +582,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_FRAMEGEN_MULT_RTX50] = "3x and 4x need an RTX 50 GPU", [UI_MENU_FRAMEGEN_MULT_UPTO] = "up to %dx on this GPU and driver", [UI_MENU_FRAMEGEN_MULT_OLD_DLL] = "2x only: update the DLSS frame generation files", - [UI_MENU_FRAMEGEN_OFF_GPU] = "in use: off, needs an RTX 40 GPU or newer", + [UI_MENU_FRAMEGEN_UNAVAILABLE] = "in use: off, see dlssg in the game log", [UI_MENU_FRAMEGEN_OFF_FILES] = "in use: off, its files are missing", [UI_MENU_GAME_RES] = "Resolution", [UI_MENU_GAME_RES_DESC] = "Height of the game's picture. Higher is sharper but costs more GPU power.", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 7d3262b0..d85946b2 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -293,7 +293,7 @@ typedef enum { UI_MENU_FRAMEGEN_MULT_RTX50, // this GPU and driver do 2x only UI_MENU_FRAMEGEN_MULT_UPTO, // printf: "%d", the highest multiplier this GPU and driver allow UI_MENU_FRAMEGEN_MULT_OLD_DLL, // nx2navi_dlssg.dll is older than multi frame generation - UI_MENU_FRAMEGEN_OFF_GPU, UI_MENU_FRAMEGEN_OFF_FILES, + UI_MENU_FRAMEGEN_UNAVAILABLE, UI_MENU_FRAMEGEN_OFF_FILES, UI_TEXT_COUNT } UiTextId; diff --git a/runtime/vk_device.c b/runtime/vk_device.c index ec421e51..6e1384b5 100644 --- a/runtime/vk_device.c +++ b/runtime/vk_device.c @@ -499,7 +499,7 @@ static int create_device(void) { VkResult r = vk_dlssg_create_device(g_vk.instance, g_vk.phys, &di, &g_vk.device); free(c); if (r != VK_SUCCESS) { rt_log("vk: vkCreateDevice failed (%d)", (int)r); return 0; } - vk_dlssg_device_ready(g_vk.device); + vk_dlssg_device_ready(g_vk.phys, g_vk.device); if (vk_dlssg_dpa()) { // Streamline's, so its plugins hook every entry point the replay fetches vk_dpa = vk_dlssg_dpa(); rt_log("vk: device entry points come through Streamline's interposer (DLSS Frame Generation)"); diff --git a/runtime/vk_dlssg.c b/runtime/vk_dlssg.c index 3017248b..3851a36b 100644 --- a/runtime/vk_dlssg.c +++ b/runtime/vk_dlssg.c @@ -34,7 +34,7 @@ static struct { int wanted, loaded, active; - int fail; // DLSSG_NO_FILES or DLSSG_NO_GPU when it was wanted and does not run (vk_dlssg_status) + int fail; // DLSSG_NO_FILES or DLSSG_UNAVAILABLE when it was wanted and does not run (vk_dlssg_status) int mode, pending; // generation as the driver has it, and the frames since the host asked for the other state int shown_mult; // vk_dlssg_multiplier: the frames per game frame as last handed to the DLL (1 while off) PFN_nx2sl_frames_max frames_max; // NULL with an older DLL, which generates one frame @@ -42,6 +42,7 @@ static struct { PFN_nx2sl_instance_proc gipa; PFN_nx2sl_device_proc gdpa; PFN_nx2sl_available available; + PFN_nx2sl_log_unavailable log_unavailable; PFN_nx2sl_frame frame; PFN_nx2sl_present_marker marker; PFN_nx2sl_sleep sleep; @@ -103,6 +104,7 @@ int vk_dlssg_early(void) { S.gipa = (PFN_nx2sl_instance_proc)(void *)GetProcAddress(m, "nx2sl_instance_proc"); S.gdpa = (PFN_nx2sl_device_proc)(void *)GetProcAddress(m, "nx2sl_device_proc"); S.available = (PFN_nx2sl_available)(void *)GetProcAddress(m, "nx2sl_available"); + S.log_unavailable = (PFN_nx2sl_log_unavailable)(void *)GetProcAddress(m, "nx2sl_log_unavailable"); S.frame = (PFN_nx2sl_frame)(void *)GetProcAddress(m, "nx2sl_frame"); S.marker = (PFN_nx2sl_present_marker)(void *)GetProcAddress(m, "nx2sl_present_marker"); S.sleep = (PFN_nx2sl_sleep)(void *)GetProcAddress(m, "nx2sl_sleep"); @@ -151,10 +153,11 @@ VkResult vk_dlssg_create_device(VkInstance inst, VkPhysicalDevice pd, const VkDe return f ? f(pd, ci, NULL, out) : vkCreateDevice(pd, ci, NULL, out); } -void vk_dlssg_device_ready(VkDevice dev) { +void vk_dlssg_device_ready(VkPhysicalDevice physical, VkDevice dev) { if (S.loaded <= 0) return; if (!S.available()) { - S.fail = DLSSG_NO_GPU; + S.fail = DLSSG_UNAVAILABLE; + if (S.log_unavailable) S.log_unavailable(physical); return; } PFN_vkGetDeviceProcAddr g = S.gdpa(); diff --git a/runtime/vk_dlssg.h b/runtime/vk_dlssg.h index ac191860..8f0c91ab 100644 --- a/runtime/vk_dlssg.h +++ b/runtime/vk_dlssg.h @@ -10,7 +10,7 @@ VkResult vk_dlssg_create_instance(const VkInstanceCreateInfo *ci, VkInstance *ou 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 +void vk_dlssg_device_ready(VkPhysicalDevice physical, 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 @@ -44,7 +44,7 @@ int vk_dlssg_multiplier_max(int *old_dll); // (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 }; +// DLSSG_NO_FILES (nx2navi_dlssg.dll, Streamline or its swapchain hooks missing or failing), DLSSG_UNAVAILABLE (Streamline +// loaded but DLSS-G or a required plugin function was unavailable). +enum { DLSSG_NOT_WANTED, DLSSG_RUNS, DLSSG_NO_FILES, DLSSG_UNAVAILABLE }; int vk_dlssg_status(void);