mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Be very careful about order of object destruction to avoid races
This commit is contained in:
@@ -24,13 +24,17 @@
|
||||
|
||||
#include "../vk_core.h"
|
||||
|
||||
// note, for threading reasons we ensure to release the wrappers before
|
||||
// releasing the underlying object. Otherwise after releasing the vulkan object
|
||||
// that same handle could be returned by create on another thread, and we
|
||||
// could end up trying to re-wrap it.
|
||||
#define DESTROY_IMPL(type, func) \
|
||||
VkResult WrappedVulkan::vk ## func(VkDevice device, type obj) \
|
||||
{ \
|
||||
if(m_ImageInfo.find(GetResID(obj)) != m_ImageInfo.end()) m_ImageInfo.erase(GetResID(obj)); \
|
||||
VkResult ret = ObjDisp(device)->func(Unwrap(device), Unwrap(obj)); \
|
||||
type unwrappedObj = Unwrap(obj); \
|
||||
GetResourceManager()->ReleaseWrappedResource(obj, true); \
|
||||
return ret; \
|
||||
return ObjDisp(device)->func(Unwrap(device), unwrappedObj); \
|
||||
}
|
||||
|
||||
DESTROY_IMPL(VkBuffer, DestroyBuffer)
|
||||
|
||||
Reference in New Issue
Block a user