Browse Source

egl: Keep GSG bound surfaceless if buffer destructs

Necessary to keep the test suite functioning properly
rdb 2 months ago
parent
commit
0d18247630
1 changed files with 4 additions and 1 deletions
  1. 4 1
      panda/src/egldisplay/eglGraphicsBuffer.cxx

+ 4 - 1
panda/src/egldisplay/eglGraphicsBuffer.cxx

@@ -152,7 +152,10 @@ close_buffer() {
   if (_gsg != nullptr) {
     eglGraphicsStateGuardian *eglgsg;
     DCAST_INTO_V(eglgsg, _gsg);
-    if (!eglMakeCurrent(_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
+
+    // Try to keep the GSG bound surfaceless if possible, otherwise unbind.
+    if (!eglgsg->make_current() &&
+        !eglMakeCurrent(_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
       egldisplay_cat.error() << "Failed to call eglMakeCurrent: "
         << get_egl_error_string(eglGetError()) << "\n";
     }