mirror of https://github.com/PCSX2/pcsx2.git
GSdx: memory leak fix.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4332 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
eeb9757e94
commit
a2b7176cab
|
@ -24,6 +24,7 @@
|
||||||
#include "GSUtil.h"
|
#include "GSUtil.h"
|
||||||
#include "GSRendererSW.h"
|
#include "GSRendererSW.h"
|
||||||
#include "GSRendererNull.h"
|
#include "GSRendererNull.h"
|
||||||
|
#include "GSDeviceSW.h"
|
||||||
#include "GSDeviceNull.h"
|
#include "GSDeviceNull.h"
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
@ -194,6 +195,7 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
case 0: case 1: case 2: dev = new GSDevice9(); break;
|
case 0: case 1: case 2: dev = new GSDevice9(); break;
|
||||||
case 3: case 4: case 5: dev = new GSDevice11(); break;
|
case 3: case 4: case 5: dev = new GSDevice11(); break;
|
||||||
|
// case 3: case 4: case 5: dev = new GSDeviceSW(); break;
|
||||||
#endif
|
#endif
|
||||||
case 12: case 13: dev = new GSDeviceNull(); break;
|
case 12: case 13: dev = new GSDeviceNull(); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,7 @@ void GSRenderer::VSync(int field)
|
||||||
s += " | Recording...";
|
s += " | Recording...";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_wnd.IsManaged())
|
if(m_wnd.IsManaged())
|
||||||
{
|
{
|
||||||
m_wnd.SetWindowText(s.c_str());
|
m_wnd.SetWindowText(s.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -783,7 +783,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
||||||
|
|
||||||
GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type)
|
GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type)
|
||||||
{
|
{
|
||||||
Target* t = new Target(m_renderer);
|
Target* t = new Target(m_renderer, m_temp);
|
||||||
|
|
||||||
t->m_TEX0 = TEX0;
|
t->m_TEX0 = TEX0;
|
||||||
|
|
||||||
|
@ -816,8 +816,9 @@ GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int
|
||||||
|
|
||||||
// GSTextureCache::Surface
|
// GSTextureCache::Surface
|
||||||
|
|
||||||
GSTextureCache::Surface::Surface(GSRenderer* r)
|
GSTextureCache::Surface::Surface(GSRenderer* r, uint8* temp)
|
||||||
: m_renderer(r)
|
: m_renderer(r)
|
||||||
|
, m_temp(temp)
|
||||||
, m_texture(NULL)
|
, m_texture(NULL)
|
||||||
, m_age(0)
|
, m_age(0)
|
||||||
{
|
{
|
||||||
|
@ -837,13 +838,12 @@ void GSTextureCache::Surface::Update()
|
||||||
// GSTextureCache::Source
|
// GSTextureCache::Source
|
||||||
|
|
||||||
GSTextureCache::Source::Source(GSRenderer* r, uint8* temp)
|
GSTextureCache::Source::Source(GSRenderer* r, uint8* temp)
|
||||||
: Surface(r)
|
: Surface(r, temp)
|
||||||
, m_palette(NULL)
|
, m_palette(NULL)
|
||||||
, m_initpalette(true)
|
, m_initpalette(true)
|
||||||
, m_fmt(0)
|
, m_fmt(0)
|
||||||
, m_target(false)
|
, m_target(false)
|
||||||
, m_complete(false)
|
, m_complete(false)
|
||||||
, m_temp(temp)
|
|
||||||
{
|
{
|
||||||
memset(m_valid, 0, sizeof(m_valid));
|
memset(m_valid, 0, sizeof(m_valid));
|
||||||
|
|
||||||
|
@ -1048,8 +1048,8 @@ void GSTextureCache::Source::Flush(uint32 count)
|
||||||
|
|
||||||
// GSTextureCache::Target
|
// GSTextureCache::Target
|
||||||
|
|
||||||
GSTextureCache::Target::Target(GSRenderer* r)
|
GSTextureCache::Target::Target(GSRenderer* r, uint8* temp)
|
||||||
: Surface(r)
|
: Surface(r, temp)
|
||||||
, m_type(-1)
|
, m_type(-1)
|
||||||
, m_used(false)
|
, m_used(false)
|
||||||
{
|
{
|
||||||
|
@ -1091,13 +1091,11 @@ void GSTextureCache::Target::Update()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static uint8* buff = (uint8*)::_aligned_malloc(1024 * 1024 * 4, 32);
|
|
||||||
|
|
||||||
int pitch = ((w + 3) & ~3) * 4;
|
int pitch = ((w + 3) & ~3) * 4;
|
||||||
|
|
||||||
m_renderer->m_mem.ReadTexture(o, r, buff, pitch, TEXA);
|
m_renderer->m_mem.ReadTexture(o, r, m_temp, pitch, TEXA);
|
||||||
|
|
||||||
t->Update(r.rsize(), buff, pitch);
|
t->Update(r.rsize(), m_temp, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_renderer->m_perfmon.Put(GSPerfMon::Unswizzle, w * h * 4);
|
// m_renderer->m_perfmon.Put(GSPerfMon::Unswizzle, w * h * 4);
|
||||||
|
|
|
@ -49,9 +49,10 @@ public:
|
||||||
GIFRegTEX0 m_TEX0;
|
GIFRegTEX0 m_TEX0;
|
||||||
GIFRegTEXA m_TEXA;
|
GIFRegTEXA m_TEXA;
|
||||||
int m_age;
|
int m_age;
|
||||||
|
uint8* m_temp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Surface(GSRenderer* r);
|
Surface(GSRenderer* r, uint8* temp);
|
||||||
virtual ~Surface();
|
virtual ~Surface();
|
||||||
|
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
|
@ -72,7 +73,6 @@ public:
|
||||||
int m_fmt;
|
int m_fmt;
|
||||||
bool m_target;
|
bool m_target;
|
||||||
bool m_complete;
|
bool m_complete;
|
||||||
uint8* m_temp;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Source(GSRenderer* r, uint8* temp);
|
Source(GSRenderer* r, uint8* temp);
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
GSVector4i m_valid;
|
GSVector4i m_valid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Target(GSRenderer* r);
|
Target(GSRenderer* r, uint8* temp);
|
||||||
|
|
||||||
virtual void Update();
|
virtual void Update();
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@ void* vmalloc(size_t size, bool code)
|
||||||
|
|
||||||
void vmfree(void* ptr, size_t size)
|
void vmfree(void* ptr, size_t size)
|
||||||
{
|
{
|
||||||
VirtualFree(ptr, size, MEM_RELEASE);
|
VirtualFree(ptr, 0, MEM_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue