Files
Triforce-Source/gpu/vk/vk_reflex.h
ruckus7382sfgsgdf 4fa4f9188b Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
2026-11-25 10:21:32 -06:00

50 lines
3.1 KiB
C++

// NVIDIA Reflex through VK_NV_low_latency2 (vk_reflex.cpp): the driver paces the game's frames so that the CPU starts one
// as late as it can and the frame waits less in the queue, for less delay from input to the screen.
#pragma once
#include <vector>
#include "vk_internal.h"
namespace mkwvk {
/// The extensions it needs (VK_NV_low_latency2, VK_KHR_present_id), added to `want` when the device has them
void reflex_device_extensions(std::vector<const char*>& want, const std::vector<VkExtensionProperties>& all);
/// Its feature (presentId) into the device's feature chain (*tail), before the features are queried
void reflex_device_features(void**& tail);
/// After the device is made: whether Reflex can run (the feature there), its functions loaded
void reflex_device_created();
/// Reflex can run on this device (VK_NV_low_latency2 and its functions): the Insert menu's row offers it only then
bool reflex_available();
/// Into a swapchain's creation: latency mode on while the row is on, nothing while it is off (the chained struct lives until
/// the next call)
void reflex_swapchain_info(VkSwapchainCreateInfoKHR& ci);
/// The row was turned on or off since the swapchain was made: it is to be made again (present_image)
bool reflex_swapchain_stale();
/// A swapchain made: its sleep mode set as the menu has it
void reflex_swapchain_created(VkSwapchainKHR swapchain);
/// Before destroying the current swapchain, including a failed replacement: stop using it for latency calls
void reflex_swapchain_destroyed();
/// The frame's markers, at the game's present: its simulation ended and its rendering's submission starts
void reflex_present_begins();
/// Before the present's submit: the rendering's submission ended
void reflex_submit_ends();
/// The present: a VkPresentIdKHR for VkPresentInfoKHR's pNext (or null), and the present's start marker
const void* reflex_present_id(const void* next);
/// ((Triforce) 11-24) A queue submit's VkLatencySubmissionPresentIdNV, chained in front of `next` for VkSubmitInfo2's pNext: the
/// game frame its GPU work belongs to (the frame being made, its present id), so the driver times that frame's rendering from
/// it rather than guessing. `next` itself unless RX_VK_REFLEX_SUBMIT_IDS=1, Reflex on and the frame's start markers given.
/// Off by default: the driver's own guess, as before (the coordinator's comparison decides). The struct is the calling
/// thread's until its next call: take it right before the submit
const void* reflex_submit_id(const void* next);
void reflex_presented();
/// After the present: the driver's sleep until the next frame should start, then that frame's start markers (left out while
/// the game's thread takes it where its frame starts: reflex_pace)
void reflex_sleep();
/// (Triforce, RX_VK_REFLEX_LIMIT=1) Where the game's frame starts (vk_pace.cpp frame_start), without DLSS frame generation:
/// true when Reflex's sleep holds this frame to the Game frame rate cap's period (period_ns; 0: none it may hold), taken
/// here; false, always without the switch: the game's own wait holds it
bool reflex_pace(int64_t period_ns);
} // namespace mkwvk