mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
Only modify static resource maps in the replay app.
This prevents static data like WrappedTexture<>::m_TextureList from being accessed from different device instances on different threads. Each device instance has its own mutex, and so is unable to protect the static data from access through other instances. The static data is only used in the replay app, which is single threaded, so accessing the static maps is not a problem there.
This commit is contained in:
committed by
Baldur Karlsson
parent
bb3b94b092
commit
68bbc356a4
@@ -448,18 +448,24 @@ public:
|
||||
WrappedID3D11Buffer(ID3D11Buffer *real, uint32_t byteLength, WrappedID3D11Device *device)
|
||||
: WrappedResource11(real, device)
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
|
||||
RDCASSERT(m_BufferList.find(GetResourceID()) == m_BufferList.end());
|
||||
m_BufferList[GetResourceID()] = BufferEntry(this, byteLength);
|
||||
RDCASSERT(m_BufferList.find(GetResourceID()) == m_BufferList.end());
|
||||
m_BufferList[GetResourceID()] = BufferEntry(this, byteLength);
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~WrappedID3D11Buffer()
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
|
||||
if(m_BufferList.find(GetResourceID()) != m_BufferList.end())
|
||||
m_BufferList.erase(GetResourceID());
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
if(m_BufferList.find(GetResourceID()) != m_BufferList.end())
|
||||
m_BufferList.erase(GetResourceID());
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
}
|
||||
@@ -492,10 +498,13 @@ public:
|
||||
{
|
||||
if(type != TEXDISPLAY_UNKNOWN)
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
|
||||
RDCASSERT(m_TextureList.find(GetResourceID()) == m_TextureList.end());
|
||||
m_TextureList[GetResourceID()] = TextureEntry(this, type);
|
||||
RDCASSERT(m_TextureList.find(GetResourceID()) == m_TextureList.end());
|
||||
m_TextureList[GetResourceID()] = TextureEntry(this, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,8 +512,11 @@ public:
|
||||
{
|
||||
SCOPED_LOCK(m_pDevice->D3DLock());
|
||||
|
||||
if(m_TextureList.find(GetResourceID()) != m_TextureList.end())
|
||||
m_TextureList.erase(GetResourceID());
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
if(m_TextureList.find(GetResourceID()) != m_TextureList.end())
|
||||
m_TextureList.erase(GetResourceID());
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user