Skip to content

Commit 8fa5a71

Browse files
committed
Add missing lock around forced references removal
1 parent a17d95b commit 8fa5a71

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@ static void MakeSubpassLoadRP(RPCreateInfo &info, const RPCreateInfo *origInfo,
156156
}
157157
}
158158

159+
template <typename type>
160+
bool RemoveForcedRef()
161+
{
162+
return false;
163+
}
164+
165+
template <>
166+
bool RemoveForcedRef<VkAccelerationStructureKHR>()
167+
{
168+
return true;
169+
}
170+
159171
// note, for threading reasons we ensure to release the wrappers before
160172
// releasing the underlying object. Otherwise after releasing the vulkan object
161173
// that same handle could be returned by create on another thread, and we
@@ -166,7 +178,11 @@ static void MakeSubpassLoadRP(RPCreateInfo &info, const RPCreateInfo *origInfo,
166178
if(obj == VK_NULL_HANDLE) \
167179
return; \
168180
type unwrappedObj = Unwrap(obj); \
169-
m_ForcedReferences.removeOne(GetRecord(obj)); \
181+
if(RemoveForcedRef<type>()) \
182+
{ \
183+
SCOPED_LOCK(m_ForcedReferencesLock); \
184+
m_ForcedReferences.removeOne(GetRecord(obj)); \
185+
} \
170186
if(IsReplayMode(m_State)) \
171187
m_CreationInfo.erase(GetResID(obj)); \
172188
GetResourceManager()->ReleaseWrappedResource(obj, true); \

0 commit comments

Comments
 (0)