diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-24 15:04:41 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-03-08 19:18:55 +0100 |
commit | 4610aa7ae3db6cf561e156ba011de3c7b516876d (patch) | |
tree | c2e998494f5ed9f1a037b3a493f8919d8287ae57 /src/video/sdl2_default_v.cpp | |
parent | 56911a86ea2fad84383729ece63c837dc012f14d (diff) | |
download | openttd-4610aa7ae3db6cf561e156ba011de3c7b516876d.tar.xz |
Remove: [Video] no longer draw in a thread
Drawing in a thread is a bit odd, and often leads to surprising
issues. For example, OpenGL would only allow it if you move the
full context to the thread. Which is not always easily done on
all OSes.
In general, the advise is to handle system events and drawing
from the main thread, and do everything else in other threads.
So, let's be more like other games.
Additionally, putting the drawing routine in a thread was only
done for a few targets.
Upcoming commit will move the GameLoop in a thread, which will
work for all targets.
Diffstat (limited to 'src/video/sdl2_default_v.cpp')
-rw-r--r-- | src/video/sdl2_default_v.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/video/sdl2_default_v.cpp b/src/video/sdl2_default_v.cpp index b8e769ede..e61405ff8 100644 --- a/src/video/sdl2_default_v.cpp +++ b/src/video/sdl2_default_v.cpp @@ -136,22 +136,6 @@ void VideoDriver_SDL_Default::Paint() this->dirty_rect = {}; } -void VideoDriver_SDL_Default::PaintThread() -{ - /* First tell the main thread we're started */ - std::unique_lock<std::recursive_mutex> lock(*this->draw_mutex); - this->draw_signal->notify_one(); - - /* Now wait for the first thing to draw! */ - this->draw_signal->wait(*this->draw_mutex); - - while (this->draw_continue) { - /* Then just draw and wait till we stop */ - this->Paint(); - this->draw_signal->wait(lock); - } -} - bool VideoDriver_SDL_Default::AllocateBackingStore(int w, int h, bool force) { int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); |