From 1c1a7a049013474b4f69f96c080fc838ca6cdb5f Mon Sep 17 00:00:00 2001 From: George Wright Date: Fri, 24 Feb 2012 13:19:10 -0500 Subject: [PATCH] Create a drawable when playing back a trace if it doesn't exist during an eglMakeCurrent call. This is necessary for us because Firefox for Android gets its egl surface from Java, which isn't traced. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: José Fonseca --- glretrace_egl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/glretrace_egl.cpp b/glretrace_egl.cpp index e4178e3..7162ab1 100644 --- a/glretrace_egl.cpp +++ b/glretrace_egl.cpp @@ -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; } -- 2.45.2