feat: add vsync-priority frame pacing to video backends
Present now dispatches through a function pointer chosen at init and re-chosen by two new runtime setters: real vsync if requested and the driver grants it, else a manual sleep-based cap (auto-detects display refresh rate, falls back to 60fps if that can't be queried), else fully uncapped. skele_video_using_vsync() reports what was actually granted; skele_video_set_vsync()/skele_video_set_max_fps() let a game change either live without tearing down the renderer/GL context.
This commit is contained in:
@@ -12,10 +12,14 @@ extern "C" {
|
||||
#define SKELE_VIDEO_RESIZABLE 0x04
|
||||
#define SKELE_VIDEO_HIGHDPI 0x08
|
||||
#define SKELE_VIDEO_FULLSCREEN_EXCLUSIVE 0x10
|
||||
#define SKELE_VIDEO_VSYNC 0x20
|
||||
|
||||
#define SKELE_DEFAULT_RENDER_WIDTH 320
|
||||
#define SKELE_DEFAULT_RENDER_HEIGHT 200
|
||||
|
||||
#define SKELE_VIDEO_FPS_UNCAPPED UINT16_MAX
|
||||
#define SKELE_VIDEO_FPS_FALLBACK 60
|
||||
|
||||
typedef enum {
|
||||
SKELE_FULLSCREEN_BORDERLESS,
|
||||
SKELE_FULLSCREEN_EXCLUSIVE
|
||||
@@ -26,12 +30,16 @@ typedef struct {
|
||||
uint16_t render_height;
|
||||
uint16_t window_width;
|
||||
uint16_t window_height;
|
||||
uint16_t max_fps;
|
||||
uint8_t flags;
|
||||
} skele_video_config_t;
|
||||
|
||||
uint8_t skele_video_init(skele_video_config_t cfg);
|
||||
void skele_video_shutdown(void);
|
||||
void skele_video_present(void);
|
||||
uint8_t skele_video_using_vsync(void);
|
||||
void skele_video_set_vsync(uint8_t enabled);
|
||||
void skele_video_set_max_fps(uint16_t max_fps);
|
||||
void skele_video_set_title(const char *title);
|
||||
void skele_video_toggle_fullscreen(void);
|
||||
void skele_video_set_fullscreen_kind(skele_fullscreen_kind_t kind);
|
||||
|
||||
Reference in New Issue
Block a user