Skip to content

SDL3: SDL_RenderPresent slows down over time to a peak point and remains #12333

Open
@TBbadmofo

Description

I've seen in my project that in the beginning render times are low, about 125 us then, over the course of about 10 seconds from starting, it linearly climbs up to 1 ms and stays there. I have removed all code except for SDL_RenderPresent() and this is the only line of code that is causing this behavior.

I've added a code example, and some data I've recorded(time is in nanoseconds).

In these example, 1 second of data will need to be skipped over, there are high processing times in the beginning and they skew the averages.

Looking at total processing times between 60 fps and 1000 fps, the processing time in 1 second is almost 3x faster at the beginning for 60fps and then 25% slower for 60 fps at the end. Polling times are constant between the 2, so 1000 fps gets skewed by that. I would think SDL_RenderPresent would take the same amount of time between the 2 as well, but it's 6 to 24 times slower with 60 fps. 24 times slower when this linear peak is reached.

The data for the 60fps, looking at frame 62nd frame, the average per frame processing time is low at 153us, and then begins it's linear incline over the next few seconds to 850us.

The data for 1000 fps, looking at frame 1430, the average per frame is 24.7us, and then begins it's linear incline over the next few seconds to 35us.

The data for No_SDL_RenderPresent 60fps and 1000 fps remain consistent and all processing time is from polling.

Modify targetFrames for different frame rates, and then you can comment out SDL_RenderPresent.

code.txt

60fps.txt
1000fps.txt
No_SDL_RenderPresent_60fps.txt
No_SDL_RenderPresent_1000fps.txt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions