Optimization suggested by Ryan:
authorSam Lantinga <slouken@libsdl.org>
Wed, 15 Aug 2007 03:52:31 +0000
changeset 2245989fb86ad1ec
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
     1.1 --- a/src/video/SDL_sysvideo.h	Wed Aug 15 03:50:49 2007 +0000
     1.2 +++ b/src/video/SDL_sysvideo.h	Wed Aug 15 03:52:31 2007 +0000
     1.3 @@ -126,6 +126,7 @@
     1.4  
     1.5      int display;
     1.6      SDL_Renderer *renderer;
     1.7 +    SDL_GLContext context;
     1.8  
     1.9      void *userdata;
    1.10      void *driverdata;
     2.1 --- a/src/video/SDL_video.c	Wed Aug 15 03:50:49 2007 +0000
     2.2 +++ b/src/video/SDL_video.c	Wed Aug 15 03:52:31 2007 +0000
     2.3 @@ -2566,6 +2566,12 @@
     2.4      if (!context) {
     2.5          window = NULL;
     2.6      }
     2.7 +    if (window) {
     2.8 +        if (window->context == context) {
     2.9 +            return 0;
    2.10 +        }
    2.11 +        window->context = context;
    2.12 +    }
    2.13      return _this->GL_MakeCurrent(_this, window, context);
    2.14  }
    2.15