diff --git a/GPU/Directx9/helper/fbo.h b/GPU/Directx9/helper/fbo.h index 4228bc2c5e..4fd9ae810c 100644 --- a/GPU/Directx9/helper/fbo.h +++ b/GPU/Directx9/helper/fbo.h @@ -41,5 +41,6 @@ void * fbo_get_rtt(FBO *fbo); // To get default depth and rt surface void fbo_init(); +void fbo_shutdown(); }; \ No newline at end of file diff --git a/GPU/Directx9/helper/global.cpp b/GPU/Directx9/helper/global.cpp index 26fa9bf267..e8fa5fa70e 100644 --- a/GPU/Directx9/helper/global.cpp +++ b/GPU/Directx9/helper/global.cpp @@ -214,6 +214,20 @@ void CompileShaders() { pD3Ddevice->CreateVertexDeclaration( SoftTransVertexElements, &pSoftVertexDecl ); } +void DestroyShaders() { + if (pFramebufferVertexShader) { + pFramebufferVertexShader->Release(); + } + if (pFramebufferPixelShader) { + pFramebufferPixelShader->Release(); + } + if (pFramebufferVertexDecl) { + pFramebufferVertexDecl->Release(); + } + if (pSoftVertexDecl) { + pSoftVertexDecl->Release(); + } +} bool useVsync = false; diff --git a/GPU/Directx9/helper/global.h b/GPU/Directx9/helper/global.h index 2dff7267bd..abb52aa4bc 100644 --- a/GPU/Directx9/helper/global.h +++ b/GPU/Directx9/helper/global.h @@ -27,6 +27,7 @@ extern IDirect3DVertexDeclaration9* pSoftVertexDecl; void CompileShaders(); bool CompilePixelShader(const char *code, LPDIRECT3DPIXELSHADER9 *pShader, ID3DXConstantTable **pShaderTable, std::string &errorMessage); bool CompileVertexShader(const char *code, LPDIRECT3DVERTEXSHADER9 *pShader, ID3DXConstantTable **pShaderTable, std::string &errorMessage); +void DestroyShaders(); void DirectxInit(HWND window); #define D3DBLEND_UNK D3DSTENCILOP_FORCE_DWORD diff --git a/Windows/D3D9Base.cpp b/Windows/D3D9Base.cpp index e8af6bef05..ab26271646 100644 --- a/Windows/D3D9Base.cpp +++ b/Windows/D3D9Base.cpp @@ -116,6 +116,8 @@ void D3D9_Resize(HWND window) { } void D3D9_Shutdown() { + DX9::DestroyShaders(); + DX9::fbo_shutdown(); device->EndScene(); device->Release(); d3d->Release();