Mesa (master): glx: Optimize out no-op make current calls

Kristian Høgsberg krh at kemper.freedesktop.org
Thu Sep 9 10:19:53 PDT 2010


Module: Mesa
Branch: master
Commit: 94118fe2d4b1e5d0b9f39d9d2c44706db462e97e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=94118fe2d4b1e5d0b9f39d9d2c44706db462e97e

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Thu Sep  9 13:18:40 2010 -0400

glx: Optimize out no-op make current calls

This make a lot more sense now that we might have to recreate the
glx drawables for legacy code paths.

---

 src/glx/glxcurrent.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 0d359f7..3631738 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -242,6 +242,10 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
       return False;
    }
 
+   if (oldGC == gc &&
+       gc->currentDrawable == draw && gc->currentReadable == read)
+      return True;
+
    if (oldGC != &dummyContext) {
       oldGC->vtable->unbind(oldGC, gc);
       oldGC->currentDpy = 0;



More information about the mesa-commit mailing list