mirror of https://github.com/PCSX2/pcsx2.git
gsdx: use shared_ptr instead of raw GSWnd*
This commit is contained in:
parent
714fcaaadd
commit
9ff385f6f3
|
@ -220,7 +220,7 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
threads = theApp.GetConfigI("extrathreads");
|
||||
}
|
||||
|
||||
GSWnd* wnd[2] = { NULL, NULL };
|
||||
std::shared_ptr<GSWnd> wnd[2];
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -352,18 +352,18 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
case GSRendererType::OGL_HW:
|
||||
case GSRendererType::OGL_SW:
|
||||
case GSRendererType::OGL_OpenCL:
|
||||
s_gs->m_wnd = new GSWndWGL();
|
||||
s_gs->m_wnd = std::make_shared<GSWndWGL>();
|
||||
break;
|
||||
default:
|
||||
s_gs->m_wnd = new GSWndDX();
|
||||
s_gs->m_wnd = std::make_shared<GSWndDX>();
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#ifdef EGL_SUPPORTED
|
||||
wnd[0] = new GSWndEGL();
|
||||
wnd[1] = new GSWndOGL();
|
||||
wnd[0] = std::make_shared<GSWndEGL>();
|
||||
wnd[1] = std::make_shared<GSWndOGL>();
|
||||
#else
|
||||
wnd[0] = new GSWndOGL();
|
||||
wnd[0] = std::make_shared<GSWndOGL>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -400,14 +400,11 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
wnd[i]->Create(title, w, h);
|
||||
s_gs->m_wnd = wnd[i];
|
||||
|
||||
if (i == 0) delete wnd[1];
|
||||
|
||||
break;
|
||||
}
|
||||
catch (GSDXRecoverableError)
|
||||
{
|
||||
wnd[i]->Detach();
|
||||
delete wnd[i];
|
||||
}
|
||||
}
|
||||
if (s_gs->m_wnd == NULL)
|
||||
|
@ -450,14 +447,11 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
wnd[i]->Attach((void*)((uptr*)(dsp)+1), false);
|
||||
s_gs->m_wnd = wnd[i];
|
||||
|
||||
if (i == 0) delete wnd[1];
|
||||
|
||||
break;
|
||||
}
|
||||
catch (GSDXRecoverableError)
|
||||
{
|
||||
wnd[i]->Detach();
|
||||
delete wnd[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -470,8 +464,7 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
|
|||
catch (GSDXRecoverableError)
|
||||
{
|
||||
s_gs->m_wnd->Detach();
|
||||
delete s_gs->m_wnd;
|
||||
s_gs->m_wnd = NULL;
|
||||
s_gs->m_wnd.reset();
|
||||
}
|
||||
#endif
|
||||
if (s_gs->m_wnd == NULL)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "GSDevice.h"
|
||||
|
||||
GSDevice::GSDevice()
|
||||
: m_wnd(NULL)
|
||||
: m_wnd()
|
||||
, m_vsync(false)
|
||||
, m_rbswapped(false)
|
||||
, m_backbuffer(NULL)
|
||||
|
@ -57,7 +57,7 @@ GSDevice::~GSDevice()
|
|||
delete m_1x1;
|
||||
}
|
||||
|
||||
bool GSDevice::Create(GSWnd* wnd)
|
||||
bool GSDevice::Create(const std::shared_ptr<GSWnd>& wnd)
|
||||
{
|
||||
m_wnd = wnd;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class GSDevice : public GSAlignedClass<32>
|
|||
list<GSTexture*> m_pool;
|
||||
|
||||
protected:
|
||||
GSWnd* m_wnd;
|
||||
std::shared_ptr<GSWnd> m_wnd;
|
||||
bool m_vsync;
|
||||
bool m_rbswapped;
|
||||
GSTexture* m_backbuffer;
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
|
||||
enum {Windowed, Fullscreen, DontCare};
|
||||
|
||||
virtual bool Create(GSWnd* wnd);
|
||||
virtual bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
virtual bool Reset(int w, int h);
|
||||
virtual bool IsLost(bool update = false) {return false;}
|
||||
virtual void Present(const GSVector4i& r, int shader);
|
||||
|
|
|
@ -43,7 +43,7 @@ GSDevice11::~GSDevice11()
|
|||
{
|
||||
}
|
||||
|
||||
bool GSDevice11::Create(GSWnd* wnd)
|
||||
bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||
{
|
||||
if(!__super::Create(wnd))
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
GSDevice11();
|
||||
virtual ~GSDevice11();
|
||||
|
||||
bool Create(GSWnd* wnd);
|
||||
bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
bool Reset(int w, int h);
|
||||
void Flip();
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ void GSDevice9::ForceValidMsaaConfig()
|
|||
}
|
||||
};
|
||||
|
||||
bool GSDevice9::Create(GSWnd* wnd)
|
||||
bool GSDevice9::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||
{
|
||||
if(!__super::Create(wnd))
|
||||
{
|
||||
|
|
|
@ -185,7 +185,7 @@ public:
|
|||
GSDevice9();
|
||||
virtual ~GSDevice9();
|
||||
|
||||
bool Create(GSWnd* wnd);
|
||||
bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
bool Reset(int w, int h);
|
||||
bool IsLost(bool update);
|
||||
void Flip();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "GSDeviceNull.h"
|
||||
|
||||
bool GSDeviceNull::Create(GSWnd* wnd)
|
||||
bool GSDeviceNull::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||
{
|
||||
if(!GSDevice::Create(wnd))
|
||||
return false;
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
public:
|
||||
GSDeviceNull() {}
|
||||
|
||||
bool Create(GSWnd* wnd);
|
||||
bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
bool Reset(int w, int h);
|
||||
};
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ GSTexture* GSDeviceOGL::FetchSurface(int type, int w, int h, bool msaa, int form
|
|||
return t;
|
||||
}
|
||||
|
||||
bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||
bool GSDeviceOGL::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||
{
|
||||
// ****************************************************************
|
||||
// Debug helper
|
||||
|
|
|
@ -516,7 +516,7 @@ public:
|
|||
bool HasStencil() { return true; }
|
||||
bool HasDepth32() { return true; }
|
||||
|
||||
bool Create(GSWnd* wnd);
|
||||
bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
bool Reset(int w, int h);
|
||||
void Flip();
|
||||
void SetVSync(bool enable);
|
||||
|
|
|
@ -26,7 +26,7 @@ GSDeviceSW::GSDeviceSW()
|
|||
{
|
||||
}
|
||||
|
||||
bool GSDeviceSW::Create(GSWnd* wnd)
|
||||
bool GSDeviceSW::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||
{
|
||||
if(!GSDevice::Create(wnd))
|
||||
return false;
|
||||
|
|
|
@ -36,7 +36,7 @@ class GSDeviceSW : public GSDevice
|
|||
public:
|
||||
GSDeviceSW();
|
||||
|
||||
bool Create(GSWnd* wnd);
|
||||
bool Create(const std::shared_ptr<GSWnd> &wnd);
|
||||
bool Reset(int w, int h);
|
||||
|
||||
// drawing may be routed through here, the software renderers use the rasterizer directly now
|
||||
|
|
|
@ -37,7 +37,7 @@ GSRenderer::GSRenderer()
|
|||
, m_framelimit(false)
|
||||
, m_texture_shuffle(false)
|
||||
, m_real_size(0,0)
|
||||
, m_wnd(NULL)
|
||||
, m_wnd()
|
||||
, m_dev(NULL)
|
||||
{
|
||||
m_GStitleInfoBuffer[0] = 0;
|
||||
|
@ -61,11 +61,6 @@ GSRenderer::~GSRenderer()
|
|||
}*/
|
||||
|
||||
delete m_dev;
|
||||
|
||||
if(m_wnd)
|
||||
{
|
||||
delete m_wnd;
|
||||
}
|
||||
}
|
||||
|
||||
bool GSRenderer::CreateWnd(const string& title, int w, int h)
|
||||
|
|
|
@ -55,7 +55,7 @@ protected:
|
|||
virtual GSTexture* GetFeedbackOutput() { return nullptr; }
|
||||
|
||||
public:
|
||||
GSWnd* m_wnd;
|
||||
std::shared_ptr<GSWnd> m_wnd;
|
||||
GSDevice* m_dev;
|
||||
|
||||
public:
|
||||
|
|
|
@ -46,7 +46,7 @@ GPURenderer::GPURenderer(GSDevice* dev)
|
|||
m_hWnd = NULL;
|
||||
m_wndproc = NULL;
|
||||
|
||||
m_wnd = new GSWndDX();
|
||||
m_wnd = std::make_shared<GSWndDX>();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ protected:
|
|||
|
||||
#endif
|
||||
|
||||
GSWnd* m_wnd;
|
||||
std::shared_ptr<GSWnd> m_wnd;
|
||||
|
||||
public:
|
||||
GPURenderer(GSDevice* dev);
|
||||
|
|
Loading…
Reference in New Issue