@@ -8,6 +8,8 @@
|
||||
#include "Loading/Tasks/LoadAssetTask.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/LogContext.h"
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Physics/Physics.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "Engine/Scripting/ManagedCLR/MCore.h"
|
||||
@@ -703,6 +705,38 @@ void Asset::onUnload_MainThread()
|
||||
OnUnloaded(this);
|
||||
}
|
||||
|
||||
bool Asset::WaitForInitGraphics()
|
||||
{
|
||||
#define IS_GPU_NOT_READY() (GPUDevice::Instance == nullptr || GPUDevice::Instance->GetState() != GPUDevice::DeviceState::Ready)
|
||||
if (!IsInMainThread() && IS_GPU_NOT_READY())
|
||||
{
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
int32 timeout = 1000;
|
||||
while (IS_GPU_NOT_READY() && timeout-- > 0)
|
||||
Platform::Sleep(1);
|
||||
if (IS_GPU_NOT_READY())
|
||||
return true;
|
||||
}
|
||||
#undef IS_GPU_NOT_READY
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Asset::WaitForInitPhysics()
|
||||
{
|
||||
if (!IsInMainThread() && !Physics::DefaultScene)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
ZoneColor(TracyWaitZoneColor);
|
||||
int32 timeout = 1000;
|
||||
while (!Physics::DefaultScene && timeout-- > 0)
|
||||
Platform::Sleep(1);
|
||||
if (!Physics::DefaultScene)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
bool Asset::OnCheckSave(const StringView& path) const
|
||||
|
||||
Reference in New Issue
Block a user