Fix data race during palette animation with threaded blitters
This commit is contained in:
@@ -1238,6 +1238,11 @@ void DoPaletteAnimations()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameLoopPaletteAnimations()
|
||||||
|
{
|
||||||
|
if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine a contrasty text colour for a coloured background.
|
* Determine a contrasty text colour for a coloured background.
|
||||||
* @param background Background colour.
|
* @param background Background colour.
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
#include "string_type.h"
|
#include "string_type.h"
|
||||||
|
|
||||||
void GameLoop();
|
void GameLoop();
|
||||||
|
void GameLoopPaletteAnimations();
|
||||||
|
|
||||||
void CreateConsole();
|
void CreateConsole();
|
||||||
|
|
||||||
|
@@ -88,7 +88,6 @@
|
|||||||
|
|
||||||
void CallLandscapeTick();
|
void CallLandscapeTick();
|
||||||
void IncreaseDate();
|
void IncreaseDate();
|
||||||
void DoPaletteAnimations();
|
|
||||||
void MusicLoop();
|
void MusicLoop();
|
||||||
void ResetMusic();
|
void ResetMusic();
|
||||||
void CallWindowGameTickEvent();
|
void CallWindowGameTickEvent();
|
||||||
@@ -1911,8 +1910,6 @@ void GameLoop()
|
|||||||
StateGameLoop();
|
StateGameLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
|
|
||||||
|
|
||||||
InputLoop();
|
InputLoop();
|
||||||
|
|
||||||
SoundDriver::GetInstance()->MainLoop();
|
SoundDriver::GetInstance()->MainLoop();
|
||||||
|
@@ -513,6 +513,7 @@ void VideoDriver_Allegro::MainLoop()
|
|||||||
if (old_shift_pressed != _shift_pressed) HandleShiftChanged();
|
if (old_shift_pressed != _shift_pressed) HandleShiftChanged();
|
||||||
|
|
||||||
GameLoop();
|
GameLoop();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
|
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
CheckPaletteAnim();
|
CheckPaletteAnim();
|
||||||
|
@@ -654,7 +654,10 @@ void QZ_GameLoop()
|
|||||||
_cocoa_subdriver->Draw(true);
|
_cocoa_subdriver->Draw(true);
|
||||||
CSleep(1);
|
CSleep(1);
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) GameLoop();
|
for (int i = 0; i < 2; i++) {
|
||||||
|
GameLoop();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
QZ_CheckPaletteAnim();
|
QZ_CheckPaletteAnim();
|
||||||
@@ -702,6 +705,7 @@ void QZ_GameLoop()
|
|||||||
if (old_shift_pressed != _shift_pressed) HandleShiftChanged();
|
if (old_shift_pressed != _shift_pressed) HandleShiftChanged();
|
||||||
|
|
||||||
GameLoop();
|
GameLoop();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
|
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
QZ_CheckPaletteAnim();
|
QZ_CheckPaletteAnim();
|
||||||
|
@@ -299,6 +299,7 @@ void VideoDriver_Dedicated::MainLoop()
|
|||||||
next_tick = cur_ticks + MILLISECONDS_PER_TICK;
|
next_tick = cur_ticks + MILLISECONDS_PER_TICK;
|
||||||
|
|
||||||
GameLoop();
|
GameLoop();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,11 +48,13 @@ void VideoDriver_Null::MainLoop()
|
|||||||
if (this->until_exit) {
|
if (this->until_exit) {
|
||||||
while (!_exit_game) {
|
while (!_exit_game) {
|
||||||
GameLoop();
|
GameLoop();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < this->ticks; i++) {
|
for (int i = 0; i < this->ticks; i++) {
|
||||||
GameLoop();
|
GameLoop();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1087,6 +1087,8 @@ void VideoDriver_SDL::MainLoop()
|
|||||||
|
|
||||||
if (_draw_mutex != nullptr) draw_lock.lock();
|
if (_draw_mutex != nullptr) draw_lock.lock();
|
||||||
|
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
|
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
_local_palette = _cur_palette;
|
_local_palette = _cur_palette;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -755,6 +755,8 @@ void VideoDriver_SDL::MainLoop()
|
|||||||
|
|
||||||
if (_draw_mutex != nullptr) draw_lock.lock();
|
if (_draw_mutex != nullptr) draw_lock.lock();
|
||||||
|
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
|
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
_local_palette = _cur_palette;
|
_local_palette = _cur_palette;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1268,6 +1268,7 @@ void VideoDriver_Win32::MainLoop()
|
|||||||
if (_draw_threaded) draw_lock.unlock();
|
if (_draw_threaded) draw_lock.unlock();
|
||||||
GameLoop();
|
GameLoop();
|
||||||
if (_draw_threaded) draw_lock.lock();
|
if (_draw_threaded) draw_lock.lock();
|
||||||
|
GameLoopPaletteAnimations();
|
||||||
|
|
||||||
if (_force_full_redraw) MarkWholeScreenDirty();
|
if (_force_full_redraw) MarkWholeScreenDirty();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user