From f9272bdebab035df1dfd235448d40e577fedd8fb Mon Sep 17 00:00:00 2001 From: kevin ortegren Date: Wed, 1 Mar 2023 16:53:19 -0500 Subject: [PATCH] Embree device/scene is used even after they fail init. Fix crash by early out. (This matches the behavior of GenerateCardRepresentationData). Failed Embree init will leave FDistanceFieldVolumeData::IsValid() returning false. #rb tiago.costa, mihnea.balta #rnx #preflight 63ff868dae54ee4ce945432b [CL 24471347 by kevin ortegren in ue5-main branch] --- .../MeshUtilities/Private/MeshDistanceFieldUtilities.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Engine/Source/Developer/MeshUtilities/Private/MeshDistanceFieldUtilities.cpp b/Engine/Source/Developer/MeshUtilities/Private/MeshDistanceFieldUtilities.cpp index fc9504947b6e..5976b1511dff 100644 --- a/Engine/Source/Developer/MeshUtilities/Private/MeshDistanceFieldUtilities.cpp +++ b/Engine/Source/Developer/MeshUtilities/Private/MeshDistanceFieldUtilities.cpp @@ -274,6 +274,12 @@ void FMeshUtilities::GenerateSignedDistanceFieldVolumeData( check(EmbreeScene.bUseEmbree); + // If Embree setup fails, there will be no scene to operate on. Early out. + if (!EmbreeScene.EmbreeScene) + { + return; + } + // Whether to use an Embree Point Query to compute the closest unsigned distance. Rays will only be traced to determine backfaces visible for sign. const bool bUsePointQuery = true;