Commit 69236e7c authored by Gargaj's avatar Gargaj
Browse files

kill memleaks

(at least i think so, i dont have d3d debug so i'm flying blind here)
parent d38dd43c
......@@ -252,6 +252,12 @@ int main()
FFT::Close();
Renderer::ReleaseTexture( texFFT );
for (std::map<std::string, Renderer::Texture*>::iterator it = textures.begin(); it != textures.end(); it++)
{
Renderer::ReleaseTexture( it->second );
}
Renderer::Close();
return 0;
}
......@@ -389,7 +389,7 @@ namespace Renderer
LPDIRECT3DVERTEXBUFFER9 pFullscreenQuadVB = NULL;
LPDIRECT3DVERTEXBUFFER9 pGUIQuadVB = NULL;
LPDIRECT3DVERTEXDECLARATION9 pPostProcessVertexDecl = NULL;
LPDIRECT3DVERTEXDECLARATION9 pFullscreenQuadVertexDecl = NULL;
#define GUIQUADVB_SIZE (128*6)
......@@ -421,7 +421,7 @@ namespace Renderer
CopyMemory( v, pQuad, 4 * 5 * sizeof(float) );
pFullscreenQuadVB->Unlock();
pDevice->CreateVertexDeclaration( pFullscreenQuadElements, &pPostProcessVertexDecl );
pDevice->CreateVertexDeclaration( pFullscreenQuadElements, &pFullscreenQuadVertexDecl );
//////////////////////////////////////////////////////////////////////////
......@@ -470,6 +470,11 @@ namespace Renderer
}
void Close()
{
if (pFullscreenQuadVB) pFullscreenQuadVB->Release();
if (pFullscreenQuadVertexDecl) pFullscreenQuadVertexDecl->Release();
if (pGUIQuadVB) pGUIQuadVB->Release();
if (pVertexShader) pVertexShader->Release();
if (theShader) theShader->Release();
if (pDevice) pDevice->Release();
if (pD3D) pD3D->Release();
if (!hWnd)
......@@ -486,7 +491,7 @@ namespace Renderer
pDevice->SetVertexShader( pVertexShader );
pDevice->SetPixelShader( theShader );
pDevice->SetVertexDeclaration( pPostProcessVertexDecl );
pDevice->SetVertexDeclaration( pFullscreenQuadVertexDecl );
pDevice->SetStreamSource( 0, pFullscreenQuadVB, 0, sizeof(float) * 5 );
pDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment