mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-27 08:56:44 +00:00
gl: Delete context owned resources from resource manager.
This fixes tracking problems when a context id is reused.
This commit is contained in:
committed by
Baldur Karlsson
parent
089b9c1ece
commit
e63f696ddb
@@ -821,6 +821,8 @@ void WrappedOpenGL::DeleteContext(void *contextHandle)
|
||||
|
||||
RenderDoc::Inst().RemoveDeviceFrameCapturer(ctxdata.ctx);
|
||||
|
||||
GetResourceManager()->DeleteContext(contextHandle);
|
||||
|
||||
if(ctxdata.built && ctxdata.ready)
|
||||
{
|
||||
if(ctxdata.Program)
|
||||
|
||||
@@ -92,6 +92,26 @@ public:
|
||||
ResourceManager::Shutdown();
|
||||
}
|
||||
|
||||
void DeleteContext(void *context)
|
||||
{
|
||||
size_t count = 0;
|
||||
for(auto it = m_CurrentResourceIds.begin(); it != m_CurrentResourceIds.end(); it++)
|
||||
{
|
||||
if(it->first.Context == context)
|
||||
{
|
||||
++count;
|
||||
ResourceId res = it->second;
|
||||
MarkCleanResource(res);
|
||||
if(HasResourceRecord(res))
|
||||
GetResourceRecord(res)->Delete(this);
|
||||
ReleaseCurrentResource(it->second);
|
||||
it = m_CurrentResourceIds.erase(it);
|
||||
}
|
||||
}
|
||||
RDCDEBUG("Removed %zu/%zu resources belonging to context %p", count,
|
||||
m_CurrentResourceIds.size(), context);
|
||||
}
|
||||
|
||||
inline void RemoveResourceRecord(ResourceId id)
|
||||
{
|
||||
for(auto it = m_GLResourceRecords.begin(); it != m_GLResourceRecords.end(); it++)
|
||||
|
||||
Reference in New Issue
Block a user