mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 04:55:56 +00:00
Skip the present lock for the Reflex frame ID when nothing reads it, and declare the front end's Reflex calls in gfx.h
vk_reflex_present_frame took g_pl on every present although only flip_locked's VkPresentIdKHR (Reflex) and latency_note (TOTK_TRACE=perf) read g_blit_pid. nvn_api_obj.c and ov_input.c declared vk_reflex_marker, vk_reflex_frame_begin, vk_reflex_frame and vk_reflex_sleep locally; they now come from gfx.h, the graphics layer's interface, which gfx_present.c also sees through vk.h, so a changed signature fails to compile. vk.h stays out of those two files: it brings in Vulkan, VMA and vk_rec.h's vkCmd* macros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
52b099bacb
commit
7fa727bbc5
5 files changed
+10
-12
No files matched your search
@@ -24,6 +24,12 @@ uint64_t gfx_vsync_time_ns(uint64_t tick); // kern_now_ns() time
|
||||
double gfx_window_refresh_hz(void); // refresh rate of the window's monitor; 0 unknown
|
||||
int gfx_window_focused(void);
|
||||
int gfx_picture_rect(float out[4]); // where the last present put the picture, fractions of the swapchain (x, y, w, h); 0 before one
|
||||
// NVIDIA Reflex (gfx_present.c, VK_NV_low_latency2): the NVN front end and the input service mark a frame's stages.
|
||||
// The markers and the sleep return at once with Reflex off or unsupported.
|
||||
void vk_reflex_marker(int marker, uint64_t present_id); // present_id: the frame's (vk_reflex_frame_begin)
|
||||
uint64_t vk_reflex_frame_begin(void); // SIMULATION_START: the new frame's present ID
|
||||
uint64_t vk_reflex_frame(void); // the ID of the frame the game simulates now
|
||||
void vk_reflex_sleep(void); // before SIMULATION_START: the driver's latency sleep
|
||||
|
||||
// ---- shader service client (gfx_shader.c)
|
||||
enum { GFX_STAGE_VS, GFX_STAGE_TCS, GFX_STAGE_TES, GFX_STAGE_GS, GFX_STAGE_FS, GFX_STAGE_CS };
|
||||
|
||||
@@ -386,6 +386,9 @@ uint64_t vk_reflex_submit_id(void) { return t_reflex_submit ? t_reflex_submit :
|
||||
|
||||
// The present thread, before the blit of frame id: the present of that blit carries id.
|
||||
void vk_reflex_present_frame(uint64_t id) {
|
||||
// g_blit_pid feeds flip_locked's VkPresentIdKHR (Reflex) and latency_note (TOTK_TRACE=perf); with neither, the
|
||||
// present skips the lock
|
||||
if (!vk_has_reflex() && !(rt_trace & RT_TRACE_PERF)) return;
|
||||
plat_rmutex_lock(&g_pl);
|
||||
g_blit_pid = id;
|
||||
plat_rmutex_unlock(&g_pl);
|
||||
|
||||
@@ -19,11 +19,6 @@
|
||||
#include "nvn_tex.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
void vk_reflex_marker(int marker, uint64_t present_id);
|
||||
uint64_t vk_reflex_frame_begin(void);
|
||||
uint64_t vk_reflex_frame(void);
|
||||
void vk_reflex_sleep(void);
|
||||
|
||||
// ---------- Descriptor pools
|
||||
// NVNboolean nvnTexturePoolInitialize(NVNtexturePool *tp, const NVNmemoryPool *p, ptrdiff_t offset, int n)
|
||||
NVN_API(nvnTexturePoolInitialize) {
|
||||
|
||||
+1
-3
@@ -12,14 +12,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "cfg.h"
|
||||
#include "gfx.h"
|
||||
#include "host.h"
|
||||
#include "input.h"
|
||||
#include "ov.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
void vk_reflex_marker(int marker, uint64_t present_id);
|
||||
uint64_t vk_reflex_frame(void);
|
||||
|
||||
typedef struct { int64_t sampling; uint64_t buttons; int32_t lx, ly, rx, ry; uint32_t attributes, pad; } NpadState;
|
||||
typedef struct { int64_t sampling; int32_t x, y, dx, dy, wx, wy; uint32_t buttons, attributes; } MouseState;
|
||||
typedef struct { int64_t sampling; uint32_t modifiers, attributes; uint64_t keys[4]; } KeyboardState;
|
||||
|
||||
@@ -148,13 +148,9 @@ void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int
|
||||
int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4],
|
||||
VkImage dst, const int out[4]);
|
||||
void vk_fsr_release(void); // before the device goes away
|
||||
void vk_reflex_marker(int marker, uint64_t present_id); // present_id: the frame's (vk_reflex_frame_begin)
|
||||
uint64_t vk_reflex_frame_begin(void); // SIMULATION_START: the new frame's present ID
|
||||
uint64_t vk_reflex_frame(void); // the ID of the frame the game simulates now
|
||||
void vk_reflex_submit_frame(uint64_t id); // this thread's submissions belong to frame id (0: the game's current one)
|
||||
uint64_t vk_reflex_submit_id(void);
|
||||
void vk_reflex_present_frame(uint64_t id); // the present thread, before the blit of frame id
|
||||
void vk_reflex_sleep(void);
|
||||
int vk_has_reflex(void);
|
||||
// Colour adjustment on the present (vk_color.c): with TOTK_COLOR_* away from their defaults, records a pass that writes
|
||||
// src's crop rectangle {x, y, w, h}, adjusted, into an RGBA16F image of that size in GENERAL and returns it (the caller
|
||||
|
||||
Reference in new issue
Block a user