Optimization suggested by Ryan:
authorSam Lantinga <slouken@libsdl.org>
Wed, 15 Aug 2007 03:52:31 +0000
changeset 2245 989fb86ad1ec
parent 2244 5234868559fa
child 2246 75daa0792bd1
Optimization suggested by Ryan: Don't set the same OpenGL context multiple times
src/video/SDL_sysvideo.h
src/video/SDL_video.c
--- a/src/video/SDL_sysvideo.h	Wed Aug 15 03:50:49 2007 +0000
+++ b/src/video/SDL_sysvideo.h	Wed Aug 15 03:52:31 2007 +0000
@@ -126,6 +126,7 @@
 
     int display;
     SDL_Renderer *renderer;
+    SDL_GLContext context;
 
     void *userdata;
     void *driverdata;
--- a/src/video/SDL_video.c	Wed Aug 15 03:50:49 2007 +0000
+++ b/src/video/SDL_video.c	Wed Aug 15 03:52:31 2007 +0000
@@ -2566,6 +2566,12 @@
     if (!context) {
         window = NULL;
     }
+    if (window) {
+        if (window->context == context) {
+            return 0;
+        }
+        window->context = context;
+    }
     return _this->GL_MakeCurrent(_this, window, context);
 }