mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
Implement Native NVIDIA Reflex Low Latency (VK_NV_low_latency2)
- Enable VK_NV_low_latency2 and VK_KHR_present_id with present ID features - Add VkSwapchainLatencyCreateInfoNV to swapchain creation - Link present and submission IDs with standard Vulkan latency types - Insert latency markers: simulation start/end, input sample, render submit, and present - Gate all extensions and latency chains on reflex != off (RESTART setting) - Log graceful notice when Reflex is requested on unsupported hardware - Add UI menu setting and translations for en, ru, pt-BR, zh-Hans - Document reflex setting in totk.ini.example and docs/settings.md
This commit is contained in:
1 parent
7a37fc3c34
commit
3209ea4358
12 files changed
+196
-9
No files matched your search
+15
-2
@@ -283,6 +283,7 @@ typedef struct {
|
||||
VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT fbl;
|
||||
VkPhysicalDeviceDynamicRenderingLocalReadFeaturesKHR lr;
|
||||
VkPhysicalDeviceAddressBindingReportFeaturesEXT abr;
|
||||
VkPhysicalDevicePresentIdFeaturesKHR pid;
|
||||
} FeatureChain;
|
||||
|
||||
static int create_device(void) {
|
||||
@@ -290,7 +291,7 @@ static int create_device(void) {
|
||||
vkEnumerateDeviceExtensionProperties(g_vk.phys, NULL, &ne, NULL);
|
||||
VkExtensionProperties *ep = calloc(ne ? ne : 1, sizeof *ep);
|
||||
vkEnumerateDeviceExtensionProperties(g_vk.phys, NULL, &ne, ep);
|
||||
const char *ext[48];
|
||||
const char *ext[52];
|
||||
uint32_t n_ext = 0;
|
||||
for (size_t i = 0; i < sizeof k_required_ext / sizeof *k_required_ext; i++) ext[n_ext++] = k_required_ext[i];
|
||||
|
||||
@@ -334,7 +335,7 @@ static int create_device(void) {
|
||||
CHAIN(fbl, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT);
|
||||
CHAIN(lr, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_LOCAL_READ_FEATURES_KHR);
|
||||
}
|
||||
vk_dlaa_device_exts(ep, ne, ext, &n_ext, 40); // NGX's; the eight slots after it stay for the seven below
|
||||
vk_dlaa_device_exts(ep, ne, ext, &n_ext, 40); // NGX's; the twelve slots after it stay for the nine below
|
||||
if (has_ext(ep, ne, VK_EXT_MEMORY_BUDGET_EXTENSION_NAME)) { g_vk.has_memory_budget = 1; ext[n_ext++] = VK_EXT_MEMORY_BUDGET_EXTENSION_NAME; }
|
||||
// GPU timestamps on the CPU clock (vk_sync.c): the perf line splits GPU idle time into waiting for a submission or not.
|
||||
if (has_ext(ep, ne, VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME)) { g_vk.has_calibrated = 2; ext[n_ext++] = VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME; }
|
||||
@@ -351,6 +352,18 @@ static int create_device(void) {
|
||||
g_vk.has_nv_checkpoints = 1;
|
||||
ext[n_ext++] = VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME;
|
||||
}
|
||||
// NVIDIA Reflex Low Latency (VK_NV_low_latency2 requires VK_KHR_present_id)
|
||||
const char *rv = cfg_value("TOTK_REFLEX");
|
||||
if (rv && strcmp(rv, "off") != 0 && strcmp(rv, "0") != 0) {
|
||||
if (has_ext(ep, ne, VK_KHR_PRESENT_ID_EXTENSION_NAME) && has_ext(ep, ne, "VK_NV_low_latency2")) {
|
||||
g_vk.has_nv_reflex = 1;
|
||||
ext[n_ext++] = VK_KHR_PRESENT_ID_EXTENSION_NAME;
|
||||
ext[n_ext++] = "VK_NV_low_latency2";
|
||||
CHAIN(pid, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR);
|
||||
} else {
|
||||
rt_log("Reflex: VK_NV_low_latency2 not available");
|
||||
}
|
||||
}
|
||||
// Graphics pipeline library: chained last so it can be dropped again when vk_caps_gpl declines it.
|
||||
void **gpl_link = NULL;
|
||||
if (has_ext(ep, ne, VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME) && has_ext(ep, ne, VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME)) {
|
||||
|
||||
Reference in new issue
Block a user