diff --git a/.github/actions/install-unreal-windows/action.yml b/.github/actions/install-unreal-windows/action.yml index 8ddbb709d..f86311a37 100644 --- a/.github/actions/install-unreal-windows/action.yml +++ b/.github/actions/install-unreal-windows/action.yml @@ -30,12 +30,12 @@ runs: 7z x -mmt=8 "D:/Program Files/Epic Games/UE.zip" "-oD:/Program Files/Epic Games/" del "D:/Program Files/Epic Games/UE.zip" - name: Install Unreal Engine (older versions) - if: ${{ inputs.unreal-program-name != 'UE_5.6' }} + if: ${{ inputs.unreal-program-name == 'UE_5.4' || inputs.unreal-program-name == 'UE_5.5' }} shell: pwsh run: | Start-Process "D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}/Engine/Extras/Redist/en-us/UEPrereqSetup_x64.exe" -Args "-q" -Wait - name: Install Unreal Engine (5.6+) - if: ${{ inputs.unreal-program-name == 'UE_5.6' }} + if: ${{ inputs.unreal-program-name != 'UE_5.4' && inputs.unreal-program-name != 'UE_5.5' }} shell: pwsh run: | Start-Process "D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}/Engine/Extras/Redist/en-us/vc_redist.x64.exe" -Args "-q" -Wait diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4aebdd79..e51f907fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -390,3 +390,121 @@ jobs: test-package-base-name: "CesiumForUnreal-56" visual-studio-version: "2022" visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64,Microsoft.VisualStudio.Component.Windows11SDK.22621" + Windows57: + uses: ./.github/workflows/buildWindows.yml + secrets: inherit + with: + runner-label: "windows-2022" + unreal-engine-version: "5.7.0" + unreal-engine-zip: "s3://cesium-unreal-engine/5.7.0/UE_5.7.zip" + unreal-program-name: "UE_5.7" + upload-package-base-name: "CesiumForUnreal-57-windows" + # These are specified in the Unreal Engine release notes under "IDE Version the Build farm compiles against" + # and using them ensures we're compiling our plugin in the exact same way that Unreal Engine itself is compiled. + cmake-generator: "Visual Studio 17 2022" + cmake-toolchain: "version=14.44" + cmake-platform: "x64,version=10.0.22621.0" + visual-studio-version: "2022" + visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.44.17.14.x86.x64,Microsoft.VisualStudio.Component.Windows11SDK.22621" + TestWindows57: + needs: [Windows57] + uses: ./.github/workflows/testWindows.yml + secrets: inherit + with: + runner-label: windows-2022 + unreal-engine-zip: "s3://cesium-unreal-engine/5.7.0/UE_5.7.zip" + unreal-program-name: "UE_5.7" + test-package-base-name: "CesiumForUnreal-57-windows" + Android57: + uses: ./.github/workflows/buildAndroid.yml + secrets: inherit + with: + runner-label: windows-2022 + unreal-engine-version: "5.7.0" + unreal-engine-zip: "s3://cesium-unreal-engine/5.7.0/UE_5.7.zip" + unreal-program-name: "UE_5.7" + upload-package-base-name: "CesiumForUnreal-57-android" + android-ndk-version: "r27c" + Linux57: + uses: ./.github/workflows/buildLinux.yml + secrets: inherit + with: + runner-label: ubuntu-22.04 + unreal-engine-version: "5.7.0" + unreal-engine-zip: "s3://cesium-unreal-engine/5.7.0/Linux_Unreal_Engine_5.7.0.zip" + unreal-program-name: "UE_5.7" + upload-package-base-name: "CesiumForUnreal-57-linux" + clang-version: "v26_clang-20.1.8-rockylinux8" + Apple57: + uses: ./.github/workflows/buildApple.yml + secrets: inherit + with: + runner-label: macos-14 + unreal-engine-version: "5.7.0" + unreal-engine-zip: "s3://cesium-unreal-engine/5.7.0/UE_57-mac.zip" + unreal-program-name: "UE_5.7" + upload-package-base-name: "CesiumForUnreal-57-apple" + xcode-version: "16.1" + Combine57: + runs-on: ubuntu-latest + needs: [Windows57, Android57, Linux57, Apple57] + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Set environment variables + run: | + export CESIUM_UNREAL_VERSION=$GITHUB_REF_NAME + export BUILD_CESIUM_UNREAL_PACKAGE_NAME="CesiumForUnreal-57-${CESIUM_UNREAL_VERSION}" + export BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME="CesiumForUnreal-57-SourceOnly-${CESIUM_UNREAL_VERSION}" + # Make these available to subsequent steps + echo "CESIUM_UNREAL_VERSION=$CESIUM_UNREAL_VERSION" >> $GITHUB_ENV + echo "BUILD_CESIUM_UNREAL_PACKAGE_NAME=$BUILD_CESIUM_UNREAL_PACKAGE_NAME" >> $GITHUB_ENV + echo "BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME=$BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME" >> $GITHUB_ENV + - name: Download Apple build + uses: actions/download-artifact@v4 + with: + name: CesiumForUnreal-57-apple-${{ env.CESIUM_UNREAL_VERSION}} + path: combine + - name: Download Android build + uses: actions/download-artifact@v4 + with: + name: CesiumForUnreal-57-android-${{ env.CESIUM_UNREAL_VERSION}} + path: combine + - name: Download Linux build + uses: actions/download-artifact@v4 + with: + name: CesiumForUnreal-57-linux-${{ env.CESIUM_UNREAL_VERSION}} + path: combine + - name: Download Windows build + uses: actions/download-artifact@v4 + with: + name: CesiumForUnreal-57-windows-${{ env.CESIUM_UNREAL_VERSION}} + path: combine + - name: Publish combined package artifact + if: ${{ success() }} + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_CESIUM_UNREAL_PACKAGE_NAME}} + path: combine + - name: Publish combined package artifact for the Unreal Marketplace + if: ${{ success() }} + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME}} + path: | + combine + # These are built by Epic, and including them seems to confuse their process. + !combine/CesiumForUnreal/Binaries/**/* + !combine/CesiumForUnreal/Intermediate/**/* + TestPackage57: + needs: [Combine57] + uses: ./.github/workflows/testPackageOnWindows.yml + secrets: inherit + with: + runner-label: windows-2022 + unreal-engine-zip: "s3://cesium-unreal-engine/5.7.0/UE_5.7.zip" + unreal-program-name: "UE_5.7" + unreal-engine-association: "5.7" + test-package-base-name: "CesiumForUnreal-57" + visual-studio-version: "2022" + visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.44.17.14.x86.x64,Microsoft.VisualStudio.Component.Windows11SDK.22621" diff --git a/Documentation/Source/dev.Target.cs b/Documentation/Source/dev.Target.cs index 2b33041ed..97e19251d 100644 --- a/Documentation/Source/dev.Target.cs +++ b/Documentation/Source/dev.Target.cs @@ -6,7 +6,9 @@ public class devTarget : TargetRules public devTarget( TargetInfo Target) : base(Target) { Type = TargetType.Game; -#if UE_5_4_OR_LATER +#if UE_5_7_OR_LATER + DefaultBuildSettings = BuildSettingsVersion.V6; +#elif UE_5_4_OR_LATER DefaultBuildSettings = BuildSettingsVersion.V4; #else DefaultBuildSettings = BuildSettingsVersion.V2; diff --git a/Documentation/Source/devEditor.Target.cs b/Documentation/Source/devEditor.Target.cs index 53c57f729..65bbfd7f8 100644 --- a/Documentation/Source/devEditor.Target.cs +++ b/Documentation/Source/devEditor.Target.cs @@ -6,7 +6,9 @@ public class devEditorTarget : TargetRules public devEditorTarget( TargetInfo Target) : base(Target) { Type = TargetType.Editor; -#if UE_5_4_OR_LATER +#if UE_5_7_OR_LATER + DefaultBuildSettings = BuildSettingsVersion.V6; +#elif UE_5_4_OR_LATER DefaultBuildSettings = BuildSettingsVersion.V4; #else DefaultBuildSettings = BuildSettingsVersion.V2; diff --git a/Source/CesiumEditor/CesiumEditor.Build.cs b/Source/CesiumEditor/CesiumEditor.Build.cs index f560aaadf..8c9999ff3 100644 --- a/Source/CesiumEditor/CesiumEditor.Build.cs +++ b/Source/CesiumEditor/CesiumEditor.Build.cs @@ -126,7 +126,11 @@ public CesiumEditor(ReadOnlyTargetRules Target) : base(Target) } ); +#if UE_5_7_OR_LATER + IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7; +#else IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_2; +#endif PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; CppStandard = CppStandardVersion.Cpp20; } diff --git a/Source/CesiumRuntime/CesiumRuntime.Build.cs b/Source/CesiumRuntime/CesiumRuntime.Build.cs index cca9bfb4e..863402972 100644 --- a/Source/CesiumRuntime/CesiumRuntime.Build.cs +++ b/Source/CesiumRuntime/CesiumRuntime.Build.cs @@ -103,7 +103,8 @@ public CesiumRuntime(ReadOnlyTargetRules Target) : base(Target) "Json", "JsonUtilities", "Slate", - "SlateCore" + "SlateCore", + "ChaosCore" } ); @@ -156,8 +157,13 @@ public CesiumRuntime(ReadOnlyTargetRules Target) : base(Target) } ); - ShadowVariableWarningLevel = WarningLevel.Off; +#if UE_5_7_OR_LATER + IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_7; + CppCompileWarningSettings.ShadowVariableWarningLevel = WarningLevel.Off; +#else IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_4; + ShadowVariableWarningLevel = WarningLevel.Off; +#endif PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; CppStandard = CppStandardVersion.Cpp20; diff --git a/Source/CesiumRuntime/Private/CesiumCompat.cpp b/Source/CesiumRuntime/Private/CesiumCompat.cpp new file mode 100644 index 000000000..1ca79b8eb --- /dev/null +++ b/Source/CesiumRuntime/Private/CesiumCompat.cpp @@ -0,0 +1,29 @@ +#include "CesiumCompat.h" +#include "CesiumCommon.h" + +FSceneInterfaceWrapper::FSceneInterfaceWrapper( + FSceneInterface* InSceneInterface) { +#if ENGINE_VERSION_5_7_OR_HIGHER + this->ShaderPlatform = InSceneInterface->GetShaderPlatform(); +#endif + this->RHIFeatureLevelType = InSceneInterface->GetFeatureLevel(); +} + +FMaterialRelevance FSceneInterfaceWrapper::GetMaterialRelevance( + UMeshComponent* InMeshComponent) const { +#if ENGINE_VERSION_5_7_OR_HIGHER + return InMeshComponent->GetMaterialRelevance(this->ShaderPlatform); +#else + return InMeshComponent->GetMaterialRelevance(this->RHIFeatureLevelType); +#endif +} + +void ALevelInstance_SetDesiredRuntimeBehavior( + ALevelInstance* Instance, + ELevelInstanceRuntimeBehavior RuntimeBehavior) { +#if WITH_EDITORONLY_DATA && ENGINE_VERSION_5_7_OR_HIGHER + Instance->SetDesiredRuntimeBehavior(RuntimeBehavior); +#elif WITH_EDITORONLY_DATA + Instance->DesiredRuntimeBehavior = RuntimeBehavior; +#endif +} diff --git a/Source/CesiumRuntime/Private/CesiumCompat.h b/Source/CesiumRuntime/Private/CesiumCompat.h new file mode 100644 index 000000000..11cc1ff97 --- /dev/null +++ b/Source/CesiumRuntime/Private/CesiumCompat.h @@ -0,0 +1,36 @@ +// Copyright 2020 - 2025 CesiumGS, Inc.and Contributors + +#pragma once + +#include "CesiumCommon.h" +#include "Components/MeshComponent.h" +#include "LevelInstance/LevelInstanceActor.h" +#include "RHIFeatureLevel.h" +#include "RHIShaderPlatform.h" +#include "SceneInterface.h" + +/** + * Wrapper around FSceneInterface to deal with the switch to EShaderPlatform in + * Unreal 5.7. + */ +struct FSceneInterfaceWrapper { + FSceneInterfaceWrapper(FSceneInterface* SceneInterface); + + FMaterialRelevance + GetMaterialRelevance(UMeshComponent* InMeshComponent) const; + + ERHIFeatureLevel::Type RHIFeatureLevelType; + +#if ENGINE_VERSION_5_7_OR_HIGHER +private: + EShaderPlatform ShaderPlatform; +#endif +}; + +/** + * Compatibility fix for the DesiredRuntimeBehavior -> SetDesiredRuntimeBehavior + * change in Unreal 5.7. + */ +void ALevelInstance_SetDesiredRuntimeBehavior( + ALevelInstance* Instance, + ELevelInstanceRuntimeBehavior RuntimeBehavior); diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index 5369cc97a..4e2b7f1f0 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -5,6 +5,7 @@ #include "Cesium3DTileset.h" #include "CesiumActors.h" #include "CesiumCommon.h" +#include "CesiumCompat.h" #include "CesiumCustomVersion.h" #include "CesiumGeospatial/Cartographic.h" #include "CesiumGlobeAnchorComponent.h" @@ -781,8 +782,9 @@ void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { FRotator::ZeroRotator, spawnParameters); pLevelInstance->SetIsSpatiallyLoaded(false); - pLevelInstance->DesiredRuntimeBehavior = - ELevelInstanceRuntimeBehavior::LevelStreaming; + ALevelInstance_SetDesiredRuntimeBehavior( + pLevelInstance, + ELevelInstanceRuntimeBehavior::LevelStreaming); pLevelInstance->SetActorLabel(pFound->LevelName); FString levelPath = level.PackageName.ToString() + "." + diff --git a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp index 62590d796..445dc2872 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp @@ -18,6 +18,7 @@ #include "CesiumTransforms.h" #include "Chaos/AABBTree.h" #include "Chaos/CollisionConvexMesh.h" +#include "Chaos/Core.h" #include "Chaos/TriangleMeshImplicitObject.h" #include "CreateGltfOptions.h" #include "EncodedFeaturesMetadata.h" @@ -3259,7 +3260,7 @@ static void loadPrimitiveGameThreadPart( NAME_None, RF_Transactional); pBaseAsMaterialInstance->AddAssetUserData(pCesiumData); - pCesiumData->PostEditChangeOwner(); + pCesiumData->UpdateLayerNames(); } } #endif @@ -3853,7 +3854,7 @@ static Chaos::FTriangleMeshImplicitObjectPtr BuildChaosTriangleMeshes( Chaos::TParticles vertices; vertices.AddParticles(vertexCount); for (uint32 i = 0; i < vertexCount; ++i) { - vertices.X(int32(i)) = positionBuffer.VertexPosition(i); + vertices.SetX(int32(i), positionBuffer.VertexPosition(i)); } int32 triangleCount = indices.Num() / 3; diff --git a/Source/CesiumRuntime/Private/CesiumGltfLinesComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfLinesComponent.cpp index 1c4d431ff..7a8610e8d 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfLinesComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfLinesComponent.cpp @@ -14,5 +14,7 @@ FPrimitiveSceneProxy* UCesiumGltfLinesComponent::CreateSceneProxy() { return nullptr; } - return new FCesiumGltfLinesSceneProxy(this, GetScene()->GetFeatureLevel()); + return new FCesiumGltfLinesSceneProxy( + this, + FSceneInterfaceWrapper(GetScene())); } diff --git a/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.cpp b/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.cpp index e2284cf35..f22fba7c2 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.cpp @@ -17,12 +17,13 @@ SIZE_T FCesiumGltfLinesSceneProxy::GetTypeHash() const { FCesiumGltfLinesSceneProxy::FCesiumGltfLinesSceneProxy( UCesiumGltfLinesComponent* InComponent, - ERHIFeatureLevel::Type InFeatureLevel) + FSceneInterfaceWrapper InSceneInterfaceParams) : FPrimitiveSceneProxy(InComponent), RenderData(InComponent->GetStaticMesh()->GetRenderData()), NumLines(RenderData->LODResources[0].IndexBuffer.GetNumIndices() / 2), Material(InComponent->GetMaterial(0)), - MaterialRelevance(InComponent->GetMaterialRelevance(InFeatureLevel)) {} + MaterialRelevance( + InSceneInterfaceParams.GetMaterialRelevance(InComponent)) {} FCesiumGltfLinesSceneProxy::~FCesiumGltfLinesSceneProxy() {} diff --git a/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.h b/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.h index a852d8446..1035b5d93 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.h +++ b/Source/CesiumRuntime/Private/CesiumGltfLinesSceneProxy.h @@ -2,6 +2,7 @@ #pragma once +#include "CesiumCompat.h" #include "PrimitiveSceneProxy.h" class UCesiumGltfLinesComponent; @@ -17,7 +18,7 @@ class FCesiumGltfLinesSceneProxy final : public FPrimitiveSceneProxy { FCesiumGltfLinesSceneProxy( UCesiumGltfLinesComponent* InComponent, - ERHIFeatureLevel::Type InFeatureLevel); + FSceneInterfaceWrapper InSceneInterfaceParams); virtual ~FCesiumGltfLinesSceneProxy(); diff --git a/Source/CesiumRuntime/Private/CesiumGltfPointsComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfPointsComponent.cpp index a7e9fec3f..08ac26e10 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfPointsComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfPointsComponent.cpp @@ -1,6 +1,7 @@ // Copyright 2020-2024 CesiumGS, Inc. and Contributors #include "CesiumGltfPointsComponent.h" +#include "CesiumCompat.h" #include "CesiumGltfPointsSceneProxy.h" #include "SceneInterface.h" @@ -18,7 +19,7 @@ FPrimitiveSceneProxy* UCesiumGltfPointsComponent::CreateSceneProxy() { } FCesiumGltfPointsSceneProxy* Proxy = - new FCesiumGltfPointsSceneProxy(this, GetScene()->GetFeatureLevel()); + new FCesiumGltfPointsSceneProxy(this, FSceneInterfaceWrapper(GetScene())); FCesiumGltfPointsSceneProxyTilesetData TilesetData; TilesetData.UpdateFromComponent(this); diff --git a/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.cpp b/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.cpp index f0aaa9379..d857bdc8f 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.cpp @@ -35,7 +35,7 @@ SIZE_T FCesiumGltfPointsSceneProxy::GetTypeHash() const { FCesiumGltfPointsSceneProxy::FCesiumGltfPointsSceneProxy( UCesiumGltfPointsComponent* InComponent, - ERHIFeatureLevel::Type InFeatureLevel) + FSceneInterfaceWrapper InSceneInterfaceParams) : FPrimitiveSceneProxy(InComponent), RenderData(InComponent->GetStaticMesh()->GetRenderData()), NumPoints(RenderData->LODResources[0].IndexBuffer.GetNumIndices()), @@ -43,11 +43,12 @@ FCesiumGltfPointsSceneProxy::FCesiumGltfPointsSceneProxy( RHISupportsManualVertexFetch(GetScene().GetShaderPlatform())), TilesetData(), AttenuationVertexFactory( - InFeatureLevel, + InSceneInterfaceParams.RHIFeatureLevelType, &RenderData->LODResources[0].VertexBuffers.PositionVertexBuffer), AttenuationIndexBuffer(NumPoints, bAttenuationSupported), Material(InComponent->GetMaterial(0)), - MaterialRelevance(InComponent->GetMaterialRelevance(InFeatureLevel)) {} + MaterialRelevance( + InSceneInterfaceParams.GetMaterialRelevance(InComponent)) {} FCesiumGltfPointsSceneProxy::~FCesiumGltfPointsSceneProxy() {} diff --git a/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.h b/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.h index 0b4295490..2492c38b1 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.h +++ b/Source/CesiumRuntime/Private/CesiumGltfPointsSceneProxy.h @@ -2,6 +2,7 @@ #pragma once +#include "CesiumCompat.h" #include "CesiumPointAttenuationVertexFactory.h" #include "CesiumPointCloudShading.h" #include "PrimitiveSceneProxy.h" @@ -36,7 +37,7 @@ class FCesiumGltfPointsSceneProxy final : public FPrimitiveSceneProxy { FCesiumGltfPointsSceneProxy( UCesiumGltfPointsComponent* InComponent, - ERHIFeatureLevel::Type InFeatureLevel); + FSceneInterfaceWrapper InSceneInterfaceParams); virtual ~FCesiumGltfPointsSceneProxy(); diff --git a/Source/CesiumRuntime/Private/CesiumMaterialUserData.cpp b/Source/CesiumRuntime/Private/CesiumMaterialUserData.cpp index 454b933a8..1dda5da31 100644 --- a/Source/CesiumRuntime/Private/CesiumMaterialUserData.cpp +++ b/Source/CesiumRuntime/Private/CesiumMaterialUserData.cpp @@ -1,12 +1,26 @@ // Copyright 2020-2024 CesiumGS, Inc. and Contributors #include "CesiumMaterialUserData.h" +#include "CesiumCommon.h" #include "Materials/MaterialInstance.h" #include "Runtime/Launch/Resources/Version.h" +#if ENGINE_VERSION_5_6_OR_HIGHER +void UCesiumMaterialUserData::PostEditChangeOwner( + const FPropertyChangedEvent& PropertyChangedEvent) { + Super::PostEditChangeOwner(PropertyChangedEvent); + + this->UpdateLayerNames(); +} +#else void UCesiumMaterialUserData::PostEditChangeOwner() { Super::PostEditChangeOwner(); + this->UpdateLayerNames(); +} +#endif + +void UCesiumMaterialUserData::UpdateLayerNames() { #if WITH_EDITORONLY_DATA this->LayerNames.Empty(); diff --git a/Source/CesiumRuntime/Private/CesiumPointAttenuationVertexFactory.cpp b/Source/CesiumRuntime/Private/CesiumPointAttenuationVertexFactory.cpp index e616ffcb7..f8f12d5b4 100644 --- a/Source/CesiumRuntime/Private/CesiumPointAttenuationVertexFactory.cpp +++ b/Source/CesiumRuntime/Private/CesiumPointAttenuationVertexFactory.cpp @@ -2,6 +2,7 @@ #include "CesiumPointAttenuationVertexFactory.h" +#include "CesiumCommon.h" #include "DataDrivenShaderPlatformInfo.h" #include "MaterialDomain.h" #include "MeshBatch.h" @@ -10,6 +11,29 @@ #include "RenderCommandFence.h" #include "Runtime/Launch/Resources/Version.h" +namespace { +FBufferRHIRef CreatePointAttenuationBuffer( + FRHICommandListBase& RHICmdList, + const TCHAR* Name, + int32 Size, + int32 Stride, + EBufferUsageFlags Flags) { +#if ENGINE_VERSION_5_6_OR_HIGHER + FRHIBufferCreateDesc CreateDesc(Name, Size, Stride, Flags); + CreateDesc.SetInitialState(ERHIAccess::VertexOrIndexBuffer); + return RHICmdList.CreateBuffer(CreateDesc); +#else + FRHIResourceCreateInfo CreateInfo(Name); + return RHICmdList.CreateBuffer( + Size, + Flags, + Stride, + ERHIAccess::VertexOrIndexBuffer, + CreateInfo); +#endif +} +} // namespace + void FCesiumPointAttenuationIndexBuffer::InitRHI( FRHICommandListBase& RHICmdList) { if (!bAttenuationSupported) { @@ -19,16 +43,15 @@ void FCesiumPointAttenuationIndexBuffer::InitRHI( // This must be called from Rendering thread check(IsInRenderingThread()); - FRHIResourceCreateInfo CreateInfo(TEXT("FCesiumPointAttenuationIndexBuffer")); const uint32 NumIndices = NumPoints * 6; const uint32 Size = NumIndices * sizeof(uint32); - IndexBufferRHI = RHICmdList.CreateBuffer( + IndexBufferRHI = CreatePointAttenuationBuffer( + RHICmdList, + TEXT("FCesiumPointAttenuationIndexBuffer"), Size, - BUF_Static | BUF_IndexBuffer, sizeof(uint32), - ERHIAccess::VertexOrIndexBuffer, - CreateInfo); + BUF_Static | BUF_IndexBuffer); uint32* Data = (uint32*)RHICmdList.LockBuffer(IndexBufferRHI, 0, Size, RLM_WriteOnly); @@ -125,14 +148,12 @@ class FCesiumPointAttenuationDummyVertexBuffer : public FVertexBuffer { void FCesiumPointAttenuationDummyVertexBuffer::InitRHI( FRHICommandListBase& RHICmdList) { - FRHIResourceCreateInfo CreateInfo( - TEXT("FCesiumPointAttenuationDummyVertexBuffer")); - VertexBufferRHI = RHICmdList.CreateBuffer( + VertexBufferRHI = CreatePointAttenuationBuffer( + RHICmdList, + TEXT("FCesiumPointAttenuationDummyVertexBuffer"), sizeof(FVector3f) * 4, - BUF_Static | BUF_VertexBuffer, 0, - ERHIAccess::VertexOrIndexBuffer, - CreateInfo); + BUF_Static | BUF_VertexBuffer); FVector3f* DummyContents = (FVector3f*)RHICmdList.LockBuffer( VertexBufferRHI, 0, diff --git a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp index c74f2959b..b7b28d18d 100644 --- a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp @@ -3,6 +3,7 @@ #include "CesiumSubLevelComponent.h" #include "Cesium3DTileset.h" #include "CesiumActors.h" +#include "CesiumCompat.h" #include "CesiumGeoreference.h" #include "CesiumGeospatial/LocalHorizontalCoordinateSystem.h" #include "CesiumRuntime.h" @@ -484,7 +485,7 @@ void UCesiumSubLevelComponent::OnRegister() { #if WITH_EDITOR if (pOwner->GetIsSpatiallyLoaded() || - pOwner->DesiredRuntimeBehavior != + pOwner->GetDesiredRuntimeBehavior() != ELevelInstanceRuntimeBehavior::LevelStreaming) { pOwner->Modify(); @@ -498,8 +499,9 @@ void UCesiumSubLevelComponent::OnRegister() { // (Partitioned), will dump the actors in the sub-level into the main // level, which will prevent us from being to turn the sub-level on and // off at runtime. - pOwner->DesiredRuntimeBehavior = - ELevelInstanceRuntimeBehavior::LevelStreaming; + ALevelInstance_SetDesiredRuntimeBehavior( + pOwner, + ELevelInstanceRuntimeBehavior::LevelStreaming); UE_LOG( LogCesium, diff --git a/Source/CesiumRuntime/Private/CesiumTextureResource.cpp b/Source/CesiumRuntime/Private/CesiumTextureResource.cpp index bcdaef9cd..9b5a785b9 100644 --- a/Source/CesiumRuntime/Private/CesiumTextureResource.cpp +++ b/Source/CesiumRuntime/Private/CesiumTextureResource.cpp @@ -1,6 +1,7 @@ // Copyright 2020-2024 CesiumGS, Inc. and Contributors #include "CesiumTextureResource.h" +#include "CesiumCommon.h" #include "CesiumRuntime.h" #include "CesiumTextureUtility.h" #include "Misc/CoreStats.h" @@ -192,7 +193,7 @@ void CopyMip( } } -FTexture2DRHIRef createAsyncTextureAndWait( +FTextureRHIRef createAsyncTextureAndWait( uint32 SizeX, uint32 SizeY, uint8 Format, @@ -202,7 +203,7 @@ FTexture2DRHIRef createAsyncTextureAndWait( uint32 NumInitialMips) { FGraphEventRef CompletionEvent; - FTexture2DRHIRef result = RHIAsyncCreateTexture2D( + FTextureRHIRef result = RHIAsyncCreateTexture2D( SizeX, SizeY, Format, @@ -230,7 +231,7 @@ FTexture2DRHIRef createAsyncTextureAndWait( * @param Whether to use a sRGB color-space. * @return The RHI texture reference. */ -FTexture2DRHIRef CreateRHITexture2D_Async( +FTextureRHIRef CreateRHITexture2D_Async( const CesiumGltf::ImageAsset& image, EPixelFormat format, bool sRGB) { @@ -339,7 +340,7 @@ void FCesiumTextureResourceDeleter::operator()(FCesiumTextureResource* p) { // thread. TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::CreateRHITexture2D) - FTexture2DRHIRef textureReference = + FTextureRHIRef textureReference = CreateRHITexture2D_Async(imageCesium, *maybePixelFormat, sRGB); // textureReference->SetName( // FName(UTF8_TO_TCHAR(imageCesium.getUniqueAssetId().c_str()))); @@ -488,7 +489,9 @@ void FCesiumTextureResource::InitRHI(FRHICommandListBase& RHICmdList) { this->TextureRHI = this->InitializeTextureRHI(); - RHIUpdateTextureReference(TextureReferenceRHI, this->TextureRHI); + FRHICommandListImmediate::Get().UpdateTextureReference( + TextureReferenceRHI, + this->TextureRHI); #if STATS if (this->_isPrimary) { @@ -497,6 +500,38 @@ void FCesiumTextureResource::InitRHI(FRHICommandListBase& RHICmdList) { textureFlags |= TexCreate_SRGB; } +#if ENGINE_VERSION_5_5_OR_HIGHER + FRHITextureCreateDesc Desc; + if (this->_depth > 1) { + uint32 MipExtentX, MipExtentY, MipExtentZ; + CalcMipMapExtent3D( + this->_width, + this->_height, + this->_depth, + this->_format, + 0, + MipExtentX, + MipExtentY, + MipExtentZ); + + Desc = FRHITextureCreateDesc::Create3D( + TEXT("CesiumTextureUtility"), + MipExtentX, + MipExtentY, + MipExtentZ, + this->_format); + } else { + Desc = FRHITextureCreateDesc::Create2D( + TEXT("CesiumTextureUtility"), + CalcMipMapExtent(this->_width, this->_height, this->_format, 0), + this->_format); + } + + Desc.SetNumMips(this->GetCurrentMipCount()) + .SetFlags(textureFlags) + .SetInitialState(ERHIAccess::Unknown); + this->_textureSize = RHICalcTexturePlatformSize(Desc).Size; +#else const FRHIResourceCreateInfo createInfo(this->_platformExtData); uint32 alignment; @@ -535,6 +570,7 @@ void FCesiumTextureResource::InitRHI(FRHICommandListBase& RHICmdList) { createInfo, alignment); } +#endif INC_DWORD_STAT_BY(STAT_TextureMemory, this->_textureSize); INC_DWORD_STAT_FNAME_BY(this->_lodGroupStatName, this->_textureSize); @@ -550,7 +586,9 @@ void FCesiumTextureResource::ReleaseRHI() { } #endif - RHIUpdateTextureReference(TextureReferenceRHI, nullptr); + FRHICommandListImmediate::Get().UpdateTextureReference( + TextureReferenceRHI, + nullptr); FTextureResource::ReleaseRHI(); } @@ -683,10 +721,6 @@ FTextureRHIRef FCesiumCreateNewTextureResource::InitializeTextureRHI() { // debugName = UTF8_TO_TCHAR(this->_image.getUniqueAssetId().c_str()); // } - FRHIResourceCreateInfo createInfo{*debugName}; - createInfo.BulkData = nullptr; - createInfo.ExtData = _platformExtData; - ETextureCreateFlags textureFlags = TexCreate_ShaderResource; // What if a texture is treated as sRGB in one context but not another? @@ -708,22 +742,22 @@ FTextureRHIRef FCesiumCreateNewTextureResource::InitializeTextureRHI() { uint32 mipCount = FMath::Max(1, static_cast(this->_mipPositions.size())); + FRHITextureCreateDesc createDesc = + FRHITextureCreateDesc::Create2D(*debugName) + .SetExtent(int32(this->_width), int32(this->_height)) + .SetFormat(this->_format) + .SetNumMips(uint8(mipCount)) + .SetNumSamples(1) + .SetFlags(textureFlags) + .SetInitialState(ERHIAccess::Unknown) + .SetExtData(this->_platformExtData); + // Create a new RHI texture, initially empty. // RHICreateTexture2D can actually copy over all the mips in one shot, // but it expects a particular memory layout. Might be worth configuring // Cesium Native's mip-map generation to obey a standard memory layout. - FTexture2DRHIRef rhiTexture = - RHICreateTexture(FRHITextureCreateDesc::Create2D(createInfo.DebugName) - .SetExtent(int32(this->_width), int32(this->_height)) - .SetFormat(this->_format) - .SetNumMips(uint8(mipCount)) - .SetNumSamples(1) - .SetFlags(textureFlags) - .SetInitialState(ERHIAccess::Unknown) - .SetExtData(createInfo.ExtData) - .SetGPUMask(createInfo.GPUMask) - .SetClearValue(createInfo.ClearValueBinding)); + FTextureRHIRef rhiTexture = RHICreateTexture(createDesc); // Copy over all image data (including mip levels) for (uint32 i = 0; i < mipCount; ++i) { diff --git a/Source/CesiumRuntime/Public/CesiumCommon.h b/Source/CesiumRuntime/Public/CesiumCommon.h index 4d9e73e05..bc7f4e4d1 100644 --- a/Source/CesiumRuntime/Public/CesiumCommon.h +++ b/Source/CesiumRuntime/Public/CesiumCommon.h @@ -6,3 +6,9 @@ #define ENGINE_VERSION_5_5_OR_HIGHER \ (ENGINE_MAJOR_VERSION > 5 || ENGINE_MINOR_VERSION >= 5) + +#define ENGINE_VERSION_5_6_OR_HIGHER \ + (ENGINE_MAJOR_VERSION > 5 || ENGINE_MINOR_VERSION >= 6) + +#define ENGINE_VERSION_5_7_OR_HIGHER \ + (ENGINE_MAJOR_VERSION > 5 || ENGINE_MINOR_VERSION >= 7) diff --git a/Source/CesiumRuntime/Public/CesiumMaterialUserData.h b/Source/CesiumRuntime/Public/CesiumMaterialUserData.h index d0c3f6ed1..13ec1c78f 100644 --- a/Source/CesiumRuntime/Public/CesiumMaterialUserData.h +++ b/Source/CesiumRuntime/Public/CesiumMaterialUserData.h @@ -2,6 +2,7 @@ #pragma once +#include "CesiumCommon.h" #include "Engine/AssetUserData.h" #include "CesiumMaterialUserData.generated.h" @@ -22,7 +23,14 @@ class UCesiumMaterialUserData : public UAssetUserData { GENERATED_BODY() public: +#if ENGINE_VERSION_5_6_OR_HIGHER + virtual void PostEditChangeOwner( + const FPropertyChangedEvent& PropertyChangedEvent) override; +#else virtual void PostEditChangeOwner() override; +#endif + + void UpdateLayerNames(); UPROPERTY() TArray LayerNames; diff --git a/extern/cesium-native b/extern/cesium-native index ab8de592a..e876c133c 160000 --- a/extern/cesium-native +++ b/extern/cesium-native @@ -1 +1 @@ -Subproject commit ab8de592a4d42d5c78ea75e5d61c27aad462fb21 +Subproject commit e876c133c829c539553cd8f320c0b38b1c961cd2 diff --git a/extern/unreal-linux-toolchain.cmake b/extern/unreal-linux-toolchain.cmake index b52fd39af..7bebd5349 100644 --- a/extern/unreal-linux-toolchain.cmake +++ b/extern/unreal-linux-toolchain.cmake @@ -11,8 +11,33 @@ SET(CMAKE_POSITION_INDEPENDENT_CODE on) # These were deduced by scouring Unreal's LinuxToolChain.cs. SET(CMAKE_C_FLAGS "-fvisibility-ms-compat -fvisibility-inlines-hidden") -SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -nostdinc++ -I$ENV{UNREAL_ENGINE_LIBCXX_DIR}/include -I$ENV{UNREAL_ENGINE_LIBCXX_DIR}/include/c++/v1 -target x86_64-unknown-linux-gnu") -SET(CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld -target x86_64-unknown-linux-gnu --sysroot=$ENV{UNREAL_ENGINE_COMPILER_DIR} -B$ENV{UNREAL_ENGINE_COMPILER_DIR}/usr/lib -B$ENV{UNREAL_ENGINE_COMPILER_DIR}/usr/lib64 -L$ENV{UNREAL_ENGINE_COMPILER_DIR}/usr/lib -L$ENV{UNREAL_ENGINE_COMPILER_DIR}/usr/lib64 -nodefaultlibs -L$ENV{UNREAL_ENGINE_LIBCXX_DIR}/lib/Unix/x86_64-unknown-linux-gnu/ $ENV{UNREAL_ENGINE_LIBCXX_DIR}/lib/Unix/x86_64-unknown-linux-gnu/libc++.a $ENV{UNREAL_ENGINE_LIBCXX_DIR}/lib/Unix/x86_64-unknown-linux-gnu/libc++abi.a -lm -lc -lpthread -lgcc_s -lgcc") +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -nostdinc++ -target x86_64-unknown-linux-gnu") +SET(CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld -target x86_64-unknown-linux-gnu --sysroot=${CMAKE_SYSROOT} -B${CMAKE_SYSROOT}/usr/lib64 -B${CMAKE_SYSROOT}/usr/lib -L${CMAKE_SYSROOT}/usr/lib64 -L${CMAKE_SYSROOT}/usr/lib -nodefaultlibs -lm -lc -lpthread -lgcc_s -lgcc") + +# Before Unreal Engine 5.6, libcxx was found in a weird place. In 5.6, it's found in that same place, +# plus also under the regular sysroot, but trying to use the copy in the sysroot causes problems. In +# 5.7, it's only available under the regular sysroot. +# So figure out which version of UE we're building against, and set up the include/linker paths accordingly. +set(USE_LEGACY_LIBCPP OFF) +set(UNREAL_ENGINE_BUILD_VERSION_FILENAME "$ENV{UNREAL_ENGINE_ROOT}/Engine/Build/Build.version") +if(EXISTS "${UNREAL_ENGINE_BUILD_VERSION_FILENAME}") + file(READ "${UNREAL_ENGINE_BUILD_VERSION_FILENAME}" UNREAL_ENGINE_BUILD_VERSION) + string(JSON UNREAL_MAJOR_VERSION GET "${UNREAL_ENGINE_BUILD_VERSION}" "MajorVersion") + string(JSON UNREAL_MINOR_VERSION GET "${UNREAL_ENGINE_BUILD_VERSION}" "MinorVersion") + if("${UNREAL_MAJOR_VERSION}" EQUAL "5" AND "${UNREAL_MINOR_VERSION}" LESS_EQUAL "6") + # This is an older version of UE, so use the legacy location for libcxx. + set(USE_LEGACY_LIBCPP ON) + endif() +endif() + +if(USE_LEGACY_LIBCPP) + set(LEGACY_LIBCXX_ROOT "$ENV{UNREAL_ENGINE_ROOT}/Engine/Source/ThirdParty/Unix/LibCxx") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${LEGACY_LIBCXX_ROOT}/include -I${LEGACY_LIBCXX_ROOT}/include/c++/v1") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${LEGACY_LIBCXX_ROOT}/lib/Unix/x86_64-unknown-linux-gnu/ ${LEGACY_LIBCXX_ROOT}/lib/Unix/x86_64-unknown-linux-gnu/libc++.a ${LEGACY_LIBCXX_ROOT}/lib/Unix/x86_64-unknown-linux-gnu/libc++abi.a") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/include -I${CMAKE_SYSROOT}/include/c++/v1 ") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++ -lc++abi") +endif() # search for programs in the build host directories SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/extern/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch b/extern/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch deleted file mode 100644 index 71a587bd6..000000000 --- a/extern/vcpkg-overlays/ktx/0001-Use-vcpkg-zstd.patch +++ /dev/null @@ -1,122 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9a56491..d7ca937 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -345,7 +345,6 @@ set(KTX_MAIN_SRC - lib/basisu/transcoder/basisu_transcoder.cpp - lib/basisu/transcoder/basisu_transcoder.h - lib/basisu/transcoder/basisu.h -- lib/basisu/zstd/zstd.c - lib/checkheader.c - lib/dfdutils/createdfd.c - lib/dfdutils/colourspaces.c -@@ -532,7 +531,6 @@ macro(common_libktx_settings target enable_write library_type) - $ - - $ -- $ - - $ - $ -@@ -627,6 +625,11 @@ macro(common_libktx_settings target enable_write library_type) - target_compile_definitions(${target} PUBLIC KTX_FEATURE_KTX2) - endif() - -+ # Use vcpkg zstd -+ find_package(zstd CONFIG REQUIRED) -+ set(ZSTD_LIBRARIES "$,zstd::libzstd_shared,zstd::libzstd_static>") -+ target_link_libraries(${target} PRIVATE ${ZSTD_LIBRARIES}) -+ - if(WIN32) - if(MINGW) - # Check if the Threads package is provided; if using Mingw it MIGHT be -diff --git a/cmake/KtxConfig.cmake b/cmake/KtxConfig.cmake -index 6386ba2..537bf4f 100644 ---- a/cmake/KtxConfig.cmake -+++ b/cmake/KtxConfig.cmake -@@ -1,7 +1,8 @@ - # Copyright 2015-2020 The Khronos Group Inc. - # SPDX-License-Identifier: Apache-2.0 - --# include(CMakeFindDependencyMacro) --# find_dependency() -+include(CMakeFindDependencyMacro) -+find_dependency(Threads) -+find_dependency(zstd CONFIG) - - include("${CMAKE_CURRENT_LIST_DIR}/KtxTargets.cmake") -diff --git a/lib/basisu/CMakeLists.txt b/lib/basisu/CMakeLists.txt -index 492233a..152ceb5 100644 ---- a/lib/basisu/CMakeLists.txt -+++ b/lib/basisu/CMakeLists.txt -@@ -145,9 +145,6 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST} - transcoder/basisu_transcoder.cpp - ) - --if (ZSTD) -- set(BASISU_SRC_LIST ${BASISU_SRC_LIST} zstd/zstd.c) --endif() - - if (APPLE) - set(BIN_DIRECTORY "bin_osx") -@@ -165,6 +162,10 @@ else() - target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) - endif() - -+if(ZSTD_LIBRARIES) -+ target_link_libraries(basisu ${ZSTD_LIBRARIES}) -+endif() -+ - if (NOT MSVC) - # For Non-Windows builds, let cmake try and find the system OpenCL headers/libs for us. - if (OPENCL_FOUND) -diff --git a/lib/basisu/webgl/encoder/CMakeLists.txt b/lib/basisu/webgl/encoder/CMakeLists.txt -index 588d91b..a337b13 100644 ---- a/lib/basisu/webgl/encoder/CMakeLists.txt -+++ b/lib/basisu/webgl/encoder/CMakeLists.txt -@@ -34,9 +34,6 @@ if (EMSCRIPTEN) - ) - - if (KTX2_ZSTANDARD) -- set(SRC_LIST ${SRC_LIST} -- ../../zstd/zstd.c -- ) - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1) - else() - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0) -@@ -55,6 +52,10 @@ if (EMSCRIPTEN) - target_compile_options(basis_encoder.js PRIVATE -fno-strict-aliasing -O3) - - target_include_directories(basis_encoder.js PRIVATE ../../transcoder) -+ -+ if(ZSTD_LIBRARIES) -+ target_link_libraries(basis_encoder.js ${ZSTD_LIBRARIES}) -+ endif() - - set_target_properties(basis_encoder.js PROPERTIES - OUTPUT_NAME "basis_encoder" -diff --git a/lib/basisu/webgl/transcoder/CMakeLists.txt b/lib/basisu/webgl/transcoder/CMakeLists.txt -index 372653d..5ebc3cf 100644 ---- a/lib/basisu/webgl/transcoder/CMakeLists.txt -+++ b/lib/basisu/webgl/transcoder/CMakeLists.txt -@@ -28,9 +28,6 @@ if (EMSCRIPTEN) - endif() - - if (KTX2_ZSTANDARD) -- set(SRC_LIST ${SRC_LIST} -- ../../zstd/zstddeclib.c -- ) - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1) - else() - set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0) -@@ -44,6 +41,10 @@ if (EMSCRIPTEN) - target_compile_definitions(basis_transcoder.js PRIVATE NDEBUG BASISD_SUPPORT_UASTC=1 BASISD_SUPPORT_BC7=1 BASISD_SUPPORT_ATC=0 BASISD_SUPPORT_ASTC_HIGHER_OPAQUE_QUALITY=0 BASISD_SUPPORT_PVRTC2=0 BASISD_SUPPORT_FXT1=0 BASISD_SUPPORT_ETC2_EAC_RG11=0 BASISU_SUPPORT_ENCODING=0 ${KTX2_DEFINITION} ${ZSTD_DEFINITION} ) - target_compile_options(basis_transcoder.js PRIVATE -O3 -fno-strict-aliasing) - target_include_directories(basis_transcoder.js PRIVATE ../../transcoder) -+ -+ if(ZSTD_LIBRARIES) -+ target_link_libraries(basis_transcoder.js ${ZSTD_LIBRARIES}) -+ endif() - - set_target_properties(basis_transcoder.js PROPERTIES - OUTPUT_NAME "basis_transcoder" diff --git a/extern/vcpkg-overlays/ktx/0002-Fix-versioning.patch b/extern/vcpkg-overlays/ktx/0002-Fix-versioning.patch deleted file mode 100644 index 1e5098806..000000000 --- a/extern/vcpkg-overlays/ktx/0002-Fix-versioning.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/cmake/version.cmake b/cmake/version.cmake -index 4094df1a..3b2af3bb 100644 ---- a/cmake/version.cmake -+++ b/cmake/version.cmake -@@ -108,8 +108,10 @@ function(generate_version _var ) - set(${_var} "${KTX_VERSION}" PARENT_SCOPE) - endfunction() - --# Get latest tag --git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*) -+if (!KTX_VERSION_FULL) -+ # Get latest tag -+ git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*) -+endif() - #message("KTX full version: ${KTX_VERSION_FULL}") - - # generate_version(TOKTX_VERSION tools/toktx) diff --git a/extern/vcpkg-overlays/ktx/0003-mkversion.patch b/extern/vcpkg-overlays/ktx/0003-mkversion.patch deleted file mode 100644 index ee8b3c4af..000000000 --- a/extern/vcpkg-overlays/ktx/0003-mkversion.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmake/version.cmake b/cmake/version.cmake -index 9a90622..0fc3521 100644 ---- a/cmake/version.cmake -+++ b/cmake/version.cmake -@@ -176,7 +176,7 @@ function( create_version_header dest_path target ) - add_custom_command( - OUTPUT ${version_h_output} - # On Windows this command has to be invoked by a shell in order to work -- COMMAND ${BASH_EXECUTABLE} -c "\"./mkversion\" \"-o\" \"version.h\" \"${dest_path}\"" -+ COMMAND "${BASH_EXECUTABLE}" -- ./mkversion -o version.h "${dest_path}" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMENT "Generate ${version_h_output}" - VERBATIM diff --git a/extern/vcpkg-overlays/ktx/0004-quirks.patch b/extern/vcpkg-overlays/ktx/0004-quirks.patch deleted file mode 100644 index afc34236d..000000000 --- a/extern/vcpkg-overlays/ktx/0004-quirks.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1500844..810914e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -263,7 +263,7 @@ if(MSVC) - # ";" argument separator is problematic. Can't use a GenEx `$:/WX> ) -- add_compile_options( $,/Gz,/O2> ) -+ add_compile_options( $,,/O2> ) - # Enable UTF-8 support - add_compile_options( $<$:/utf-8> ) - add_compile_options( $<$:/utf-8> ) -@@ -946,6 +946,7 @@ if(EMSCRIPTEN) - endif() - - add_library( objUtil STATIC -+ EXCLUDE_FROM_ALL - utils/argparser.cpp - utils/argparser.h - utils/ktxapp.h diff --git a/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch b/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch deleted file mode 100644 index 4c900225f..000000000 --- a/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e99fb143..0f69adf7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1071,10 +1071,10 @@ endif() - if((KTX_FEATURE_TOOLS OR KTX_FEATURE_TESTS) AND NOT TARGET fmt::fmt) - set(FMT_INSTALL OFF) - set(FMT_SYSTEM_HEADERS ON) -- add_subdirectory(other_projects/fmt) -+ find_package(fmt CONFIG REQUIRED) - endif() - if(KTX_FEATURE_TOOLS AND NOT TARGET cxxopts::cxxopts) -- add_subdirectory(other_projects/cxxopts) -+ find_package(cxxopts CONFIG REQUIRED) - endif() - - # Tools diff --git a/extern/vcpkg-overlays/ktx/0006-fix-ios-install.patch b/extern/vcpkg-overlays/ktx/0006-fix-ios-install.patch deleted file mode 100644 index 0af3fea68..000000000 --- a/extern/vcpkg-overlays/ktx/0006-fix-ios-install.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e99fb143..072ea889 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -489,7 +489,7 @@ macro(common_libktx_settings target enable_write library_type) - CXX_STANDARD_REQUIRED YES - - ) -- if(IOS) -+ if(0) - set_target_properties(${target} PROPERTIES - FRAMEWORK TRUE - ) -@@ -1145,7 +1145,7 @@ endif() - # Use of this to install KHR/khr_df.h is due to CMake's failure to - # preserve the include source folder hierarchy. - # See https://gitlab.kitware.com/cmake/cmake/-/issues/16739. --if (IOS) -+if (0) - set_source_files_properties( - include/KHR/khr_df.h - PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR diff --git a/extern/vcpkg-overlays/ktx/CESIUM-0001-do-not-define-_DEBUG.patch b/extern/vcpkg-overlays/ktx/CESIUM-0001-do-not-define-_DEBUG.patch deleted file mode 100644 index ff597092c..000000000 --- a/extern/vcpkg-overlays/ktx/CESIUM-0001-do-not-define-_DEBUG.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8f0fff3..9875e97 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -505,7 +505,7 @@ macro(common_libktx_settings target enable_write library_type) - target_compile_definitions( - ${target} - PUBLIC -- "$<$:_DEBUG;DEBUG>" -+ #"$<$:_DEBUG;DEBUG>" - PRIVATE - LIBKTX - ) diff --git a/extern/vcpkg-overlays/ktx/portfile.cmake b/extern/vcpkg-overlays/ktx/portfile.cmake deleted file mode 100644 index e497f55fc..000000000 --- a/extern/vcpkg-overlays/ktx/portfile.cmake +++ /dev/null @@ -1,84 +0,0 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO KhronosGroup/KTX-Software - REF "v${VERSION}" - SHA512 0077315fe2b4e676e97e3a158c2c6e1f6ba426e14ad23342592cd69be28cfce64c40614e0a84d58a9634877ab334e713b94d4c962132c98bfea308e91bc8a98a - HEAD_REF master - PATCHES - 0001-Use-vcpkg-zstd.patch - 0002-Fix-versioning.patch - 0003-mkversion.patch - 0004-quirks.patch - 0005-no-vendored-libs.patch - 0006-fix-ios-install.patch - CESIUM-0001-do-not-define-_DEBUG.patch -) -file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h") -file(REMOVE_RECURSE "${SOURCE_PATH}/external/basisu/zstd") -file(REMOVE_RECURSE "${SOURCE_PATH}/lib/basisu/zstd") - -vcpkg_list(SET OPTIONS) -if(VCPKG_TARGET_IS_WINDOWS) - vcpkg_acquire_msys(MSYS_ROOT - PACKAGES - bash - DIRECT_PACKAGES - # Required for "getopt" - "https://repo.msys2.org/msys/x86_64/util-linux-2.40.2-2-x86_64.pkg.tar.zst" - bf45b16cd470f8d82a9fe03842a09da2e6c60393c11f4be0bab354655072c7a461afc015b9c07f9f5c87a0e382cd867e4f079ede0d42f1589aa99ebbb3f76309 - # Required for "dos2unix" - "https://mirror.msys2.org/msys/x86_64/dos2unix-7.5.2-1-x86_64.pkg.tar.zst" - e5e949f01b19c82630131e338a4642da75e42f84220f5af4a97a11dd618e363396567b233d2adab79e05422660a0000abcbbabcd17efcadf37f07fe7565f041e - ) - vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") - vcpkg_list(APPEND OPTIONS "-DBASH_EXECUTABLE=${MSYS_ROOT}/usr/bin/bash.exe") -endif() - -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC) - -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - tools KTX_FEATURE_TOOLS - vulkan KTX_FEATURE_VK_UPLOAD -) - -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - -DKTX_VERSION_FULL=v${VERSION} - -DKTX_FEATURE_TESTS=OFF - -DKTX_FEATURE_LOADTEST_APPS=OFF - -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC} - ${FEATURE_OPTIONS} - ${OPTIONS} - DISABLE_PARALLEL_CONFIGURE -) - -vcpkg_cmake_install() - -if(tools IN_LIST FEATURES) - vcpkg_copy_tools( - TOOL_NAMES - ktx - toktx - ktxsc - ktxinfo - ktx2ktx2 - ktx2check - AUTO_CLEAN - ) -else() - vcpkg_copy_pdbs() -endif() - -vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ktx) - -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") -endif() - -file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSES/*") -file(COPY ${LICENSE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSES") -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") diff --git a/extern/vcpkg-overlays/ktx/vcpkg.json b/extern/vcpkg-overlays/ktx/vcpkg.json deleted file mode 100644 index 4eb3b0a5d..000000000 --- a/extern/vcpkg-overlays/ktx/vcpkg.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "ktx", - "version-semver": "4.3.2", - "port-version": 2, - "description": [ - "The Khronos KTX library and tools.", - "Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them." - ], - "homepage": "https://github.com/KhronosGroup/KTX-Software", - "license": null, - "supports": "arm64 | x64 | !windows", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - }, - "zstd" - ], - "features": { - "tools": { - "description": "Build tools", - "supports": "!android & !uwp", - "dependencies": [ - "cxxopts", - "fmt" - ] - }, - "vulkan": { - "description": "Build Vulkan support", - "supports": "!emscripten" - } - } -} diff --git a/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake b/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake index 93f49112a..933ae1d10 100644 --- a/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake +++ b/extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake @@ -43,7 +43,10 @@ if(DEFINED ENV{CI}) file(READ "${UNREAL_ENGINE_BUILD_VERSION_FILENAME}" UNREAL_ENGINE_BUILD_VERSION) string(JSON UNREAL_MAJOR_VERSION GET "${UNREAL_ENGINE_BUILD_VERSION}" "MajorVersion") string(JSON UNREAL_MINOR_VERSION GET "${UNREAL_ENGINE_BUILD_VERSION}" "MinorVersion") - if("${UNREAL_MAJOR_VERSION}" GREATER "5" OR "${UNREAL_MINOR_VERSION}" GREATER_EQUAL "5") + if("${UNREAL_MAJOR_VERSION}" GREATER "5" OR "${UNREAL_MINOR_VERSION}" GREATER_EQUAL "7") + # This is UE 5.7+, so use MSVC 14.44. + set(VCPKG_PLATFORM_TOOLSET_VERSION "14.44") + elseif("${UNREAL_MAJOR_VERSION}" GREATER "5" OR "${UNREAL_MINOR_VERSION}" GREATER_EQUAL "5") # This is UE 5.5+, so use MSVC 14.38. set(VCPKG_PLATFORM_TOOLSET_VERSION "14.38") endif()