From 4a427059d8614ff50144c90397fbb47807e66939 Mon Sep 17 00:00:00 2001 From: sudonim1 Date: Sun, 23 May 2010 17:26:37 +0000 Subject: [PATCH] Reverted r3063 as the last revision obsoleted it and it was causing suspend/resume issues with the software renderer, removed an unnecessary GSclose() and ResetDevice() call each git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3068 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GS.cpp | 23 +++++++++++++++-------- plugins/GSdx/GSDevice.cpp | 2 +- plugins/GSdx/GSRenderer.cpp | 10 ++++++---- plugins/GSdx/GSRendererHW.h | 2 +- plugins/GSdx/GSTexture11.h | 1 - plugins/GSdx/GSTextureCache11.h | 1 - 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 5ec7636bf4..8cfe2b5332 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -137,16 +137,16 @@ EXPORT_C GSclose() { if( !s_gs ) return; + s_gs->ResetDevice(); + + delete s_gs->m_dev; + s_gs->m_dev = NULL; + s_gs->m_wnd.Detach(); - - delete s_gs; - s_gs = NULL; } static INT32 _GSopen(void* dsp, char* title, int renderer) { - GSclose(); - GSDevice* dev = NULL; if( renderer == -1 ) @@ -156,6 +156,16 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) try { + if (s_renderer != renderer) + { + // Emulator has made a render change request, which requires a completely + // new s_gs -- if the emu doesn't save/restore the GS state across this + // GSopen call then they'll get corrupted graphics, but that's not my problem. + + delete s_gs; + s_gs = NULL; + } + switch(renderer) { default: @@ -233,7 +243,6 @@ static INT32 _GSopen(void* dsp, char* title, int renderer) EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags ) { - GSclose(); int renderer = theApp.GetConfig("renderer", 0); if( flags & 4 ) { @@ -250,7 +259,6 @@ EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags ) EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt) { - GSclose(); int renderer; // Legacy GUI expects to acquire vsync from the configuration files. @@ -368,7 +376,6 @@ EXPORT_C_(int) GSfreeze(int mode, GSFreezeData* data) } else if(mode == FREEZE_LOAD) { - s_gs->ResetDevice(); return s_gs->Defrost(data); } diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index ab3818d11c..d6bde005b1 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -45,7 +45,7 @@ GSDevice::GSDevice() GSDevice::~GSDevice() { for_each(m_pool.begin(), m_pool.end(), delete_object()); - m_pool.clear(); + delete m_backbuffer; delete m_merge; delete m_weavebob; diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 4afd795fba..a079a5964b 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -52,12 +52,14 @@ GSRenderer::GSRenderer() GSRenderer::~GSRenderer() { - if(m_dev) + /*if(m_dev) { - m_dev->Reset(1, 1); - delete m_dev; - } + m_dev->Reset(1, 1, GSDevice::Windowed); + }*/ + _aligned_free( m_tex_buff ); + + delete m_dev; } bool GSRenderer::CreateWnd(const string& title, int w, int h) diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index 332c9423db..7f9e3d895f 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -455,7 +455,7 @@ protected: void Reset() { // TODO: GSreset can come from the main thread too => crash - m_tc->RemoveAll(); + // m_tc->RemoveAll(); m_reset = true; diff --git a/plugins/GSdx/GSTexture11.h b/plugins/GSdx/GSTexture11.h index 7a7678016b..1f78df5f34 100644 --- a/plugins/GSdx/GSTexture11.h +++ b/plugins/GSdx/GSTexture11.h @@ -35,7 +35,6 @@ class GSTexture11 : public GSTexture public: explicit GSTexture11(ID3D11Texture2D* texture); - virtual ~GSTexture11() {}; bool Update(const GSVector4i& r, const void* data, int pitch); bool Map(GSMap& m, const GSVector4i* r); diff --git a/plugins/GSdx/GSTextureCache11.h b/plugins/GSdx/GSTextureCache11.h index 3b3edb5bc0..2ab4e4766e 100644 --- a/plugins/GSdx/GSTextureCache11.h +++ b/plugins/GSdx/GSTextureCache11.h @@ -32,6 +32,5 @@ protected: void Read(Target* t, const GSVector4i& r); public: - virtual ~GSTextureCache11() {}; GSTextureCache11(GSRenderer* r); };