d3d12: Fix memleak

This commit is contained in:
vlj 2015-06-21 18:38:23 +02:00 committed by Vincent Lejeune
parent c6a5e905bc
commit d29b82566e
2 changed files with 9 additions and 4 deletions

View File

@ -414,7 +414,7 @@ D3D12GSRender::D3D12GSRender()
LOG_WARNING(RSX, "Modified %x, starting again", texadrr);
ID3D12Resource *texToErase = m_texturesCache[texadrr];
m_texturesCache.erase(texadrr);
m_Textoclean.push_back(texToErase);
m_texToClean.push_back(texToErase);
vm::page_protect(protectedRangeStart, protectedRangeSize, 0, vm::page_writable, 0);
m_protectedTextures.erase(currentIt);
@ -613,6 +613,10 @@ D3D12GSRender::~D3D12GSRender()
m_rtts.Release();
for (unsigned i = 0; i < 17; i++)
m_rootSignatures[i]->Release();
for (auto tmp : m_texToClean)
tmp->Release();
for (auto tmp : m_texturesCache)
tmp.second->Release();
m_swapChain->Release();
m_outputScalingPass.Release();
m_device->Release();
@ -1063,8 +1067,8 @@ void D3D12GSRender::Flip()
};
std::lock_guard<std::mutex> lock(mut);
std::vector<ID3D12Resource *> textoclean = m_Textoclean;
m_Textoclean.clear();
std::vector<ID3D12Resource *> textoclean = m_texToClean;
m_texToClean.clear();
m_GC.pushWork([&, cleaningFunction, textoclean]()
{

View File

@ -209,7 +209,8 @@ private:
*/
std::mutex mut;
std::list <std::tuple<u32, u32, u32> > m_protectedTextures; // Texaddress, start of protected range, size of protected range
std::vector<ID3D12Resource *> m_Textoclean;
std::vector<ID3D12Resource *> m_texToClean;
GarbageCollectionThread m_GC;
// Copy of RTT to be used as texture
std::unordered_map<u32, ID3D12Resource* > m_texturesRTTs;