Skip to content

Main callback rate drops to 64 calls per second when interacting with window borders #15237

@kxsty

Description

@kxsty

Description:
I'm developing an image viewer and have noticed a drop in the callback rate when moving or resizing window. Both SDL_AppIterate and SDL_AppEvent are affected, with the rate falling to exactly 64 calls per second during these interactions. This makes resizing feel laggy. Other apps like qView are smooth on my 144 Hz monitor.

Is this behaviour expected? If so, is there a recommended way to maintain a high fps while resizing?

Attempted solutions:

  • Changed the backend to vulkan, d3d11, d3d12, opengl
  • Set SDL_HINT_MAIN_CALLBACK_RATE to various values (even 60 callback rate changes to 64 when resizing)
  • Use SDL_SetRenderVSync and SDL_SetWindowSurfaceVSync with all possible values

Environment:
RX 6600
Windows 11
SDL 3.4.2

video_2026-03-20_04-14-02.mp4

Code to reproduce:

#define SDL_MAIN_USE_CALLBACKS 1
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>

SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
    SDL_Window *window = SDL_CreateWindow("Title", 500, 500, SDL_WINDOW_RESIZABLE);

    return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppIterate(void *appstate) {
    static Uint64 start = 0;
    static long calls = 0;

    calls++;
    Uint64 now = SDL_GetTicks();
    if (now - start >= 1000) {
        SDL_Log("CPS=%ld", calls);
        calls = 0;
        start = now;
    }

    return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
    return SDL_APP_CONTINUE;
}

void SDL_AppQuit(void *appstate, SDL_AppResult result) {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions