Config for building for Quest
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
// @lint-ignore-every LICENSELINT
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace UnrealBuildTool.Rules
|
||||
{
|
||||
public class OculusXROpenXRHMD : ModuleRules
|
||||
{
|
||||
public OculusXROpenXRHMD(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
bUseUnity = true;
|
||||
|
||||
var EngineDir = Path.GetFullPath(Target.RelativeEnginePath);
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// Relative to Engine\Plugins\OculusXR\Source\OculusOpenXR\Source
|
||||
Path.Combine(EngineDir, "Plugins/Runtime/OpenXR/Source/OpenXRHMD/Private"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/Renderer/Private"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/OpenGLDrv/Private"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/Engine/Classes/Components"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/Engine/Classes/Kismet"),
|
||||
});
|
||||
|
||||
PublicIncludePathModuleNames.AddRange(
|
||||
new string[] {
|
||||
"Launch",
|
||||
"OpenXRHMD",
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"InputCore",
|
||||
"RHI",
|
||||
"RHICore",
|
||||
"RenderCore",
|
||||
"Renderer",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"ImageWrapper",
|
||||
"MediaAssets",
|
||||
"Analytics",
|
||||
"OpenGLDrv",
|
||||
"VulkanRHI",
|
||||
"HeadMountedDisplay",
|
||||
"OculusOpenXRLoader",
|
||||
"Projects",
|
||||
});
|
||||
|
||||
if (Target.Version.MajorVersion < 5 || (Target.Version.MajorVersion == 5 && Target.Version.MinorVersion < 3))
|
||||
{
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"OpenXRHMD",
|
||||
});
|
||||
}
|
||||
|
||||
if (Target.Version.MajorVersion > 5 || (Target.Version.MajorVersion == 5 && Target.Version.MinorVersion >= 3))
|
||||
{
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"XRBase",
|
||||
});
|
||||
}
|
||||
|
||||
if (Target.bBuildEditor == true)
|
||||
{
|
||||
PrivateDependencyModuleNames.Add("UnrealEd");
|
||||
}
|
||||
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "OpenGL");
|
||||
|
||||
if (Target.Platform == UnrealTargetPlatform.Win64)
|
||||
{
|
||||
// D3D
|
||||
{
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"D3D11RHI",
|
||||
"D3D12RHI",
|
||||
});
|
||||
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[]
|
||||
{
|
||||
Path.Combine(EngineDir, "Source/Runtime/Windows/D3D11RHI/Private"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/Windows/D3D11RHI/Private/Windows"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/D3D12RHI/Private"),
|
||||
Path.Combine(EngineDir, "Source/Runtime/D3D12RHI/Private/Windows"),
|
||||
});
|
||||
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "DX11");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "DX12");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAPI");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "DX11Audio");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "DirectSound");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAftermath");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelMetricsDiscovery");
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelExtensionsFramework");
|
||||
}
|
||||
|
||||
// Vulkan
|
||||
{
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "Vulkan");
|
||||
}
|
||||
}
|
||||
else if (Target.Platform == UnrealTargetPlatform.Android)
|
||||
{
|
||||
PrivateIncludePaths.AddRange(
|
||||
new string[]
|
||||
{
|
||||
});
|
||||
|
||||
// Vulkan
|
||||
{
|
||||
AddEngineThirdPartyPrivateStaticDependencies(Target, "Vulkan");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// @lint-ignore-every LICENSELINT
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "OculusXROpenXRHMD.h"
|
||||
#include "OpenXRCore.h"
|
||||
#include "OpenXRPlatformRHI.h"
|
||||
#include "DefaultSpectatorScreenController.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
#if PLATFORM_ANDROID
|
||||
//#include <openxr_oculus.h>
|
||||
#include <dlfcn.h>
|
||||
#endif //PLATFORM_ANDROID
|
||||
|
||||
DEFINE_LOG_CATEGORY(LogOculusOpenXRPlugin);
|
||||
|
||||
bool FOculusXROpenXRHMD::IsStandaloneStereoOnlyDevice()
|
||||
{
|
||||
#if PLATFORM_ANDROID
|
||||
const bool bIsStandaloneStereoDevice = FAndroidMisc::GetDeviceMake() == FString("Oculus");
|
||||
#else
|
||||
const bool bIsStandaloneStereoDevice = false;
|
||||
#endif
|
||||
return bIsStandaloneStereoDevice;
|
||||
}
|
||||
|
||||
bool FOculusXROpenXRHMD::GetRequiredExtensions(TArray<const ANSICHAR*>& OutExtensions)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FOculusXROpenXRHMD::GetInteractionProfile(XrInstance InInstance, FString& OutKeyPrefix, XrPath& OutPath, bool& OutHasHaptics)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR GetInteractionProfile"));
|
||||
return false; // if you return true, make sure OutPath and OutHasHaptics are initialized
|
||||
}
|
||||
|
||||
bool FOculusXROpenXRHMD::GetSpectatorScreenController(FHeadMountedDisplayBase* InHMDBase, TUniquePtr<FDefaultSpectatorScreenController>& OutSpectatorScreenController)
|
||||
{
|
||||
#if PLATFORM_ANDROID
|
||||
OutSpectatorScreenController = nullptr;
|
||||
return true;
|
||||
#else // PLATFORM_ANDROID
|
||||
OutSpectatorScreenController = MakeUnique<FDefaultSpectatorScreenController>(InHMDBase);
|
||||
return false;
|
||||
#endif // PLATFORM_ANDROID
|
||||
}
|
||||
|
||||
void FOculusXROpenXRHMD::AddActions(XrInstance Instance, TFunction<XrAction(XrActionType InActionType, const FName& InName, const TArray<XrPath>& InSubactionPaths)> AddAction)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR AddActions"));
|
||||
return;
|
||||
}
|
||||
|
||||
void FOculusXROpenXRHMD::OnEvent(XrSession InSession, const XrEventDataBaseHeader* InHeader)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnCreateInstance(class IOpenXRHMDModule* InModule, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnCreateInstance"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnGetSystem(XrInstance InInstance, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnGetSystem"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnCreateSession(XrInstance InInstance, XrSystemId InSystem, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnCreateSession"));
|
||||
#if PLATFORM_ANDROID
|
||||
if (GRHISupportsRHIThread && GIsThreadedRendering && GUseRHIThread_InternalUseOnly)
|
||||
{
|
||||
SetRHIThreadEnabled(false, false);
|
||||
}
|
||||
#endif // PLATFORM_ANDROID
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnBeginSession(XrSession InSession, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnBeginSession"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnBeginFrame(XrSession InSession, XrTime DisplayTime, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnBeginFrame"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnBeginProjectionView(XrSession InSession, int32 InLayerIndex, int32 InViewIndex, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnBeginProjectionView"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnBeginDepthInfo(XrSession InSession, int32 InLayerIndex, int32 InViewIndex, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnBeginDepthInfo"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnEndProjectionLayer(XrSession InSession, int32 InLayerIndex, const void* InNext, XrCompositionLayerFlags& OutFlags)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnEndProjectionLayer"));
|
||||
|
||||
// XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT is required right now because the Oculus mobile runtime blends using alpha otherwise,
|
||||
// and we don't have proper inverse alpha support in OpenXR yet (once OpenXR supports inverse alpha, or we change the runtime behavior, remove this)
|
||||
OutFlags |= XR_COMPOSITION_LAYER_CORRECT_CHROMATIC_ABERRATION_BIT;
|
||||
OutFlags |= XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT;
|
||||
|
||||
return InNext;
|
||||
}
|
||||
|
||||
#if UE_VERSION_OLDER_THAN(5, 3, 0)
|
||||
const void* FOculusXROpenXRHMD::OnEndFrame(XrSession InSession, XrTime DisplayTime, const TArray<XrSwapchainSubImage> InColorImages, const TArray<XrSwapchainSubImage> InDepthImages, const void* InNext)
|
||||
#else
|
||||
const void* FOculusXROpenXRHMD::OnEndFrame(XrSession InSession, XrTime DisplayTime, const void* InNext)
|
||||
#endif
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnEndFrame"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
const void* FOculusXROpenXRHMD::OnSyncActions(XrSession InSession, const void* InNext)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR OnSyncActions"));
|
||||
return InNext;
|
||||
}
|
||||
|
||||
void FOculusXROpenXRHMD::PostSyncActions(XrSession InSession)
|
||||
{
|
||||
//UE_LOG(LogOculusOpenXRPlugin, Log, TEXT("Oculus OpenXR PostSyncActions"));
|
||||
return;
|
||||
}
|
||||
|
||||
IMPLEMENT_MODULE(FOculusXROpenXRHMD, OculusXROpenXRHMD)
|
||||
@@ -0,0 +1,61 @@
|
||||
// @lint-ignore-every LICENSELINT
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
#include "IOculusXROpenXRHMDPlugin.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogOculusOpenXRPlugin, Log, All);
|
||||
|
||||
class FOculusXROpenXRHMD : public IOculusXROpenXRHMDPlugin
|
||||
{
|
||||
private:
|
||||
void* LoaderHandle;
|
||||
|
||||
public:
|
||||
FOculusXROpenXRHMD()
|
||||
: LoaderHandle(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~FOculusXROpenXRHMD()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void StartupModule() override
|
||||
{
|
||||
RegisterOpenXRExtensionModularFeature();
|
||||
}
|
||||
|
||||
virtual void ShutdownModule() override
|
||||
{
|
||||
if (LoaderHandle)
|
||||
{
|
||||
FPlatformProcess::FreeDllHandle(LoaderHandle);
|
||||
LoaderHandle = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool IsStandaloneStereoOnlyDevice() override;
|
||||
virtual bool GetRequiredExtensions(TArray<const ANSICHAR*>& OutExtensions) override;
|
||||
virtual bool GetInteractionProfile(XrInstance InInstance, FString& OutKeyPrefix, XrPath& OutPath, bool& OutHasHaptics) override;
|
||||
virtual bool GetSpectatorScreenController(FHeadMountedDisplayBase* InHMDBase, TUniquePtr<FDefaultSpectatorScreenController>& OutSpectatorScreenController) override;
|
||||
virtual void AddActions(XrInstance Instance, TFunction<XrAction(XrActionType InActionType, const FName& InName, const TArray<XrPath>& InSubactionPaths)> AddAction) override;
|
||||
virtual void OnEvent(XrSession InSession, const XrEventDataBaseHeader* InHeader) override;
|
||||
virtual const void* OnCreateInstance(class IOpenXRHMDModule* InModule, const void* InNext) override;
|
||||
virtual const void* OnGetSystem(XrInstance InInstance, const void* InNext) override;
|
||||
virtual const void* OnCreateSession(XrInstance InInstance, XrSystemId InSystem, const void* InNext) override;
|
||||
virtual const void* OnBeginSession(XrSession InSession, const void* InNext) override;
|
||||
virtual const void* OnBeginFrame(XrSession InSession, XrTime DisplayTime, const void* InNext) override;
|
||||
virtual const void* OnBeginProjectionView(XrSession InSession, int32 InLayerIndex, int32 InViewIndex, const void* InNext) override;
|
||||
virtual const void* OnBeginDepthInfo(XrSession InSession, int32 InLayerIndex, int32 InViewIndex, const void* InNext) override;
|
||||
virtual const void* OnEndProjectionLayer(XrSession InSession, int32 InLayerIndex, const void* InNext, XrCompositionLayerFlags& OutFlags) override;
|
||||
#if UE_VERSION_OLDER_THAN(5, 3, 0)
|
||||
virtual const void* OnEndFrame(XrSession InSession, XrTime DisplayTime, const TArray<XrSwapchainSubImage> InColorImages, const TArray<XrSwapchainSubImage> InDepthImages, const void* InNext) override;
|
||||
#else
|
||||
virtual const void* OnEndFrame(XrSession InSession, XrTime DisplayTime, const void* InNext) override;
|
||||
#endif
|
||||
virtual const void* OnSyncActions(XrSession InSession, const void* InNext) override;
|
||||
virtual void PostSyncActions(XrSession InSession) override;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
// @lint-ignore-every LICENSELINT
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
#include "IOpenXRExtensionPlugin.h"
|
||||
|
||||
class IOculusXROpenXRHMDPlugin : public IOpenXRExtensionPlugin, public IModuleInterface
|
||||
{
|
||||
};
|
||||
Reference in New Issue
Block a user