mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-11 01:41:02 +00:00
Shared runtime code now goes through runtime/platform/platform.h, implemented by platform/win32.c and a new platform/linux.c: futex locks, a userfaultfd and PAGEMAP_SCAN write watch, signal-based async preemption, our own fiber switch, and a SIGSEGV handler for the thaw and crash hooks. The window, input, menu and software keyboard get SDL3 back ends beside the Win32 ones, with the swapchain (gfx_present.c) and input merging (input.c) shared. SHA-256 replaces BCrypt, ELF builds get their own override sections, and the build tools gain Linux branches. On Linux the selftest and the gfx-abi, astc, nvn and window probes pass. probe-vkmem still fails: imported guest memory cannot be write-watched on Linux, which the shadow buffers in vk_memory.c will address.
23 lines
1.4 KiB
C
23 lines
1.4 KiB
C
// TOTK_FLIGHT=1 flight recorder (flight.c): the last frames' timing and event counts plus a thumbnail each, written to
|
|
// disk on F8 or after a slow frame, so a glitch or stutter seen in play can be read after the fact.
|
|
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#define FLIGHT_THUMB_W 320
|
|
#define FLIGHT_THUMB_H 180
|
|
|
|
extern int flight_on; // TOTK_FLIGHT=1, set once by flight_init before the first present
|
|
|
|
void flight_init(void); // prof_start calls it
|
|
// perf_present, once per present on the render thread: the interval since the previous present, the render thread's
|
|
// blocked time per PERF_* kind in this frame, and the running PERF_CNT_* totals.
|
|
void flight_frame(uint64_t frame, uint64_t now_ns, uint64_t interval_ns, const uint64_t blocked_ns[],
|
|
const volatile int64_t counts[]);
|
|
|
|
// gfx_present.c: the present thread blits every presented frame into a host-visible ring of n thumbnails.
|
|
void vk_thumbs_enable(int n); // before the first present; n slots of FLIGHT_THUMB_W x FLIGHT_THUMB_H
|
|
void vk_thumbs_frame(uint64_t frame); // the present thread names the frame of the vk_present_image call that follows
|
|
// Copies frame's thumbnail as RGBA when the ring still holds it complete; 0 when it was never written, is still in
|
|
// flight or was overwritten. Takes the present lock for one slot copy (about 20 us); any thread.
|
|
int vk_thumbs_read(uint64_t frame, uint8_t *rgba);
|