Frontend: Don't call DoneCurrent if the context isnt already current
This commit is contained in:
		
							parent
							
								
									cf9c94d401
								
							
						
					
					
						commit
						f1da3ec584
					
				| @ -141,7 +141,7 @@ public: | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ~OpenGLSharedContext() { |     ~OpenGLSharedContext() { | ||||||
|         context->doneCurrent(); |         DoneCurrent(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void SwapBuffers() override { |     void SwapBuffers() override { | ||||||
| @ -156,6 +156,9 @@ public: | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void DoneCurrent() override { |     void DoneCurrent() override { | ||||||
|  |         if (!is_current) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|         context->doneCurrent(); |         context->doneCurrent(); | ||||||
|         is_current = false; |         is_current = false; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -37,16 +37,24 @@ public: | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void MakeCurrent() override { |     void MakeCurrent() override { | ||||||
|         SDL_GL_MakeCurrent(window, context); |         if (is_current) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |         is_current = SDL_GL_MakeCurrent(window, context) == 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void DoneCurrent() override { |     void DoneCurrent() override { | ||||||
|  |         if (!is_current) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|         SDL_GL_MakeCurrent(window, nullptr); |         SDL_GL_MakeCurrent(window, nullptr); | ||||||
|  |         is_current = false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     SDL_Window* window; |     SDL_Window* window; | ||||||
|     SDL_GLContext context; |     SDL_GLContext context; | ||||||
|  |     bool is_current = false; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() { | bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 James Rowe
						James Rowe