Skip to content

Noticeable screen tearing in SDL 3.4.0 compared to SDL 3.2.22 (without vsync) #14775

@yughias

Description

@yughias

Description

After upgrading from SDL 3.2.2 to SDL 3.4.0, I’m observing significantly more visible screen tearing while using the same project and rendering code.

The tearing is especially noticeable in my main loop, which appeared stable when using SDL 3.2.2.

Additional context

  • VSync is disabled.
  • The main loop runs at a floating-point (non-integer) refresh rate.
  • Rendering is done via SDL_Renderer and a streaming texture.

I understand that tearing can occur without vsync by design. However, the behavior is noticeably more pronounced in SDL 3.4.0 compared to earlier versions.

This raises the question of whether relevant changes were introduced between these versions, for example:

  • A change in rendering behavior, or presentation defaults between SDL 3.2.2 and SDL 3.4.0, or
  • The previous version implicitly masking or reducing tearing under similar conditions.

Main loop

while (running) {
    Uint64 targetFrameTime = (Uint64)(1e9 / frameRate);
    a_clock = SDL_GetTicksNS();
    Uint64 deltaNS = a_clock - b_clock;

    if (deltaNS >= targetFrameTime) {
        deltaTime = deltaNS / 1e6f;

        mainloop();
        renderBufferToWindow();

        b_clock = a_clock;
    } else {
        Uint64 remaining = targetFrameTime - deltaNS;
        if (remaining > 1e6)
            SDL_DelayPrecise(remaining - 1e6);
    }
}

void renderBufferToWindow() {
    SDL_Surface* locked_surface;
    SDL_LockTextureToSurface(drawBuffer, NULL, &locked_surface);
    SDL_BlitSurface(front_surface, NULL, locked_surface, NULL);
    SDL_UnlockTexture(drawBuffer);

    SDL_RenderClear(renderer);
    SDL_RenderTexture(renderer, drawBuffer, NULL, NULL);
    SDL_RenderPresent(renderer);
}

Expected behavior

Either:

  • Tearing behavior comparable to SDL 3.2.2 under the same conditions, or
  • Confirmation that the increased tearing in SDL 3.4.0 is expected and intentional.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions