Commit e8458df2 authored by Sam Lantinga's avatar Sam Lantinga

Optimization suggested by Ryan:

Don't set the same OpenGL context multiple times

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402607
parent b480be4c
...@@ -126,6 +126,7 @@ struct SDL_Window ...@@ -126,6 +126,7 @@ struct SDL_Window
int display; int display;
SDL_Renderer *renderer; SDL_Renderer *renderer;
SDL_GLContext context;
void *userdata; void *userdata;
void *driverdata; void *driverdata;
......
...@@ -2566,6 +2566,12 @@ SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context) ...@@ -2566,6 +2566,12 @@ SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
if (!context) { if (!context) {
window = NULL; window = NULL;
} }
if (window) {
if (window->context == context) {
return 0;
}
window->context = context;
}
return _this->GL_MakeCurrent(_this, window, context); return _this->GL_MakeCurrent(_this, window, context);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment