We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4260 - Render API shouldn't check if window is hidden
Summary: Render API shouldn't check if window is hidden
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86 Other
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-17 05:26 UTC by Ryan C. Gordon
Modified: 2018-09-17 05:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan C. Gordon 2018-09-17 05:26:19 UTC
I assume this change was made for iOS, seven years ago...

https://hg.libsdl.org/SDL/rev/59d398ac031e

...in recent revisions, these check if the window is "hidden" instead of minimized, but I'm wondering if these should be removed.

Apps on iOS should catch the event telling them the process went to the background and should stop drawing on their own in that case, like they would have to do if they used OpenGL directly instead of SDL's renderer, and having these checks here means that a minimized window on any platform that's rendering to a render target will end up with a blank texture that might be meant to persist for long past a single frame.

As I'm reworking the render API to batch up draw commands, there are further questions about when and if we should abort drawing like this.

The downside of removing this check is that an iOS app in the background that tries to call SDL_Render*() will crash, but I'd argue that was a bug in their app. They shouldn't be doing serious work in the background, including running their rendering loop, whether we prevent the actual rendering calls or not.

Can I remove these "/* Don't draw while we're minimized */" checks? We can definitely keep the glFinish() call on backgrounding, if that's helpful to iOS, though.

--ryan.
Comment 1 Sam Lantinga 2018-09-17 05:57:18 UTC
The problem is that iOS enforces the "no rendering" policy immediately, but the app may not receive the notification that they should stop rendering until later. I'm fine with making that an iOS and Android only check though, if that's helpful.