mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Fix a crash with vulkan shader edit & replace
This commit is contained in:
@@ -398,6 +398,7 @@ public:
|
||||
|
||||
// when asked for a given id, return the resource for a replacement id
|
||||
void ReplaceResource(ResourceId from, ResourceId to);
|
||||
bool HasReplacement(ResourceId from);
|
||||
void RemoveReplacement(ResourceId id);
|
||||
|
||||
// fetch original ID for a real ID or vice-versa.
|
||||
@@ -1121,6 +1122,14 @@ void ResourceManager<WrappedResourceType, RealResourceType, RecordType>::Replace
|
||||
m_Replacements[from] = to;
|
||||
}
|
||||
|
||||
template <typename WrappedResourceType, typename RealResourceType, typename RecordType>
|
||||
bool ResourceManager<WrappedResourceType, RealResourceType, RecordType>::HasReplacement(ResourceId from)
|
||||
{
|
||||
SCOPED_LOCK(m_Lock);
|
||||
|
||||
return m_Replacements.find(from) != m_Replacements.end();
|
||||
}
|
||||
|
||||
template <typename WrappedResourceType, typename RealResourceType, typename RecordType>
|
||||
void ResourceManager<WrappedResourceType, RealResourceType, RecordType>::RemoveReplacement(ResourceId id)
|
||||
{
|
||||
|
||||
@@ -2458,6 +2458,9 @@ void VulkanDebugManager::RemoveReplacement(ResourceId id)
|
||||
// we're passed in the original ID but we want the live ID for comparison
|
||||
ResourceId liveid = GetResourceManager()->GetLiveID(id);
|
||||
|
||||
if(!GetResourceManager()->HasReplacement(id))
|
||||
return;
|
||||
|
||||
// remove the actual shader module replacements
|
||||
GetResourceManager()->RemoveReplacement(id);
|
||||
GetResourceManager()->RemoveReplacement(liveid);
|
||||
|
||||
Reference in New Issue
Block a user