Android NDK sample framework: screen turns black upon GLContext swap: EGL_BAD_SURFACE: err=12301

151 views
Skip to first unread message

Chuck Moyes

unread,
Aug 2, 2016, 11:43:05 PM8/2/16
to android-ndk
My Android NDK app is returning a bunch of EGL_BAD_SURFACE: err=12301 upon Swap as follows from the sample framework:

EGLint GLContext::Swap()
{
   
bool b = eglSwapBuffers( display_, surface_ );
   
if( !b )
   
{
       
EGLint err = eglGetError();
       
if( err == EGL_BAD_SURFACE )
       
{
            LOGE
("Swap: Re-creating egl context EGL_BAD_SURFACE: err=" + std::to_string(err));

           
//Recreate surface
           
InitEGLSurface();
           
return EGL_SUCCESS; //Still consider glContext is valid
       
}
       
else if( err == EGL_CONTEXT_LOST || err == EGL_BAD_CONTEXT )
       
{
            LOGE
("Swap: Re-creating egl context EGL_CONTEXT_LOST || EGL_BAD_CONTEXT: err=" + std::to_string(err));

           
//Context has been lost!!
            context_valid_
= false;
           
Terminate();
           
InitEGLContext();
       
}
       
return err;
   
}
   
return EGL_SUCCESS;
}

Whenever this happens, the screen flickers black color or turns black completely. It happens intermittently on Samsung Galaxy S6 edge.

Hak Matsuda

unread,
Aug 3, 2016, 2:18:02 AM8/3/16
to andro...@googlegroups.com
Somebody sent same issue on the device and it looks like an app is receiving APP_CMD_LOW_MEMORY callback in the situation.
Are you experiencing the same issue?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/d43c17b7-dcd7-4b6d-bd99-9f36786fbf9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages