So, I’m working on a MarchingCubes plugin, and it generally works well. However, I’m attempting to implement a TaskGraph event to speed up the filling of a 3D Noise Texture.
I’ve been looking at the great BrickGame as a reference for how a few things are done, and have attempted to implement a TaskGraph the way Andrew has done it.
It works fine in the program. However, when I’m in debug mode, and exit out of Unreal, a breakpoint is triggered throwing up an error message:
Assertion failed: ModuleInfo->Module.IsUnique() [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\Core\Private\Modules\ModuleManager.cpp] [Line: 502]
This is only triggered if I use the TaskGraph system. If I do not use it, there is no error.
For reference, here’s the section of code I’m using:
//pre-fill a lookup 3d texture to avoid having to constantly do calls to the 3d Sampler
void FOpenSourceMarchingCubes::Fill3DTexture(int32 inOffsetX, int32 inOffsetY, int32 inOffsetZ, int32 Dimension)
{
NoiseTextureVolume.Empty();
NoiseTextureVolume.AddUninitialized(Dimension*Dimension*Dimension);
FGraphEventArray XTaskGraphItem;
for (int32 X = 0; X < Dimension; X++)
{
XTaskGraphItem.Add(FFunctionGraphTask::CreateAndDispatchWhenReady([&, X]()
{
for (int32 Y = 0; Y < Dimension; Y++)
{
for (int32 Z = 0; Z < Dimension; Z++)
{
NoiseTextureVolume[Dimension * Dimension * X + Dimension * Y + Z] = (Density(inOffsetX + X * fStepSize, inOffsetY + Y * fStepSize, inOffsetZ + Z * fStepSize));
}
}
}, TStatId(), NULL));
}
// Wait for XTaskGraphItem tasks to complete.
FTaskGraphInterface::Get().WaitUntilTasksComplete(XTaskGraphItem, ENamedThreads::GameThread);
}
Thoughts?