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
This commit is contained in:
Gregory Hainaut 2014-03-23 15:33:32 +01:00
parent f78c39cc98
commit 41091f8ebf
4 changed files with 0 additions and 49 deletions

View File

@ -58,11 +58,7 @@ extern bool RunLinuxDialog();
#define PS2E_X86 0x01 // 32 bit #define PS2E_X86 0x01 // 32 bit
#define PS2E_X86_64 0x02 // 64 bit #define PS2E_X86_64 0x02 // 64 bit
#ifdef ENABLE_OGL_MT_HACK
GSRenderer* s_gs = NULL;
#else
static GSRenderer* s_gs = NULL; static GSRenderer* s_gs = NULL;
#endif
static void (*s_irq)() = NULL; static void (*s_irq)() = NULL;
static uint8* s_basemem = NULL; static uint8* s_basemem = NULL;
static int s_renderer = -1; static int s_renderer = -1;
@ -550,20 +546,7 @@ EXPORT_C GSreadFIFO(uint8* mem)
{ {
try 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); s_gs->ReadFIFO(mem, 1);
#ifdef ENABLE_OGL_MT_HACK
s_gs->m_dev->DetachContext();
#endif
} }
catch (GSDXRecoverableError) catch (GSDXRecoverableError)
{ {
@ -574,17 +557,7 @@ EXPORT_C GSreadFIFO2(uint8* mem, uint32 size)
{ {
try 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); s_gs->ReadFIFO(mem, size);
#ifdef ENABLE_OGL_MT_HACK
s_gs->m_dev->DetachContext();
#endif
} }
catch (GSDXRecoverableError) catch (GSDXRecoverableError)
{ {
@ -656,9 +629,6 @@ EXPORT_C GSvsync(int field)
#endif #endif
#ifdef ENABLE_OGL_MT_HACK
s_gs->m_dev->AttachContext();
#endif
s_gs->VSync(field); s_gs->VSync(field);
} }
catch (GSDXRecoverableError) catch (GSDXRecoverableError)

View File

@ -369,13 +369,8 @@ void GSDeviceOGL::AttachContext()
void GSDeviceOGL::DetachContext() void GSDeviceOGL::DetachContext()
{ {
// Must be done before we detach the context!
if (GLLoader::found_GL_ARB_buffer_storage)
PboPool::UnmapAll();
if (m_window) if (m_window)
m_window->DetachContext(); m_window->DetachContext();
} }
void GSDeviceOGL::BeforeDraw() void GSDeviceOGL::BeforeDraw()

View File

@ -23,13 +23,6 @@
#include "GSState.h" #include "GSState.h"
#include "GSdx.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 //#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering
GSState::GSState() GSState::GSState()
@ -1286,9 +1279,6 @@ void GSState::GIFRegHandlerTRXDIR(const GIFReg* RESTRICT r)
break; break;
case 1: // local -> host case 1: // local -> host
m_tr.Init(m_env.TRXPOS.SSAX, m_env.TRXPOS.SSAY); m_tr.Init(m_env.TRXPOS.SSAX, m_env.TRXPOS.SSAY);
#ifdef ENABLE_OGL_MT_HACK
s_gs->m_dev->DetachContext();
#endif
break; break;
case 2: // local -> local case 2: // local -> local
Move(); Move();
@ -1793,9 +1783,6 @@ static hash_map<uint64, uint64> s_tags;
template<int index> void GSState::Transfer(const uint8* mem, uint32 size) template<int index> void GSState::Transfer(const uint8* mem, uint32 size)
{ {
GSPerfMonAutoTimer pmat(&m_perfmon); GSPerfMonAutoTimer pmat(&m_perfmon);
#ifdef ENABLE_OGL_MT_HACK
s_gs->m_dev->AttachContext();
#endif
const uint8* start = mem; const uint8* start = mem;

View File

@ -38,7 +38,6 @@
//#define DISABLE_DATE //#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 #ifdef _DEBUG
#define ENABLE_OGL_DEBUG // Create a debug context and check opengl command status. Allow also to dump various textures/states. #define ENABLE_OGL_DEBUG // Create a debug context and check opengl command status. Allow also to dump various textures/states.
#endif #endif