TriAxis-Games / RealtimeMeshComponent

Unreal Engine 5 plugin component for rendering runtime generated content.
https://rmc.triaxis.games/
Other
1.58k stars 412 forks source link

Rare crash on mesh update #204

Closed azukaar closed 1 year ago

azukaar commented 3 years ago

Hello I had this crash using UE 4.25 and version 4.1.4

LoginId:4267e194456b53e907c04f9c9b565df0
EpicAccountId:62b297704a9b46259f959c7239c5a217

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x96191000

UE4Editor_RuntimeMeshComponent!TConstSetBitIterator<FDefaultBitArrayAllocator>::FindFirstSetBit() [D:\UE_4.25\Engine\Source\Runtime\Core\Public\Containers\BitArray.h:1151]
UE4Editor_RuntimeMeshComponent!FRuntimeMeshComponentSceneProxy::FRuntimeMeshComponentSceneProxy() [C:\Users\azuka\Documents\Unreal Projects\CV\Plugins\RuntimeMeshComponent\Source\RuntimeMeshComponent\Private\RuntimeMeshComponentProxy.cpp:42]
UE4Editor_RuntimeMeshComponent!URuntimeMeshComponent::CreateSceneProxy() [C:\Users\azuka\Documents\Unreal Projects\CV\Plugins\RuntimeMeshComponent\Source\RuntimeMeshComponent\Private\RuntimeMeshComponent.cpp:124]
UE4Editor_Renderer!FScene::AddPrimitive() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Renderer\Private\RendererScene.cpp:1296]
UE4Editor_Engine!UPrimitiveComponent::CreateRenderState_Concurrent() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\Components\PrimitiveComponent.cpp:574]
UE4Editor_Engine!UActorComponent::RecreateRenderState_Concurrent() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\Components\ActorComponent.cpp:1510]
UE4Editor_Engine!UActorComponent::DoDeferredRenderUpdates_Concurrent() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\Components\ActorComponent.cpp:1582]
UE4Editor_Engine!<lambda_dcda81c1d02aa08c77d55514fdce7396>::operator()() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1053]
UE4Editor_Engine!ParallelForImpl::ParallelForWithPreWorkInternal<TFunctionRef<void __cdecl(int)> >() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Async\ParallelFor.h:276]
UE4Editor_Engine!UWorld::SendAllEndOfFrameUpdates() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1066]
UE4Editor_Engine!UReflectionCaptureComponent::UpdateReflectionCaptureContents() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\Components\ReflectionCaptureComponent.cpp:1059]
UE4Editor_Engine!UGameEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1698]
UE4Editor!FEngineLoop::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4850]
UE4Editor!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
UE4Editor!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
UE4Editor!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

It does not seem to have any of my code in the ST so not sure what to send out as additional information but here is the mesh update code:

        if (mesh != nullptr) {
            mesh->RemoveAllSectionsForLOD(0);
        }

        int mId = 0;
        for (auto It = slicesBuffer.CreateIterator(); It; ++It) {
            SliceBuffer& sb = It.Value();

            if (sb.trianglesBuffer.Num() > 0) {
                nbVert += sb.verticesBuffer.Num();
                mesh->SetupMaterialSlot(mId, sb.ResourceId, matBuffer[mId]);
                mesh->CreateSectionFromComponents(0, mId, mId,
                    sb.verticesBuffer,
                    sb.trianglesBuffer,
                    sb.normalsBuffer,
                    sb.uvBuffer,
                    sb.uvBufferIsOutside,
                    TArray<FVector2D>(),
                    TArray<FVector2D>(),
                    sb.vertexColorsBuffer,
                    sb.tangentsBuffer,
                    ERuntimeMeshUpdateFrequency::Infrequent, true);
            }

            mId++;
        }
Koderz commented 1 year ago

Closing as this is now a replaced version of the plugin so previous issues likely won't apply exactly. If you continue to have this issue on the new version, please feel free to reopen!

Thanks!