View Issue Details

IDProjectCategoryView StatusLast Update
0015485RunnerSurfacesPublic2018-02-05 16:43
ReporterG KondasAssigned ToMike Dailly 
PriorityVery HighSeverityC - GeneralReproducibility100%
Status ClosedResolutionNo Change Required 
PlatformAndroidOS OS Version
Product Version 
Target VersionFixed in Version 
Summary0015485: Surfaces: Surfaces on Android - surface_exists() doesn't return true when surface is "lost", except if I explicitly call surface
DescriptionWhile on Windows drawing surfaces like this works like intended:
if(!surface_exists(mySurf)){
   // Code to recreate and draw on surface
}
draw_surface(mySurf);

On android however, if the surface gets lost (os pause, or device goes to sleep), when it returns surface_exists will return true, but the actual surface is all black, but not lost.

I have found a reported issue that might be similar to this:
http://bugs.yoyogames.com/view.php?id=3168
This was marked as resolved though.

I have tested this on a HTC Glacier (MyTouch 4G), Samsung Galaxy Note 2 and Google Nexus 7 (2012), all have had the same issue.
This happened both with yoyoRunner and built apk.

I have tested the same on Windows, and it never had that issue.

This can be tested and reproduced by drawing a surface preceded by an if(!surface_exists()) check, put the redraw code or just a debug message.
- During runtime press the power button to have the device go to sleep, or press home, then go back to the application.
- Surface won't display previous content but, surface_exists() will still return true for it.

Relevant logcat output on returning from sleep:
I/yoyo (5661): onSurfaceCreated() aborted on re-create
I/yoyo (5661): onSurfaceChanged :: width=720 height=1280

Please note that I have tested using surface_free(mySurf), and in that case after that surface_exists(mySurf) will return false (as intended), so it is probably not something wrong with surface_exists, it is probably the surface not actually being freed/destroyed, just "changed", or corrupted.

My only workaround for knowing when to redraw/recreate the surface, is by calling a forced free and redraw after an os_pause event is registered, but this is really unclean and there might be other causes to why the surface would get lost, which I have no way of detecting.

I think this is a quite high priority issue.
Please let me know if you need more information, or if you would need a sample project. SAMPLE URL:
Additional InformationOriginal helpdesk ticket: http://help.yoyogames.com/tickets/66212
TagsNo tags attached.
1.4 Found In1.3.1347
2.x Runtime Found In
2.x Runtime Verified In

Activities

G Kondas

2014-07-25 17:21

Reporter   ~0031335

I just noticed, that my title is incorrect:
"surface_exists() doesn't return true" should be either
- "!surface_exists() doesn't return true" or
- "surface_exists() doesn't return false"

(The description is correct though)

Justin Powell

2015-01-22 23:41

Reporter   ~0035344

I'm experiencing this problem as well. When I turn my device's screen off and then on again, my surface goes all black.

Taler Dale

2015-12-01 18:07

Reporter   ~0041056

Yeah... you can't get around this if you are using surfaces, it's 100% reproducible for all surfaces... so ridiculous this is such a long standing bug for such basic and fundamental part of gamemaker

T-bond

2016-08-14 10:16

Reporter   ~0046611

Last edited: 2016-10-04 15:27

View 4 revisions

Can somebody set this to ULTRA IMPORTANT? It was reported long time ago and we have this. And make a release on the EA channel with the fix. 1.99.493+

The workaround doesn't work with pulling down the status bar.

Stubbjax

2016-10-05 05:27

Reporter   ~0049417

Last edited: 2016-10-05 05:32

View 3 revisions

This issue has been really bugging me for a while as well. I think the problem was introduced around version 1.4.1749 - apk files of my (surface-utilising) game that were built in prior versions of GM do not have the issue when I install and run them. The issue is also present in the latest EA version - 1.99.505.

(I'm surprised this issue was raised in 2014 seeing as I only started experiencing it in 2016... unless I upgraded from a 2014 version)

Mike Dailly

2017-11-16 15:57

Developer   ~0056658

This has now been checked on a couple of Android devices, and it's working as expected - no changes or fixes are required. (This is for GMS2)
Any issues remaining therefore will be Android specific driver issues.

Pausing the app (with the task manager)
Putting the app into the background then back again
Incoming call
Switching the device into sleep mode (power button sleep - then back on)

All these result in a "surface lost". The code below works as expected



// Creation code
mysurf = -1;

// Draw code
if( !surface_exists(mysurf) ){
    mysurf = surface_create(64,64);
    surface_set_target(mysurf);
    draw_clear_alpha(0,0);

    // draw surface

    surface_reset_target();
}