OPENGL: Remove multithread support from displayActivityIconOnOSD

It is no longer being called by another thread.
This commit is contained in:
Bastien Bouclet 2016-09-18 13:20:25 +02:00
parent 1a1a5b5f69
commit 75599a4c25
2 changed files with 7 additions and 50 deletions

View file

@ -58,7 +58,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
_forceRedraw(false), _scissorOverride(3) _forceRedraw(false), _scissorOverride(3)
#ifdef USE_OSD #ifdef USE_OSD
, _osdMessageChangeRequest(false), _osdMessageAlpha(0), _osdMessageFadeStartTime(0), _osdMessageSurface(nullptr), , _osdMessageChangeRequest(false), _osdMessageAlpha(0), _osdMessageFadeStartTime(0), _osdMessageSurface(nullptr),
_osdIconChangeRequest(false), _osdIconSurface(nullptr) _osdIconSurface(nullptr)
#endif #endif
{ {
memset(_gamePalette, 0, sizeof(_gamePalette)); memset(_gamePalette, 0, sizeof(_gamePalette));
@ -72,7 +72,6 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() {
#ifdef USE_OSD #ifdef USE_OSD
delete _osdMessageSurface; delete _osdMessageSurface;
delete _osdIconSurface; delete _osdIconSurface;
_osdIconNextData.free();
#endif #endif
#if !USE_FORCED_GLES #if !USE_FORCED_GLES
ShaderManager::destroy(); ShaderManager::destroy();
@ -368,14 +367,13 @@ void OpenGLGraphicsManager::updateScreen() {
#ifdef USE_OSD #ifdef USE_OSD
{ {
Common::StackLock lock(_osdMutex); Common::StackLock lock(_osdMutex);
if (_osdMessageChangeRequest) { if (_osdMessageChangeRequest) {
osdMessageUpdateSurface(); osdMessageUpdateSurface();
} }
}
if (_osdIconChangeRequest) { if (_osdIconSurface) {
osdIconUpdateSurface(); _osdIconSurface->updateGLTexture();
}
} }
#endif #endif
@ -810,30 +808,11 @@ void OpenGLGraphicsManager::osdMessageUpdateSurface() {
void OpenGLGraphicsManager::displayActivityIconOnOSD(const Graphics::Surface *icon) { void OpenGLGraphicsManager::displayActivityIconOnOSD(const Graphics::Surface *icon) {
#ifdef USE_OSD #ifdef USE_OSD
// HACK: Actually no client code should use graphics functions from
// another thread. But the MT-32 emulator and network synchronization still do,
// thus we need to make sure this doesn't happen while a updateScreen call is done.
// HACK: We can't make OpenGL calls outside of the main thread. This method
// stores a copy of the icon. The main thread will pick up the changed icon,
// and copy it to an OpenGL texture.
Common::StackLock lock(_osdMutex);
_osdIconChangeRequest = true;
_osdIconNextData.free();
if (icon)
_osdIconNextData.copyFrom(*icon);
#endif
}
#ifdef USE_OSD
void OpenGLGraphicsManager::osdIconUpdateSurface() {
delete _osdIconSurface; delete _osdIconSurface;
_osdIconSurface = nullptr; _osdIconSurface = nullptr;
if (_osdIconNextData.getPixels()) { if (icon) {
Graphics::Surface *converted = _osdIconNextData.convertTo(_defaultFormatAlpha); Graphics::Surface *converted = icon->convertTo(_defaultFormatAlpha);
_osdIconNextData.free();
_osdIconSurface = createSurface(_defaultFormatAlpha); _osdIconSurface = createSurface(_defaultFormatAlpha);
assert(_osdIconSurface); assert(_osdIconSurface);
@ -851,13 +830,9 @@ void OpenGLGraphicsManager::osdIconUpdateSurface() {
converted->free(); converted->free();
delete converted; delete converted;
_osdIconSurface->updateGLTexture();
} }
_osdIconChangeRequest = false;
}
#endif #endif
}
void OpenGLGraphicsManager::setPalette(const byte *colors, uint start, uint num) { void OpenGLGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
assert(_gameScreen->hasPalette()); assert(_gameScreen->hasPalette());

View file

@ -586,24 +586,6 @@ private:
kOSDMessageInitialAlpha = 80 kOSDMessageInitialAlpha = 80
}; };
/**
* Request for the OSD icon surface to be updated.
*/
bool _osdIconChangeRequest;
/**
* The next OSD background activity icon.
*
* The OSD icon will be updated with this data on the next frame.
* Can be an unallocated surface if the OSD icon should not be displayed.
*/
Graphics::Surface _osdIconNextData;
/**
* Set the OSD icon surface with the value of the next OSD icon.
*/
void osdIconUpdateSurface();
/** /**
* The OSD background activity icon's contents. * The OSD background activity icon's contents.
*/ */