changeset 2245:989fb86ad1ec

Optimization suggested by Ryan: Don't set the same OpenGL context multiple times
author Sam Lantinga <slouken@libsdl.org>
date Wed, 15 Aug 2007 03:52:31 +0000
parents 5234868559fa
children 75daa0792bd1
files src/video/SDL_sysvideo.h src/video/SDL_video.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }