Skip to content
Snippets Groups Projects
Commit 4dfeccc1 authored by Malte Christian Kögel's avatar Malte Christian Kögel
Browse files

Works. Added some error messages (I did not get any of these errors during...

Works. Added some error messages (I did not get any of these errors during testing, but to be safe). Did some performacen testing, looks good
parent 4ce616c6
No related branches found
No related tags found
No related merge requests found
...@@ -22,12 +22,17 @@ bool USFGazeTracker::Tick(float DeltaTime) ...@@ -22,12 +22,17 @@ bool USFGazeTracker::Tick(float DeltaTime)
TimeSinceLastEyeDataGather = 0.0f; TimeSinceLastEyeDataGather = 0.0f;
if(bEyeTrackingStarted && !bIsAsyncEyeTrackingTaskRunning) //We should not start another Async task, if the first has not terminated yet
if(bIsAsyncEyeTrackingTaskRunning)
{
USFLoggingBPLibrary::LogComment("Missed eye update due to slow async execution");
}
else if(bEyeTrackingStarted)
{ {
#ifdef WITH_SRANIPAL #ifdef WITH_SRANIPAL
bIsAsyncEyeTrackingTaskRunning = true; bIsAsyncEyeTrackingTaskRunning = true;
ViveSR::anipal::Eye::EyeData_v2 TempEyeData; ViveSR::anipal::Eye::EyeData_v2 TempEyeData;
//transfer 'this' into the function in order to have access to the boolean member variables in the nested GameThread-async task //transfer 'this' into the AnyThread-task and pass it to the GameThread-task in order to have access to bDataLogged, bIsAsyncEyeTrackingTaskRunning, SranipalEyeData there
AsyncTask(ENamedThreads::AnyThread, [this]() AsyncTask(ENamedThreads::AnyThread, [this]()
{ {
ViveSR::anipal::Eye::EyeData_v2 LocalEyeData; ViveSR::anipal::Eye::EyeData_v2 LocalEyeData;
...@@ -35,11 +40,16 @@ bool USFGazeTracker::Tick(float DeltaTime) ...@@ -35,11 +40,16 @@ bool USFGazeTracker::Tick(float DeltaTime)
// Set member variables from GameThread to avoid race conditions // Set member variables from GameThread to avoid race conditions
AsyncTask(ENamedThreads::GameThread, [this, LocalEyeData = MoveTemp(LocalEyeData), Result]() mutable AsyncTask(ENamedThreads::GameThread, [this, LocalEyeData = MoveTemp(LocalEyeData), Result]() mutable
{ {
//UE_LOG(LogTemp, Warning, TEXT("Tried to get EyeData, Result: %d"), Result); if(Result != 0)
{
USFLoggingBPLibrary::LogComment("GetEyeData_v2 ERROR: " + FString::FromInt(Result) + " (see ViveSR::Error for coding). Did not update SranipalEyeData.");
}
else
{
SranipalEyeData = LocalEyeData; SranipalEyeData = LocalEyeData;
bDataLogged = false; bDataLogged = false;
}
bIsAsyncEyeTrackingTaskRunning = false; bIsAsyncEyeTrackingTaskRunning = false;
//UE_LOG(LogTemp, Warning, TEXT("finished async task"));
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment