Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_LockTexture() & SDL_RENDER_PRESENTVSYNC causes tearing #1848

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 1 comment
Closed

SDL_LockTexture() & SDL_RENDER_PRESENTVSYNC causes tearing #1848

SDLBugzilla opened this issue Feb 11, 2021 · 1 comment
Labels
abandoned Bug has been abandoned for various reasons

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.3
Reported for operating system, platform: Mac OS X (All), x86_64

Comments on the original bug report:

On 2015-05-01 20:09:16 +0000, wrote:

Created attachment 2145
Test probelm

In the documentation, it's recommended to use SDL_LockTexture() over SDL_UpdateTexture() (https://wiki.libsdl.org/SDL_UpdateTexture) for streaming textures (contradicting the advice given in the migration guide, https://wiki.libsdl.org/MigrationGuide#If_your_game_just_wants_to_get_fully-rendered_frames_to_the_screen).

The problem is that under the OpenGL render driver on Mac OS X, using SDL_LockTexture() causes tearing when SDL_RENDER_PRESENTVSYNC is set.

I've attached a sample program that demonstrates the behavior.

I'm guessing it's because SDL_LockTexture() retrieves a pointer to memory shared with the GPU. That's fine, but it should be the memory for the texture buffer not currently being displayed on the screen.

The workaround is to use SDL_UpdateTexture(). This workaround isn't ideal because it generates an extra buffer copy when the software renderer is used. It would be better to fix the OpenGL renderer so that each SDL texture references two different OpenGL textures if memory-sharing is being used.

@slouken slouken removed the bug label May 11, 2022
@slouken slouken added the abandoned Bug has been abandoned for various reasons label Nov 4, 2023
@slouken
Copy link
Collaborator

slouken commented Nov 4, 2023

SDL 2.0 is now in maintenance mode, and all inactive issues are being closed. If this issue is impacting you, please feel free to reopen it with additional information.

@slouken slouken closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned Bug has been abandoned for various reasons
Projects
None yet
Development

No branches or pull requests

2 participants