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

Fix Android black screen when paused #974

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

wadetb
Copy link
Contributor

@wadetb wadetb commented Dec 10, 2019

When switching away from TIC-80, the OpenGL context is destroyed by the
system and needs to be recreated along with all resources (textures and
shaders).

SDL2 makes an attempt to save and restore the active GL context when
pausing and resuming the activity, but it fails on my device, and the
Android and SDL2 documentation indicate that it's a best-effort feature.

Because the keyboard and gamepad images are lost when the textures are
destroyed, backing buffers are allocated to store them when they are
first filled out.

Additionally, SDL_gpu needs to be fully destroyed and recreated to
resolve the problem on my Pixel 3a XL. Just recreating the textures and
shader and calling GPU_ResetRenderState is not enough.

(Ideally, this entire problem is something that would be handled by
the SDL_gpu library, but it has no provisions for it)

When switching away from TIC-80, the OpenGL context is destroyed by the
system and needs to be recreated along with all resources (textures and
shaders).

SDL2 makes an attempt to save and restore the active GL context when
pausing and resuming the activity, but it fails on my device, and the
Android and SDL2 documentation indicate that it's a best-effort feature.

Because the keyboard and gamepad images are lost when the textures are
destroyed, backing buffers are allocated to store them when they are
first filled out.

Additionally, SDL_gpu needs to be fully destroyed and recreated to
resolve the problem on my Pixel 3a XL. Just recreating the textures and
shader and calling GPU_ResetRenderState is not enough.

(Ideally, this entire problem is something that would be handled by
the SDL_gpu library, but it has no provisions for it)
Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on Android, it works
thank you :)

@nesbox nesbox merged commit a748507 into nesbox:master Dec 11, 2019
@nesbox nesbox added this to the 0.80.0 milestone Dec 11, 2019
@nesbox nesbox removed this from the 0.80.0 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants