diff --git a/src/video/cocoa/cocoa_ogl.h b/src/video/cocoa/cocoa_ogl.h index 5d616c1472..106567d038 100644 --- a/src/video/cocoa/cocoa_ogl.h +++ b/src/video/cocoa/cocoa_ogl.h @@ -17,13 +17,12 @@ class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa { CGLContextObj gl_context; - uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end. std::string driver_info; ///< Information string about selected driver. const char *AllocateContext(bool allow_software); public: - VideoDriver_CocoaOpenGL() : gl_context(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {} + VideoDriver_CocoaOpenGL() : gl_context(nullptr), driver_info(this->GetName()) {} const char *Start(const StringList ¶m) override; void Stop() override; @@ -37,7 +36,6 @@ public: void PopulateSystemSprites() override; bool HasAnimBuffer() override { return true; } - uint8 *GetAnimBuffer() override { return this->anim_buffer; } /** Return driver name */ const char *GetName() const override { return "cocoa-opengl"; } diff --git a/src/video/sdl2_opengl_v.h b/src/video/sdl2_opengl_v.h index c7e647ca88..36ec23d93e 100644 --- a/src/video/sdl2_opengl_v.h +++ b/src/video/sdl2_opengl_v.h @@ -12,7 +12,7 @@ /** The OpenGL video driver for windows. */ class VideoDriver_SDL_OpenGL : public VideoDriver_SDL_Base { public: - VideoDriver_SDL_OpenGL() : gl_context(nullptr), anim_buffer(nullptr) {} + VideoDriver_SDL_OpenGL() : gl_context(nullptr) {} const char *Start(const StringList ¶m) override; @@ -27,7 +27,6 @@ public: void PopulateSystemSprites() override; bool HasAnimBuffer() override { return true; } - uint8 *GetAnimBuffer() override { return this->anim_buffer; } void ToggleVsync(bool vsync) override; @@ -42,7 +41,6 @@ protected: private: void *gl_context; ///< OpenGL context. - uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end. const char *AllocateContext(); void DestroyContext(); diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index a726a17d7f..81f5aaaa31 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -147,9 +147,9 @@ public: * Get a pointer to the animation buffer of the video back-end. * @return Pointer to the buffer or nullptr if no animation buffer is supported. */ - virtual uint8 *GetAnimBuffer() + inline uint8 *GetAnimBuffer() { - return nullptr; + return this->anim_buffer; } /** @@ -362,6 +362,8 @@ protected: std::recursive_mutex game_state_mutex; std::mutex game_thread_wait_mutex; + uint8 *anim_buffer = nullptr; ///< Animation buffer, (not used by all drivers, here because it is accessed very frequently) + static void GameThreadThunk(VideoDriver *drv); private: diff --git a/src/video/win32_v.h b/src/video/win32_v.h index 968eb6b195..4e87e5ec1d 100644 --- a/src/video/win32_v.h +++ b/src/video/win32_v.h @@ -122,7 +122,7 @@ public: /** The OpenGL video driver for windows. */ class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base { public: - VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {} + VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), driver_info(this->GetName()) {} const char *Start(const StringList ¶m) override; @@ -141,7 +141,6 @@ public: void ClearSystemSprites() override; bool HasAnimBuffer() override { return true; } - uint8 *GetAnimBuffer() override { return this->anim_buffer; } void ToggleVsync(bool vsync) override; @@ -152,7 +151,6 @@ public: protected: HDC dc; ///< Window device context. HGLRC gl_rc; ///< OpenGL context. - uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end. std::string driver_info; ///< Information string about selected driver. uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.