Fix various issues found with adrress sanitizer on macOS
This commit is contained in:
@@ -247,8 +247,7 @@ void TypedDescriptorPoolSetVulkan::Reset()
|
||||
|
||||
DescriptorPoolSetContainerVulkan::DescriptorPoolSetContainerVulkan(GPUDeviceVulkan* device)
|
||||
: _device(device)
|
||||
, _lastFrameUsed(Engine::FrameCount)
|
||||
, _used(true)
|
||||
, LastFrameUsed(Engine::FrameCount)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -278,12 +277,6 @@ void DescriptorPoolSetContainerVulkan::Reset()
|
||||
}
|
||||
}
|
||||
|
||||
void DescriptorPoolSetContainerVulkan::SetUsed(bool used)
|
||||
{
|
||||
_used = used;
|
||||
_lastFrameUsed = used ? Engine::FrameCount : _lastFrameUsed;
|
||||
}
|
||||
|
||||
DescriptorPoolsManagerVulkan::DescriptorPoolsManagerVulkan(GPUDeviceVulkan* device)
|
||||
: _device(device)
|
||||
{
|
||||
@@ -299,9 +292,9 @@ DescriptorPoolSetContainerVulkan& DescriptorPoolsManagerVulkan::AcquirePoolSetCo
|
||||
ScopeLock lock(_locker);
|
||||
for (auto* poolSet : _poolSets)
|
||||
{
|
||||
if (poolSet->IsUnused())
|
||||
if (poolSet->Refs == 0)
|
||||
{
|
||||
poolSet->SetUsed(true);
|
||||
poolSet->LastFrameUsed = Engine::FrameCount;
|
||||
poolSet->Reset();
|
||||
return *poolSet;
|
||||
}
|
||||
@@ -313,7 +306,7 @@ DescriptorPoolSetContainerVulkan& DescriptorPoolsManagerVulkan::AcquirePoolSetCo
|
||||
|
||||
void DescriptorPoolsManagerVulkan::ReleasePoolSet(DescriptorPoolSetContainerVulkan& poolSet)
|
||||
{
|
||||
poolSet.SetUsed(false);
|
||||
poolSet.LastFrameUsed = Engine::FrameCount;
|
||||
}
|
||||
|
||||
void DescriptorPoolsManagerVulkan::GC()
|
||||
@@ -322,7 +315,7 @@ void DescriptorPoolsManagerVulkan::GC()
|
||||
for (int32 i = _poolSets.Count() - 1; i >= 0; i--)
|
||||
{
|
||||
const auto poolSet = _poolSets[i];
|
||||
if (poolSet->IsUnused() && Engine::FrameCount - poolSet->GetLastFrameUsed() > VULKAN_RESOURCE_DELETE_SAFE_FRAMES_COUNT)
|
||||
if (poolSet->Refs == 0 && Engine::FrameCount - poolSet->LastFrameUsed > VULKAN_RESOURCE_DELETE_SAFE_FRAMES_COUNT)
|
||||
{
|
||||
_poolSets.RemoveAt(i);
|
||||
Delete(poolSet);
|
||||
|
||||
Reference in New Issue
Block a user