]> git.cworth.org Git - apitrace/commitdiff
Create a drawable when playing back a trace if it doesn't exist during an eglMakeCurrent
authorGeorge Wright <george@mozilla.com>
Fri, 24 Feb 2012 18:19:10 +0000 (13:19 -0500)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 14 Mar 2012 09:16:08 +0000 (09:16 +0000)
call. This is necessary for us because Firefox for Android gets its egl surface from Java,
which isn't traced.

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
glretrace_egl.cpp

index e4178e307e3dfa8bca267ab8aed36c55020a8c03..7162ab18eeda67b42cbeeb682ee9a2c1b9a07078 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;
 }