From: José Fonseca Date: Tue, 17 May 2011 19:39:02 +0000 (+0100) Subject: Fix context sharing when replaying CGL. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=e0d6c3ce54fae6be110053d0fa4d351584f72a97;p=apitrace Fix context sharing when replaying CGL. --- diff --git a/glretrace_cgl.cpp b/glretrace_cgl.cpp index 892dc0d..2d6d882 100644 --- a/glretrace_cgl.cpp +++ b/glretrace_cgl.cpp @@ -38,6 +38,7 @@ typedef std::map DrawableMap; typedef std::map 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;