]> git.cworth.org Git - apitrace/blobdiff - retrace/glretrace_ws.cpp
attrib_list support for glXChooseVisual, the last GLX function.
[apitrace] / retrace / glretrace_ws.cpp
index d4b0817bfdf0b1852a619a81e41926eadfb73023..ab3c41af388009583be26f5190abf0a7f44d8ec1 100644 (file)
@@ -122,7 +122,16 @@ createContext(Context *shareContext) {
 }
 
 
-static thread_specific Context *
+Context::~Context()
+{
+    //assert(this != getCurrentContext());
+    if (this != getCurrentContext()) {
+        delete wsContext;
+    }
+}
+
+
+static OS_THREAD_SPECIFIC_PTR(Context)
 currentContextPtr;
 
 
@@ -153,13 +162,10 @@ makeCurrent(trace::Call &call, glws::Drawable *drawable, Context *context)
         return false;
     }
 
-    if (currentContext) {
-        currentContext->drawable = NULL;
-    }
+    currentContextPtr = context;
 
     if (drawable && context) {
         context->drawable = drawable;
-        currentContextPtr = context;
         
         if (!context->used) {
             initContext();
@@ -208,6 +214,9 @@ updateDrawable(int width, int height) {
         return;
     }
 
+    width  = std::max(width,  currentDrawable->width);
+    height = std::max(height, currentDrawable->height);
+
     // Check for bound framebuffer last, as this may have a performance impact.
     GLint draw_framebuffer = 0;
     glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer);