mirror of https://github.com/PCSX2/pcsx2.git
GSdx: Fixed a couple memory leaks.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2000 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
8b0cbe445a
commit
c5c21f06cb
|
@ -85,6 +85,8 @@ EXPORT_C_(INT32) GSinit()
|
|||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
//_CrtSetBreakAlloc( 1273 );
|
||||
|
||||
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
|
||||
if(!GSUtil::CheckDirectX())
|
||||
|
|
|
@ -188,6 +188,7 @@ void GSDevice::Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVec
|
|||
{
|
||||
if(!m_merge || !(m_merge->GetSize() == fs))
|
||||
{
|
||||
delete m_merge;
|
||||
m_merge = CreateRenderTarget(fs.x, fs.y, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ GSDevice9::GSDevice9()
|
|||
GSDevice9::~GSDevice9()
|
||||
{
|
||||
for_each(m_mskfix.begin(), m_mskfix.end(), delete_second());
|
||||
|
||||
for_each(m_om_bs.begin(), m_om_bs.end(), delete_second());
|
||||
for_each(m_om_dss.begin(), m_om_dss.end(), delete_second());
|
||||
for_each(m_ps_ss.begin(), m_ps_ss.end(), delete_second());
|
||||
|
||||
if(m_state.vs_cb) _aligned_free(m_state.vs_cb);
|
||||
if(m_state.ps_cb) _aligned_free(m_state.ps_cb);
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
GSRenderer::GSRenderer()
|
||||
: GSState()
|
||||
, m_tex_buff( (uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 16) )
|
||||
, m_vt(this)
|
||||
, m_dev(NULL)
|
||||
, m_shader(0)
|
||||
, m_vt(this)
|
||||
{
|
||||
m_interlace = theApp.GetConfig("interlace", 0);
|
||||
m_aspectratio = theApp.GetConfig("aspectratio", 1);
|
||||
|
@ -52,6 +53,8 @@ GSRenderer::~GSRenderer()
|
|||
m_dev->Reset(1, 1, GSDevice::Windowed);
|
||||
}*/
|
||||
|
||||
_aligned_free( m_tex_buff );
|
||||
|
||||
delete m_dev;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ protected:
|
|||
bool m_aa1;
|
||||
bool m_blur;
|
||||
|
||||
uint8* m_tex_buff;
|
||||
|
||||
virtual GSTexture* GetOutput(int i) = 0;
|
||||
|
||||
GSVertexTrace m_vt;
|
||||
|
@ -86,6 +88,10 @@ public:
|
|||
{
|
||||
return !m_nativeres && m_regs->PMODE.EN != 0; // upscale ratio depends on the display size, with no output it may not be set correctly (ps2 logo to game transition)
|
||||
}
|
||||
|
||||
// TODO : Implement proper locking here *if needed* (not sure yet if it is) --air
|
||||
uint8* GetTextureBufferLock() { return m_tex_buff; }
|
||||
void ReleaseTextureBufferLock() { }
|
||||
};
|
||||
|
||||
template<class Vertex> class GSRendererT : public GSRenderer
|
||||
|
|
|
@ -93,8 +93,7 @@ GSTexture* GSRendererSW::GetOutput(int i)
|
|||
|
||||
if(m_dev->ResizeTexture(&m_texture[i], w, h))
|
||||
{
|
||||
// TODO
|
||||
static uint8* buff = (uint8*)_aligned_malloc(1024 * 1024 * 4, 16);
|
||||
uint8* buff = GetTextureBufferLock();
|
||||
static int pitch = 1024 * 4;
|
||||
|
||||
GSVector4i r(0, 0, w, h);
|
||||
|
|
|
@ -910,9 +910,6 @@ void GSTextureCache::Source::Flush(uint32 count)
|
|||
|
||||
GSVector4i tr(0, 0, tw, th);
|
||||
|
||||
// TODO
|
||||
static uint8* buff = (uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 16);
|
||||
|
||||
int pitch = max(tw, psm.bs.x) * sizeof(uint32);
|
||||
|
||||
GSLocalMemory& mem = m_renderer->m_mem;
|
||||
|
@ -927,6 +924,8 @@ void GSTextureCache::Source::Flush(uint32 count)
|
|||
rtx = psm.rtxP;
|
||||
}
|
||||
|
||||
uint8* buff = m_renderer->GetTextureBufferLock();
|
||||
|
||||
for(uint32 i = 0; i < count; i++)
|
||||
{
|
||||
GSVector4i r = m_write.rect[i];
|
||||
|
@ -956,14 +955,14 @@ void GSTextureCache::Source::Flush(uint32 count)
|
|||
}
|
||||
}
|
||||
|
||||
m_renderer->ReleaseTextureBufferLock();
|
||||
|
||||
if(count < m_write.count)
|
||||
{
|
||||
memcpy(m_write.rect[0], &m_write.rect[count], (m_write.count - count) * sizeof(m_write.rect[0]));
|
||||
}
|
||||
|
||||
m_write.count -= count;
|
||||
|
||||
//_aligned_free(buff);
|
||||
}
|
||||
|
||||
// GSTextureCache::Target
|
||||
|
|
Loading…
Reference in New Issue