mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Erase m_CurrentResources from the end not the beginning
* Since it's a sorted vector this avoids O(n^2) time to erase everything one by one.
This commit is contained in:
@@ -89,13 +89,19 @@ public:
|
||||
|
||||
while(!m_CurrentResources.empty())
|
||||
{
|
||||
auto it = m_CurrentResources.begin();
|
||||
auto it = m_CurrentResources.end();
|
||||
--it;
|
||||
ResourceId id = it->second.first;
|
||||
if(it->second.second)
|
||||
it->second.second->Delete(this);
|
||||
|
||||
if(!m_CurrentResources.empty() && m_CurrentResources.begin()->second.first == id)
|
||||
m_CurrentResources.erase(m_CurrentResources.begin());
|
||||
if(!m_CurrentResources.empty())
|
||||
{
|
||||
auto last = m_CurrentResources.end();
|
||||
last--;
|
||||
if(last->second.first == id)
|
||||
m_CurrentResources.erase(last);
|
||||
}
|
||||
}
|
||||
|
||||
m_CurrentResources.clear();
|
||||
|
||||
Reference in New Issue
Block a user