Skip to content

Commit

Permalink
Merge pull request #1550 from CesiumGS/ue55-ray-tracing
Browse files Browse the repository at this point in the history
Fix UE 5.5 crash with hardware ray tracing enabled
  • Loading branch information
kring authored Nov 17, 2024
2 parents 8ef6dfd + 40230a2 commit d30fd44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include <CesiumGltf/KhrTextureTransform.h>
#include <array>
#include <variant>

struct FCesiumFeatureIdSet;
Expand Down
6 changes: 6 additions & 0 deletions Source/CesiumRuntime/Private/CesiumGltfComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,12 @@ static void loadPrimitive(
LODResources.bHasReversedIndices = false;
LODResources.bHasReversedDepthOnlyIndices = false;

#if ENGINE_VERSION_5_5_OR_HIGHER
// UE 5.5 requires that we do this in order to avoid a crash when ray tracing
// is enabled.
RenderData->InitializeRayTracingRepresentationFromRenderingLODs();
#endif

primitiveResult.meshIndex = options.pMeshOptions->meshIndex;
primitiveResult.primitiveIndex = options.primitiveIndex;
primitiveResult.RenderData = std::move(RenderData);
Expand Down
2 changes: 2 additions & 0 deletions Source/CesiumRuntime/Public/CesiumCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "Runtime/Launch/Resources/Version.h"

#define ENGINE_VERSION_5_5_OR_HIGHER \
(ENGINE_MAJOR_VERSION > 5 || ENGINE_MINOR_VERSION >= 5)
#define ENGINE_VERSION_5_4_OR_HIGHER \
(ENGINE_MAJOR_VERSION > 5 || ENGINE_MINOR_VERSION >= 4)
#define ENGINE_VERSION_5_3_OR_HIGHER \
Expand Down

0 comments on commit d30fd44

Please sign in to comment.