mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-14 18:00:54 +00:00
Avoid deadlock if resource is unmapped during capture end on D3D12
This commit is contained in:
2 files changed
+11
-21
No files matched your search
@@ -1659,11 +1659,11 @@ void WrappedID3D12Device::Unmap(ID3D12Resource *Resource, UINT Subresource, byte
|
||||
if(heapProps.Type == D3D12_HEAP_TYPE_READBACK)
|
||||
return;
|
||||
|
||||
map.res = Resource;
|
||||
map.subres = Subresource;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_MapsLock);
|
||||
map.res = Resource;
|
||||
map.subres = Subresource;
|
||||
|
||||
int32_t idx = m_Maps.indexOf(map);
|
||||
|
||||
if(idx < 0)
|
||||
@@ -2481,14 +2481,12 @@ bool WrappedID3D12Device::EndFrameCapture(DeviceOwnedWindow devWnd)
|
||||
m_State = CaptureState::BackgroundCapturing;
|
||||
|
||||
GPUSync();
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_MapsLock);
|
||||
for(auto it = m_Maps.begin(); it != m_Maps.end(); ++it)
|
||||
GetWrapped(it->res)->FreeShadow();
|
||||
}
|
||||
}
|
||||
|
||||
rdcarray<MapState> maps = GetMaps();
|
||||
for(auto it = maps.begin(); it != maps.end(); ++it)
|
||||
GetWrapped(it->res)->FreeShadow();
|
||||
|
||||
const uint32_t maxSize = 2048;
|
||||
RenderDoc::FramePixels fp;
|
||||
|
||||
@@ -2834,15 +2832,13 @@ bool WrappedID3D12Device::DiscardFrameCapture(DeviceOwnedWindow devWnd)
|
||||
|
||||
GPUSync();
|
||||
|
||||
{
|
||||
SCOPED_LOCK(m_MapsLock);
|
||||
for(auto it = m_Maps.begin(); it != m_Maps.end(); ++it)
|
||||
GetWrapped(it->res)->FreeShadow();
|
||||
}
|
||||
|
||||
queues = m_Queues;
|
||||
}
|
||||
|
||||
rdcarray<MapState> maps = GetMaps();
|
||||
for(auto it = maps.begin(); it != maps.end(); ++it)
|
||||
GetWrapped(it->res)->FreeShadow();
|
||||
|
||||
m_HeaderChunk->Delete();
|
||||
m_HeaderChunk = NULL;
|
||||
|
||||
|
||||
@@ -179,8 +179,6 @@ WrappedID3D12Resource::~WrappedID3D12Resource()
|
||||
|
||||
byte *WrappedID3D12Resource::GetMap(UINT Subresource)
|
||||
{
|
||||
SCOPED_LOCK(GetResourceRecord()->m_MapLock);
|
||||
|
||||
D3D12ResourceRecord::MapData *map = GetResourceRecord()->m_Maps;
|
||||
size_t mapcount = GetResourceRecord()->m_MapsCount;
|
||||
|
||||
@@ -192,8 +190,6 @@ byte *WrappedID3D12Resource::GetMap(UINT Subresource)
|
||||
|
||||
byte *WrappedID3D12Resource::GetShadow(UINT Subresource)
|
||||
{
|
||||
SCOPED_LOCK(GetResourceRecord()->m_MapLock);
|
||||
|
||||
D3D12ResourceRecord::MapData *map = GetResourceRecord()->m_Maps;
|
||||
|
||||
return map[Subresource].shadowPtr;
|
||||
@@ -201,8 +197,6 @@ byte *WrappedID3D12Resource::GetShadow(UINT Subresource)
|
||||
|
||||
void WrappedID3D12Resource::AllocShadow(UINT Subresource, size_t size)
|
||||
{
|
||||
SCOPED_LOCK(GetResourceRecord()->m_MapLock);
|
||||
|
||||
D3D12ResourceRecord::MapData *map = GetResourceRecord()->m_Maps;
|
||||
|
||||
if(map[Subresource].shadowPtr == NULL)
|
||||
|
||||
Reference in new issue
Block a user