From 41091f8ebfb0d38e05d52bfe8e6f187cc7f7a1c2 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 23 Mar 2014 15:33:32 +0100 Subject: [PATCH] gsdx ogl: remove multithread hack This hack was used because GSReadFifo was called from the EE thread. Previous commit move the call to the GSThread. Hopefully avoid flushing the full GPU contex would improve openGL performance (at least avoid some hiccups ;) ) Note: newer GSdx ogl won't be compatible with older PCSX2 --- plugins/GSdx/GS.cpp | 30 ------------------------------ plugins/GSdx/GSDeviceOGL.cpp | 5 ----- plugins/GSdx/GSState.cpp | 13 ------------- plugins/GSdx/config.h | 1 - 4 files changed, 49 deletions(-) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index dbab1a1163..53f60e82d3 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -58,11 +58,7 @@ extern bool RunLinuxDialog(); #define PS2E_X86 0x01 // 32 bit #define PS2E_X86_64 0x02 // 64 bit -#ifdef ENABLE_OGL_MT_HACK -GSRenderer* s_gs = NULL; -#else static GSRenderer* s_gs = NULL; -#endif static void (*s_irq)() = NULL; static uint8* s_basemem = NULL; static int s_renderer = -1; @@ -550,20 +546,7 @@ EXPORT_C GSreadFIFO(uint8* mem) { try { -#ifdef ENABLE_OGL_MT_HACK - // FIXME: double check which thread call this function - // See fifo2 issue below -#ifdef ENABLE_OGL_DEBUG - if (theApp.GetConfig("renderer", 0) / 3 == 4) fprintf(stderr, "Disable FIFO1 on opengl\n"); -#endif - s_gs->m_dev->AttachContext(); -#endif - s_gs->ReadFIFO(mem, 1); - -#ifdef ENABLE_OGL_MT_HACK - s_gs->m_dev->DetachContext(); -#endif } catch (GSDXRecoverableError) { @@ -574,17 +557,7 @@ EXPORT_C GSreadFIFO2(uint8* mem, uint32 size) { try { -#ifdef ENABLE_OGL_MT_HACK - // FIXME called from EE core thread not MTGS which cause - // invalidate data for opengl - s_gs->m_dev->AttachContext(); -#endif - s_gs->ReadFIFO(mem, size); - -#ifdef ENABLE_OGL_MT_HACK - s_gs->m_dev->DetachContext(); -#endif } catch (GSDXRecoverableError) { @@ -656,9 +629,6 @@ EXPORT_C GSvsync(int field) #endif -#ifdef ENABLE_OGL_MT_HACK - s_gs->m_dev->AttachContext(); -#endif s_gs->VSync(field); } catch (GSDXRecoverableError) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 69925f834e..eb15831b26 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -369,13 +369,8 @@ void GSDeviceOGL::AttachContext() void GSDeviceOGL::DetachContext() { - // Must be done before we detach the context! - if (GLLoader::found_GL_ARB_buffer_storage) - PboPool::UnmapAll(); - if (m_window) m_window->DetachContext(); - } void GSDeviceOGL::BeforeDraw() diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 64054b3a88..2c7995c1ce 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -23,13 +23,6 @@ #include "GSState.h" #include "GSdx.h" -#ifdef ENABLE_OGL_MT_HACK - -#include "GSRendererOGL.h" -extern GSRenderer* s_gs; - -#endif - //#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering GSState::GSState() @@ -1286,9 +1279,6 @@ void GSState::GIFRegHandlerTRXDIR(const GIFReg* RESTRICT r) break; case 1: // local -> host m_tr.Init(m_env.TRXPOS.SSAX, m_env.TRXPOS.SSAY); -#ifdef ENABLE_OGL_MT_HACK - s_gs->m_dev->DetachContext(); -#endif break; case 2: // local -> local Move(); @@ -1793,9 +1783,6 @@ static hash_map s_tags; template void GSState::Transfer(const uint8* mem, uint32 size) { GSPerfMonAutoTimer pmat(&m_perfmon); -#ifdef ENABLE_OGL_MT_HACK - s_gs->m_dev->AttachContext(); -#endif const uint8* start = mem; diff --git a/plugins/GSdx/config.h b/plugins/GSdx/config.h index 7e02747019..c8a2aa9556 100644 --- a/plugins/GSdx/config.h +++ b/plugins/GSdx/config.h @@ -38,7 +38,6 @@ //#define DISABLE_DATE -#define ENABLE_OGL_MT_HACK // OpenGL doesn't allow to access the same bound context from multiple threads. This hack changes context binding for GSreadFIFO* access #ifdef _DEBUG #define ENABLE_OGL_DEBUG // Create a debug context and check opengl command status. Allow also to dump various textures/states. #endif