]> git.cworth.org Git - apitrace/commitdiff
Don't count frames in MakeCurrent if the context/drawable don't change.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 17 May 2011 08:58:42 +0000 (09:58 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 17 May 2011 08:58:42 +0000 (09:58 +0100)
glretrace_glx.cpp

index 463de0a0ca8508182ed4dcfd5b2f528ad1f9fb1d..7edcfa0ffeeefc3d4caa1cd70cb4a638d892cf58 100644 (file)
@@ -72,6 +72,13 @@ static void retrace_glXDestroyContext(Trace::Call &call) {
 }
 
 static void retrace_glXMakeCurrent(Trace::Call &call) {
+    glws::Drawable *new_drawable = getDrawable(call.arg(1).toUInt());
+    glws::Context *new_context = context_map[call.arg(2).toPointer()];
+
+    if (new_drawable == drawable && new_context == context) {
+        return;
+    }
+
     if (drawable && context) {
         glFlush();
         if (!double_buffer) {
@@ -79,9 +86,6 @@ static void retrace_glXMakeCurrent(Trace::Call &call) {
         }
     }
 
-    glws::Drawable *new_drawable = getDrawable(call.arg(1).toUInt());
-    glws::Context *new_context = context_map[call.arg(2).toPointer()];
-
     bool result = ws->makeCurrent(new_drawable, new_context);
 
     if (new_drawable && new_context && result) {
@@ -187,6 +191,13 @@ static void retrace_glXCreateNewContext(Trace::Call &call) {
 }
 
 static void retrace_glXMakeContextCurrent(Trace::Call &call) {
+    glws::Drawable *new_drawable = getDrawable(call.arg(1).toUInt());
+    glws::Context *new_context = context_map[call.arg(3).toPointer()];
+
+    if (new_drawable == drawable && new_context == context) {
+        return;
+    }
+
     if (drawable && context) {
         glFlush();
         if (!double_buffer) {
@@ -194,9 +205,6 @@ static void retrace_glXMakeContextCurrent(Trace::Call &call) {
         }
     }
 
-    glws::Drawable *new_drawable = getDrawable(call.arg(1).toUInt());
-    glws::Context *new_context = context_map[call.arg(3).toPointer()];
-
     bool result = ws->makeCurrent(new_drawable, new_context);
 
     if (new_drawable && new_context && result) {