]> git.cworth.org Git - apitrace/blobdiff - glretrace_egl.cpp
Move tracers to wrappers subdirectory.
[apitrace] / glretrace_egl.cpp
index e4178e307e3dfa8bca267ab8aed36c55020a8c03..d7b14ecad6c5e7db5861b42083e1b6b5fd3be2d5 100644 (file)
@@ -54,6 +54,9 @@ static ProfileMap profile_map;
 static unsigned int current_api = EGL_OPENGL_ES_API;
 static glws::Profile last_profile = glws::PROFILE_COMPAT;
 
+static void
+createDrawable(unsigned long long orig_config, unsigned long long orig_surface);
+
 static glws::Drawable *
 getDrawable(unsigned long long surface_ptr) {
     if (surface_ptr == 0) {
@@ -62,6 +65,13 @@ getDrawable(unsigned long long surface_ptr) {
 
     DrawableMap::const_iterator it;
     it = drawable_map.find(surface_ptr);
+    if (it == drawable_map.end()) {
+        // In Fennec we get the egl window surface from Java which isn't
+        // traced, so just create a drawable if it doesn't exist in here
+        createDrawable(0, surface_ptr);
+        it = drawable_map.find(surface_ptr);
+        assert(it != drawable_map.end());
+    }
 
     return (it != drawable_map.end()) ? it->second : NULL;
 }
@@ -228,7 +238,7 @@ static void retrace_eglMakeCurrent(trace::Call &call) {
 static void retrace_eglSwapBuffers(trace::Call &call) {
     frame_complete(call);
 
-    if (double_buffer) {
+    if (double_buffer && drawable) {
         drawable->swapBuffers();
     } else {
         glFlush();