Hey guys,
So I’m working with Vulkan in a Source build of Unreal, and I get a reoccuring crash with the same error whenever I’m doing pretty much anything with a very high poly (~3 Milllion Triangles) static mesh, the crash may occur. Namely changing the amount of triangles in the static mesh editor, and when moving very high poly objects in the editor viewport.
Here’s the Crash Report:
Assertion failed: Layout->AreAllSubresourcesSameLayout() [File:C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanBarriers.h] [Line: 184]
UE4Editor_Core!AssertFailedImplV() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:104]
UE4Editor_Core!FDebug::CheckVerifyFailedImpl() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:461]
UE4Editor_VulkanRHI!FVulkanLayoutManager::FindOrAddLayoutRW() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanBarriers.h:184]
UE4Editor_VulkanRHI!FVulkanSurface::MoveSurface() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanTexture.cpp:743]
UE4Editor_VulkanRHI!FVulkanTextureBase::Move() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanTexture.cpp:2451]
UE4Editor_VulkanRHI!VulkanRHI::FVulkanSubresourceAllocator::DefragTick() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanMemory.cpp:4227]
UE4Editor_VulkanRHI!VulkanRHI::FVulkanResourceHeap::DefragTick() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanMemory.cpp:1890]
UE4Editor_VulkanRHI!VulkanRHI::FMemoryManager::ReleaseFreedPages() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanMemory.cpp:2455]
UE4Editor_VulkanRHI!FVulkanCommandListContext::RHIEndFrame() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\VulkanRHI\Private\VulkanRHI.cpp:903]
UE4Editor_RHI!FRHICommand<FRHICommandEndFrame,FRHICommandEndFrameString1826>::ExecuteAndDestruct() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\RHI\Public\RHICommandList.h:763]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteInner_DoExecute() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\RHI\Private\RHICommandList.cpp:368]
UE4Editor_RHI!FExecuteRHIThreadTask::DoTask() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\RHI\Private\RHICommandList.cpp:429]
UE4Editor_RHI!TGraphTask<FExecuteRHIThreadTask>::ExecuteTask() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:886]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:709]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:601]
UE4Editor_RenderCore!FRHIThread::Run() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp:320]
UE4Editor_Core!FRunnableThreadWin::Run() [C:\Unreal Engine\SourceUnreal\UnrealEngine\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:86]
I’ve tried commenting out the check on Layout->AreAllSubresourcesSameLayout() at line 184 in VulkanBarries.h
VULKANRHI_API VkImageLayout& FindOrAddLayoutRW(VkImage Image, VkImageLayout LayoutIfNotFound, uint32 NumMips, uint32 NumLayers)
{
FVulkanImageLayout* Layout = Layouts.Find(Image);
if (Layout)
{
/* Problem occurs here */
// check(Layout->AreAllSubresourcesSameLayout());
return Layout->MainLayout;
}
Layout = &Layouts.Add(Image, FVulkanImageLayout(LayoutIfNotFound, NumMips, NumLayers));
return Layout->MainLayout;
}
Which just results in the engine eventually freezing, but less often than it would crash.
The AreAllSubresourcesSameLayout() function at line 52 in the same file is this:
// Explicit subresource layouts. Always NumLayers*NumMips elements.
TArray<VkImageLayout> SubresLayouts;
bool AreAllSubresourcesSameLayout() const
{
return SubresLayouts.Num() == 0;
}