From 3d012d707d0242780cd386868ab511846dc9b0af Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 13:19:58 +0300 Subject: Add damage presentation and reduce CPU surface latency Add yasl_cpu_present_damage to submit partial damage rectangles. Skip commit timers for CPU surfaces to prevent display delay. Remove frame callback gating in surface_draw_frame when free buffers exist. Flush the display immediately on CPU present. Forward tearing option to window specifications. --- include/yasl/yasl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/yasl/yasl.h b/include/yasl/yasl.h index 6d2b4f0..15bbe16 100644 --- a/include/yasl/yasl.h +++ b/include/yasl/yasl.h @@ -62,7 +62,7 @@ struct yasl_surface_options { const char *title; int width, height; /**< Required. */ enum yasl_surface_type type; - bool undecorated, fixed_size; + bool undecorated, fixed_size, tearing; void *userdata; /** Called when the window needs drawing while the system blocks the event * loop, as during a macOS live resize; draw and present before returning. @@ -281,8 +281,12 @@ YASL_API uint64_t yasl_time_ns(void); * 0xAARRGGBB pixels, rows tightly packed. They persist, and a resize keeps the * overlap and zeroes the rest. Valid until the next wait. Present to show them; * the system may also show them when it redraws the window. */ +struct yasl_damage { + int x, y, width, height; +}; YASL_API uint32_t *yasl_cpu_pixels(yasl_surface *surface, int *pixel_width, int *pixel_height); YASL_API int yasl_cpu_present(yasl_surface *surface); +YASL_API int yasl_cpu_present_damage(yasl_surface *surface, const struct yasl_damage *damage, int count); typedef void (*yasl_gl_proc)(void); /** These four may run on a rendering thread; synchronize them with destruction. -- cgit v1.2.3