diff --git a/SDL/SDLGLGraphicsContext.cpp b/SDL/SDLGLGraphicsContext.cpp index 66d515b1c8..651e544d63 100644 --- a/SDL/SDLGLGraphicsContext.cpp +++ b/SDL/SDLGLGraphicsContext.cpp @@ -299,6 +299,13 @@ void EGL_Close() { #endif // USING_EGL +bool SDLGLGraphicsContext::InitFromRenderThread() { + bool retval = GraphicsContext::InitFromRenderThread(); + // HACK: Ensure that the swap interval is set after context creation (needed for kmsdrm) + SDL_GL_SetSwapInterval(1); + return retval; +} + // Returns 0 on success. int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int w, int h, int mode, std::string *error_message) { struct GLVersionPair { @@ -435,6 +442,7 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int w, int h, INFO_LOG(Log::G3D, "SDL SwapInterval: %d", interval); SDL_GL_SetSwapInterval(interval); }); + window_ = window; return 0; } diff --git a/SDL/SDLGLGraphicsContext.h b/SDL/SDLGLGraphicsContext.h index a54e8b5121..ca16380571 100644 --- a/SDL/SDLGLGraphicsContext.h +++ b/SDL/SDLGLGraphicsContext.h @@ -16,6 +16,8 @@ public: // Returns 0 on success. int Init(SDL_Window *&window, int x, int y, int w, int h, int mode, std::string *error_message); + bool InitFromRenderThread() override; + void Shutdown() override {} void ShutdownFromRenderThread() override; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 559a3ff61b..e934fb8bfd 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -1402,9 +1402,6 @@ int main(int argc, char *argv[]) { SDL_ShowCursor(SDL_DISABLE); #endif - // Ensure that the swap interval is set after context creation (needed for kmsdrm) - SDL_GL_SetSwapInterval(1); - // Avoid the IME popup when holding keys. This doesn't affect all versions of SDL. // TODO: Enable it in text input fields SDL_StopTextInput();