#1529·sokol

sapp_frame_time() filtering goes crazy when the framerate is low

Author: Seb-degraffCreated Jun 2, 2026Updated Jun 26, 2026
Labelsbugsokol-app

I just upgraded sokol_app.h for my projects, and noticed that scrolling had a slightly jerky feeling. To investigate, I plotted the value of sapp_frame_duration(), and the new sapp_frame_duration_unfiltered(). It turns out that sapp_frame_duration() is quite smooth normally, but when the framerate drops (here because a somewhat poorly optimized editor is opened), it starts producing oscillating values.

In this video, the cyan blue line is the filtered frame duration and the green one is the unfiltered frame duration.

https://github.com/user-attachments/assets/8c58279c-8b90-4ed3-9c6f-2783d18226ee

I'm seeing this on macos 14 (sonoma). I'll check how the filter behaves on other platforms soon. I'll also double check that I'm not doing anything weird on my side. The fact that the unfiltered values are smooth make me think this is likely a bug in sokol_app though.