]> git.cworth.org Git - apitrace/commitdiff
Fix context sharing when replaying CGL.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 17 May 2011 19:39:02 +0000 (20:39 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 17 May 2011 19:39:02 +0000 (20:39 +0100)
glretrace_cgl.cpp

index 892dc0d1c67e0ffd2d3fb96bfc048a55834195d5..2d6d88232ed088030633fbb455e26d596e12b758 100644 (file)
@@ -38,6 +38,7 @@ typedef std::map<unsigned long long, glws::Drawable *> DrawableMap;
 typedef std::map<unsigned long long, glws::Context *> ContextMap;
 static DrawableMap drawable_map;
 static ContextMap context_map;
+static glws::Context *sharedContext = NULL;
 
 
 static glws::Drawable *
@@ -65,7 +66,12 @@ getContext(unsigned long long ctx) {
     ContextMap::const_iterator it;
     it = context_map.find(ctx);
     if (it == context_map.end()) {
-        return (context_map[ctx] = ws->createContext(visual));
+        glws::Context *context;
+        context_map[ctx] = context = ws->createContext(visual, sharedContext);
+        if (!sharedContext) {
+            sharedContext = context;
+        }
+        return context;
     }
 
     return it->second;