#Oculus Updating Oculus runtimes to 0.6, fixes up several crashes with DX11 (UE-15152, UE-15467)

[CL 2551476 by Nick Whiting in Main branch]
This commit is contained in:
Nick Whiting
2015-05-14 17:32:12 -04:00
committed by Nick.Whiting@epicgames.com
parent 501561634d
commit bf86f78d7b
41 changed files with 12768 additions and 1364 deletions

View File

@@ -16,8 +16,7 @@
{
"Name" : "OculusRift",
"Type" : "Runtime",
"WhitelistPlatforms" : [ "Win64", "Win32", "Mac" ],
"LoadingPhase" : "PostConfigInit"
"WhitelistPlatforms" : [ "Win64", "Win32", "Mac" ]
}
]
}

View File

@@ -37,7 +37,7 @@ namespace UnrealBuildTool.Rules
}
// Currently, the Rift is only supported on windows and mac platforms
if ((Target.Platform == UnrealTargetPlatform.Win32 && !WindowsPlatform.IsWindowsXPSupported()) || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac)
if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac)
{
PrivateDependencyModuleNames.AddRange(new string[] { "LibOVR", "OpenGLDrv" });
@@ -45,6 +45,14 @@ namespace UnrealBuildTool.Rules
if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
{
PrivateDependencyModuleNames.AddRange(new string[] { "D3D11RHI" });
PrivateIncludePaths.AddRange(
new string[] {
"OculusRift/Private",
"../../../../Source/Runtime/Windows/D3D11RHI/Private",
"../../../../Source/Runtime/Windows/D3D11RHI/Private/Windows",
// ... add other private include paths required here ...
}
);
}
if (Target.Platform == UnrealTargetPlatform.Mac)
{

View File

@@ -27,7 +27,6 @@ FHMDSettings::FHMDSettings() :
Flags.bYawDriftCorrectionEnabled = true;
Flags.bLowPersistenceMode = true;
Flags.bUpdateOnRT = true;
Flags.bOverdrive = true;
Flags.bMirrorToWindow = true;
Flags.bTimeWarp = true;
Flags.bHmdPosTracking = true;
@@ -130,6 +129,13 @@ FHeadMountedDisplay::FHeadMountedDisplay()
Flags.Raw = 0;
Flags.bNeedUpdateStereoRenderingParams = true;
DeltaControlRotation = FRotator::ZeroRotator; // used from ApplyHmdRotation
#if !UE_BUILD_SHIPPING
SideOfSingleCubeInMeters = 0;
SeaOfCubesVolumeSizeInMeters = 0;
NumberOfCubesInOneSide = 0;
CenterOffsetInMeters = FVector::ZeroVector; // offset from the center of 'sea of cubes'
#endif
}
bool FHeadMountedDisplay::IsInitialized() const
@@ -162,11 +168,6 @@ TSharedPtr<FHMDSettings, ESPMode::ThreadSafe> FHeadMountedDisplay::CreateNewSett
return Result;
}
// FHMDGameFrame* FHeadMountedDisplay::GetCurrentFrame()
// {
// return const_cast<FHMDGameFrame*>(const_cast<const FHeadMountedDisplay*>(this)->FHMDGameFrame());
// }
FHMDGameFrame* FHeadMountedDisplay::GetCurrentFrame() const
{
//UE_LOG(LogHMD, Log, TEXT("Getting current frame, frame number %d"), int(GFrameCounter));
@@ -403,7 +404,10 @@ bool FHeadMountedDisplay::IsStereoEnabled() const
}
else
{
return false; //@TODO?(!Flags.bFrameStarted && Settings->IsStereoEnabled());
// If IsStereoEnabled is called when a game frame hasn't started, then always return false.
// In the case when you need to check if stereo is GOING TO be enabled in next frame,
// use explicit call to Settings->IsStereoEnabled()
return false;
}
}
else
@@ -413,6 +417,11 @@ bool FHeadMountedDisplay::IsStereoEnabled() const
return false;
}
bool FHeadMountedDisplay::IsStereoEnabledOnNextFrame() const
{
return Settings->IsStereoEnabled();
}
void FHeadMountedDisplay::AdjustViewRect(EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const
{
SizeX = SizeX / 2;
@@ -888,6 +897,54 @@ void FHeadMountedDisplay::ResetControlRotation() const
}
}
void FHeadMountedDisplay::GetCurrentHMDPose(FQuat& CurrentOrientation, FVector& CurrentPosition,
bool bUseOrienationForPlayerCamera, bool bUsePositionForPlayerCamera, const FVector& PositionScale)
{
// only supposed to be used from the game thread
check(IsInGameThread());
auto frame = GetCurrentFrame();
if (!frame)
{
CurrentOrientation = FQuat::Identity;
CurrentPosition = FVector::ZeroVector;
return;
}
if (PositionScale != FVector::ZeroVector)
{
frame->CameraScale3D = PositionScale;
frame->Flags.bCameraScale3DAlreadySet = true;
}
GetCurrentPose(CurrentOrientation, CurrentPosition, bUseOrienationForPlayerCamera, bUsePositionForPlayerCamera);
if (bUseOrienationForPlayerCamera)
{
frame->LastHmdOrientation = CurrentOrientation;
frame->Flags.bOrientationChanged = bUseOrienationForPlayerCamera;
}
if (bUsePositionForPlayerCamera)
{
frame->LastHmdPosition = CurrentPosition;
frame->Flags.bPositionChanged = bUsePositionForPlayerCamera;
}
}
void FHeadMountedDisplay::GetCurrentOrientationAndPosition(FQuat& CurrentOrientation, FVector& CurrentPosition)
{
GetCurrentHMDPose(CurrentOrientation, CurrentPosition, false, false, FVector::ZeroVector);
}
FVector FHeadMountedDisplay::GetNeckPosition(const FQuat& CurrentOrientation, const FVector& CurrentPosition, const FVector& PositionScale)
{
const auto frame = GetCurrentFrame();
if (!frame)
{
return FVector::ZeroVector;
}
FVector UnrotatedPos = CurrentOrientation.Inverse().RotateVector(CurrentPosition);
UnrotatedPos.X -= frame->Settings->NeckToEyeInMeters.X * frame->WorldToMetersScale;
UnrotatedPos.Z -= frame->Settings->NeckToEyeInMeters.Y * frame->WorldToMetersScale;
return UnrotatedPos;
}
void FHeadMountedDisplay::ApplyHmdRotation(APlayerController* PC, FRotator& ViewRotation)
{
auto frame = GetCurrentFrame();
@@ -951,7 +1008,7 @@ void FHeadMountedDisplay::UpdatePlayerCameraRotation(APlayerCameraManager* Camer
#endif
FQuat CurHmdOrientation;
FVector CurHmdPosition;
GetCurrentPose(CurHmdOrientation, CurHmdPosition, true, true); // POV.bFollowHmdOrientation, POV.bFollowHmdPosition);
GetCurrentPose(CurHmdOrientation, CurHmdPosition, frame->Settings->Flags.bPlayerCameraManagerFollowsHmdOrientation, frame->Settings->Flags.bPlayerCameraManagerFollowsHmdPosition);
const FQuat CurPOVOrientation = POV.Rotation.Quaternion();
@@ -1084,11 +1141,11 @@ void FHeadMountedDisplay::DrawSeaOfCubes(UWorld* World, FVector ViewLocation)
AStaticMeshActor* SeaOfCubesActor;
SeaOfCubesActorPtr = SeaOfCubesActor = World->SpawnActor<AStaticMeshActor>(SpawnInfo);
const float cube_side_in_meters = 0.12f;
const float cube_side_in_meters = (SideOfSingleCubeInMeters == 0) ? 0.12f : SideOfSingleCubeInMeters;
const float cube_side = cube_side_in_meters * frame->Settings->WorldToMetersScale;
const float cubes_volume_in_meters = 3.2f;
const float cubes_volume_in_meters = (SeaOfCubesVolumeSizeInMeters == 0) ? 3.2f : SeaOfCubesVolumeSizeInMeters;
const float cubes_volume = cubes_volume_in_meters * frame->Settings->WorldToMetersScale;
const int num_of_cubes = 11;
const int num_of_cubes = (NumberOfCubesInOneSide == 0) ? 11 : NumberOfCubesInOneSide;
const TCHAR* const cube_resource_name = (CubeMeshName.IsEmpty()) ? TEXT("/Engine/BasicShapes/Cube.Cube") : *CubeMeshName;
const TCHAR* const cube_material_name = (CubeMaterialName.IsEmpty()) ? TEXT("/Engine/EngineMaterials/DefaultMaterial.DefaultMaterial") : *CubeMaterialName;
@@ -1117,7 +1174,7 @@ void FHeadMountedDisplay::DrawSeaOfCubes(UWorld* World, FVector ViewLocation)
const FVector box_scale(cube_side / (bounds.BoxExtent.X * 2), cube_side / (bounds.BoxExtent.Y * 2), cube_side / (bounds.BoxExtent.Z * 2));
const FVector SeaOfCubesOrigin = ViewLocation;
const FVector SeaOfCubesOrigin = ViewLocation + (CenterOffsetInMeters * frame->Settings->WorldToMetersScale);
UInstancedStaticMeshComponent* ISMComponent = NewObject<UInstancedStaticMeshComponent>();
ISMComponent->AttachTo(SeaOfCubesActor->GetStaticMeshComponent());

View File

@@ -92,12 +92,6 @@ public:
*/
uint64 bUpdateOnRT : 1;
/** Overdrive brightness transitions to reduce artifacts on DK2+ displays */
uint64 bOverdrive : 1;
/** High-quality sampling of distortion buffer for anti-aliasing */
uint64 bHQDistortion : 1;
/** Enforces headtracking to work even in non-stereo mode (for debugging or screenshots).
See 'MOTION ENFORCE' console command. */
uint64 bHeadTrackingEnforced : 1;
@@ -311,6 +305,8 @@ public:
virtual bool IsHMDEnabled() const override;
virtual void EnableHMD(bool allow = true) override;
virtual void GetCurrentOrientationAndPosition(FQuat& CurrentOrientation, FVector& CurrentPosition) override;
virtual bool DoesSupportPositionalTracking() const override;
virtual bool HasValidTrackingPosition() override;
virtual void GetPositionalTrackingCameraProperties(FVector& OutOrigin, FQuat& OutOrientation, float& OutHFOV, float& OutVFOV, float& OutCameraDistance, float& OutNearPlane, float& OutFarPlane) const override;
@@ -331,6 +327,7 @@ public:
virtual bool EnableStereo(bool stereo = true) override;
virtual bool IsStereoEnabled() const override;
virtual bool IsStereoEnabledOnNextFrame() const override;
virtual void AdjustViewRect(EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const override;
virtual void SetClippingPlanes(float NCP, float FCP) override;
@@ -350,7 +347,7 @@ public:
* @param PositionScale (in) The 3D scale that will be applied to position.
* @return The estimated neck position, calculated using NeckToEye vector from User Profile. Same coordinate space as CurrentPosition.
*/
virtual FVector GetNeckPosition(const FQuat& CurrentOrientation, const FVector& CurrentPosition, const FVector& PositionScale) { return FVector::ZeroVector; }
virtual FVector GetNeckPosition(const FQuat& CurrentOrientation, const FVector& CurrentPosition, const FVector& PositionScale);
/**
* Sets base position offset (in meters). The base position offset is the distance from the physical (0, 0, 0) position
@@ -380,6 +377,10 @@ public:
virtual void ApplyHmdRotation(APlayerController* PC, FRotator& ViewRotation) override;
virtual void UpdatePlayerCameraRotation(APlayerCameraManager*, struct FMinimalViewInfo& POV) override;
// An improved version of GetCurrentOrientationAndPostion, used from blueprints by OculusLibrary.
virtual void GetCurrentHMDPose(FQuat& CurrentOrientation, FVector& CurrentPosition,
bool bUseOrienationForPlayerCamera, bool bUsePositionForPlayerCamera, const FVector& PositionScale = FVector::ZeroVector);
protected:
virtual TSharedPtr<FHMDGameFrame, ESPMode::ThreadSafe> CreateNewGameFrame() const = 0;
virtual TSharedPtr<FHMDSettings, ESPMode::ThreadSafe> CreateNewSettings() const = 0;
@@ -463,9 +464,13 @@ protected:
}
#if !UE_BUILD_SHIPPING
TWeakObjectPtr<AStaticMeshActor> SeaOfCubesActorPtr;
TWeakObjectPtr<class AStaticMeshActor> SeaOfCubesActorPtr;
FVector CachedViewLocation;
FString CubeMeshName, CubeMaterialName;
float SideOfSingleCubeInMeters;
float SeaOfCubesVolumeSizeInMeters;
int NumberOfCubesInOneSide;
FVector CenterOffsetInMeters; // offset from the center of 'sea of cubes'
#endif
};

View File

@@ -1,8 +1,17 @@
#include "HMDPrivatePCH.h"
#include "OculusRiftHMD.h"
#if OCULUS_RIFT_SUPPORTED_PLATFORMS
#if PLATFORM_WINDOWS
// Required for OVR_CAPIShim.c
#include "AllowWindowsPlatformTypes.h"
#endif
#include <OVR_CAPIShim.c>
#if PLATFORM_WINDOWS
// It is required to undef WINDOWS_PLATFORM_TYPES_GUARD for any further D3D11 private includes
#undef WINDOWS_PLATFORM_TYPES_GUARD
#endif
#include <OVR_CAPI_Util.cpp>
#include <OVR_StereoProjection.cpp>
#endif // OCULUS_RIFT_SUPPORTED_PLATFORMS

View File

@@ -1,6 +1,9 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#if PLATFORM_MAC
#include "0.5/OculusRiftHMD_05.h"
#else
#include "IOculusRiftPlugin.h"
#include "IHeadMountedDisplay.h"
#include "HeadMountedDisplayCommon.h"
@@ -14,52 +17,25 @@
#endif
#if PLATFORM_WINDOWS
#define OVR_VISION_ENABLED
#define OVR_SDK_RENDERING
#define OVR_D3D_VERSION 11
#define OVR_GL
// #define OVR_GL
#elif PLATFORM_MAC
#define OVR_VISION_ENABLED
#define OVR_SDK_RENDERING
#define OVR_GL
#endif
#ifdef OVR_VISION_ENABLED
#ifndef OVR_CAPI_VISIONSUPPORT
#define OVR_CAPI_VISIONSUPPORT
#endif
#endif
#if OCULUS_RIFT_SUPPORTED_PLATFORMS
#include <OVR_Version.h>
#include <OVR_CAPI.h>
#include <OVR_CAPI_0_6_0.h>
#include <OVR_CAPI_Keys.h>
#include <Extras/OVR_Math.h>
#include <OVR_CAPI_Util.h>
#if PLATFORM_WINDOWS
#include "AllowWindowsPlatformTypes.h"
#endif
#ifdef OVR_SDK_RENDERING
#ifdef OVR_D3D_VERSION
#include "OVR_CAPI_D3D.h"
#endif // OVR_D3D_VERSION
#ifdef OVR_GL
#include "OVR_CAPI_GL.h"
#endif
#endif // OVR_SDK_RENDERING
#endif //OCULUS_RIFT_SUPPORTED_PLATFORMS
#if PLATFORM_SUPPORTS_PRAGMA_PACK
#pragma pack (pop)
#endif
// #ifdef UE_BUILD_DEBUG
// #undef FORCEINLINE
// #define FORCEINLINE
// #endif
struct FDistortionVertex;
class FOculusRiftHMD;
@@ -126,8 +102,6 @@ namespace OculusRift
return OVR::Recti(rect.Min.X, rect.Min.Y, rect.Size().X, rect.Size().Y);
}
typedef uint64 bool64;
class FSettings : public FHMDSettings
{
public:
@@ -137,40 +111,34 @@ public:
ovrMatrix4f EyeProjectionMatrices[2]; // 0 - left, 1 - right, same as Views
ovrMatrix4f PerspectiveProjection[2]; // used for calc ortho projection matrices
ovrFovPort EyeFov[2]; // 0 - left, 1 - right, same as Views
ovrLayer_Union EyeLayer;
FIntPoint RenderTargetSize;
float PixelDensity;
bool bQueueAheadEnabled;
unsigned SupportedTrackingCaps;
unsigned SupportedDistortionCaps;
unsigned SupportedHmdCaps;
unsigned TrackingCaps;
unsigned DistortionCaps;
unsigned HmdCaps;
#ifndef OVR_SDK_RENDERING
struct FDistortionMesh : public TSharedFromThis<FDistortionMesh>
enum MirrorWindowModeType
{
FDistortionVertex* pVertices;
uint16* pIndices;
unsigned NumVertices;
unsigned NumIndices;
unsigned NumTriangles;
eMirrorWindow_Distorted,
eMirrorWindow_Undistorted,
eMirrorWindow_SingleEye,
FDistortionMesh() :pVertices(NULL), pIndices(NULL), NumVertices(0), NumIndices(0), NumTriangles(0) {}
~FDistortionMesh() { Reset(); }
void Reset();
eMirrorWindow_Total_
};
// U,V scale and offset needed for timewarp.
ovrVector2f UVScaleOffset[2][2]; // scale UVScaleOffset[x][0], offset UVScaleOffset[x][1], where x is eye idx
TSharedPtr<FDistortionMesh> pDistortionMesh[2]; //
#endif
MirrorWindowModeType MirrorWindowMode;
FSettings();
virtual ~FSettings() override {}
virtual TSharedPtr<FHMDSettings, ESPMode::ThreadSafe> Clone() const override;
virtual void SetEyeRenderViewport(int OneEyeVPw, int OneEyeVPh) override;
float GetTexturePaddingPerEye() const { return TexturePaddingPerEye * GetActualScreenPercentage()/100.f; }
};
@@ -199,6 +167,9 @@ public:
virtual TSharedPtr<FHMDGameFrame, ESPMode::ThreadSafe> Clone() const override;
void PoseToOrientationAndPosition(const ovrPosef& InPose, FQuat& OutOrientation, FVector& OutPosition) const;
// Returns eye poses calculated from head pose. Head pose is available via ovrTrackingState.
void GetEyePoses(ovrHmd Hmd, ovrPosef outEyePoses[2], ovrTrackingState& outTrackingState) const;
};
// View extension class that contains all the rendering-specific data (also referred as 'RenderContext').
@@ -212,9 +183,11 @@ public:
virtual void PreRenderView_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneView& InView) override;
FGameFrame* GetRenderFrame() const { return static_cast<FGameFrame*>(RenderFrame.Get()); }
FSettings* GetFrameSetting() const { return static_cast<FSettings*>(RenderFrame->GetSettings()); }
FSettings* GetFrameSettings() const { return static_cast<FSettings*>(RenderFrame->GetSettings()); }
public:
class FCustomPresent* pPresentBridge;
IRendererModule* RendererModule;
ovrHmd Hmd;
ovrPosef CurEyeRenderPose[2];// most recent eye render poses
ovrPosef CurHeadPose; // current position of head
@@ -228,31 +201,47 @@ class FCustomPresent : public FRHICustomPresent
public:
FCustomPresent()
: FRHICustomPresent(nullptr)
, bNeedReinitRendererAPI(true)
, Hmd(nullptr)
, bInitialized(false)
, bNeedReAllocateTextureSet(true)
, bNeedReAllocateMirrorTexture(true)
{}
// Returns true if it is initialized and used.
bool IsInitialized() const { return bInitialized; }
virtual void BeginRendering(FHMDViewExtension& InRenderContext, const FTexture2DRHIRef& RT) = 0;
virtual void SetNeedReinitRendererAPI() { bNeedReinitRendererAPI = true; }
virtual void Reset() = 0;
virtual void Shutdown() = 0;
void UpdateViewport(const FViewport& Viewport, FRHIViewport* ViewportRHI, FGameFrame* InRenderFrame);
virtual FTexture2DRHIRef GetMirrorTexture() = 0;
virtual void UpdateViewport(const FViewport& Viewport, FRHIViewport* ViewportRHI, FGameFrame* InRenderFrame);
FGameFrame* GetRenderFrame() const { check(IsInRenderingThread()); return static_cast<FGameFrame*>(RenderContext->RenderFrame.Get()); }
FViewExtension* GetRenderContext() const { return static_cast<FViewExtension*>(RenderContext.Get()); }
FSettings* GetFrameSetting() const { check(IsInRenderingThread()); return static_cast<FSettings*>(RenderContext->RenderFrame->GetSettings()); }
virtual void SetHmd(ovrHmd InHmd) { Hmd = InHmd; }
// marking textures invalid, that will force re-allocation of ones
void MarkTexturesInvalid();
bool AreTexturesMarkedAsInvalid() const { return bNeedReAllocateTextureSet; }
// Allocates render target texture
// If returns false then a default RT texture will be used.
virtual bool AllocateRenderTargetTexture(uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, uint32 Flags, uint32 TargetableTextureFlags, FTexture2DRHIRef& OutTargetableTexture, FTexture2DRHIRef& OutShaderResourceTexture, uint32 NumSamples) = 0;
protected:
void SetRenderContext(FHMDViewExtension* InRenderContext);
protected: // data
ovrHmd Hmd;
TSharedPtr<FViewExtension, ESPMode::ThreadSafe> RenderContext;
bool bNeedReinitRendererAPI : 1;
bool bInitialized : 1;
bool bNeedReAllocateTextureSet : 1;
bool bNeedReAllocateMirrorTexture : 1;
};
} // namespace OculusRift
@@ -267,8 +256,6 @@ class FOculusRiftHMD : public FHeadMountedDisplay
friend class FViewExtension;
friend class UOculusFunctionLibrary;
public:
static void PreInit();
/** IHeadMountedDisplay interface */
virtual bool OnStartGameFrame() override;
@@ -280,10 +267,6 @@ public:
virtual bool HasValidTrackingPosition() override;
virtual void GetPositionalTrackingCameraProperties(FVector& OutOrigin, FQuat& OutOrientation, float& OutHFOV, float& OutVFOV, float& OutCameraDistance, float& OutNearPlane, float& OutFarPlane) const override;
virtual void GetCurrentOrientationAndPosition(FQuat& CurrentOrientation, FVector& CurrentPosition) override;
virtual FVector GetNeckPosition(const FQuat& CurrentOrientation, const FVector& CurrentPosition, const FVector& PositionScale) override;
virtual TSharedPtr<class ISceneViewExtension, ESPMode::ThreadSafe> GetViewExtension() override;
virtual bool Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar ) override;
@@ -291,33 +274,29 @@ public:
virtual void RecordAnalytics() override;
/** IStereoRendering interface */
virtual void RenderTexture_RenderThread(class FRHICommandListImmediate& RHICmdList, class FRHITexture2D* BackBuffer, class FRHITexture2D* SrcTexture) const override;
virtual void CalculateStereoViewOffset(const EStereoscopicPass StereoPassType, const FRotator& ViewRotation,
const float MetersToWorld, FVector& ViewLocation) override;
virtual FMatrix GetStereoProjectionMatrix(const EStereoscopicPass StereoPassType, const float FOV) const override;
virtual void GetOrthoProjection(int32 RTWidth, int32 RTHeight, float OrthoDistance, FMatrix OrthoProjection[2]) const override;
virtual void InitCanvasFromView(FSceneView* InView, UCanvas* Canvas) override;
virtual void GetEyeRenderParams_RenderThread(const struct FRenderingCompositePassContext& Context, FVector2D& EyeToSrcUVScaleValue, FVector2D& EyeToSrcUVOffsetValue) const override;
virtual void GetTimewarpMatrices_RenderThread(const struct FRenderingCompositePassContext& Context, FMatrix& EyeRotationStart, FMatrix& EyeRotationEnd) const override;
virtual void UpdateViewport(bool bUseSeparateRenderTarget, const FViewport& Viewport, SViewport*) override;
#ifdef OVR_SDK_RENDERING
virtual void CalculateRenderTargetSize(const FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) const override;
virtual bool NeedReAllocateViewportRenderTarget(const FViewport& Viewport) const override;
#endif//OVR_SDK_RENDERING
virtual void CalculateRenderTargetSize(const FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) override;
virtual bool NeedReAllocateViewportRenderTarget(const FViewport& Viewport) override;
virtual bool ShouldUseSeparateRenderTarget() const override
{
#ifdef OVR_SDK_RENDERING
check(IsInGameThread());
return IsStereoEnabled();
#else
return false;
#endif//OVR_SDK_RENDERING
}
virtual void SetupViewFamily(FSceneViewFamily& InViewFamily) override;
virtual void SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView) override;
virtual FRHICustomPresent* GetCustomPresent() override { return pCustomPresent; }
virtual uint32 GetNumberOfBufferedFrames() const override { return 1; }
virtual bool AllocateRenderTargetTexture(uint32 Index, uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, uint32 Flags, uint32 TargetableTextureFlags, FTexture2DRHIRef& OutTargetableTexture, FTexture2DRHIRef& OutShaderResourceTexture, uint32 NumSamples = 1) override;
/** Positional tracking control methods */
virtual bool IsHeadTrackingAllowed() const override;
@@ -332,9 +311,6 @@ public:
virtual void ResetOrientation(float Yaw = 0.f) override;
virtual void ResetPosition() override;
virtual void DrawDistortionMesh_RenderThread(struct FRenderingCompositePassContext& Context, const FIntPoint& TextureSize) override;
virtual void UpdatePostProcessSettings(FPostProcessSettings*) override;
virtual bool HandleInputKey(class UPlayerInput*, const FKey& Key, EInputEvent EventType, float AmountDepressed, bool bGamepad) override;
virtual void OnBeginPlay() override;
@@ -376,10 +352,6 @@ public:
virtual FString GetVersionString() const override;
// An improved version of GetCurrentOrientationAndPostion, used from blueprints by OculusLibrary.
void GetCurrentHMDPose(FQuat& CurrentOrientation, FVector& CurrentPosition,
bool bUseOrienationForPlayerCamera, bool bUsePositionForPlayerCamera, const FVector& PositionScale);
protected:
virtual TSharedPtr<FHMDGameFrame, ESPMode::ThreadSafe> CreateNewGameFrame() const override;
virtual TSharedPtr<FHMDSettings, ESPMode::ThreadSafe> CreateNewSettings() const override;
@@ -391,31 +363,42 @@ protected:
public:
#ifdef OVR_SDK_RENDERING
#if defined(OVR_D3D_VERSION) && (OVR_D3D_VERSION == 11)
class D3D11Bridge : public FCustomPresent
{
public:
D3D11Bridge();
D3D11Bridge(ovrHmd Hmd);
// Implementation of FRHICustomPresent
// Resets Viewport-specific pointers (BackBufferRT, SwapChain).
virtual void OnBackBufferResize() override;
// Returns true if Engine should perform its own Present.
virtual bool Present(int SyncInterval) override;
virtual bool Present(int32& SyncInterval) override;
// Implementation of FCustomPresent, called by Plugin itself
virtual void BeginRendering(FHMDViewExtension& InRenderContext, const FTexture2DRHIRef& RT) override;
void FinishRendering();
virtual void Reset() override;
virtual void Shutdown() override;
virtual void Shutdown() override
{
Reset();
}
virtual FTexture2DRHIRef GetMirrorTexture() override { return MirrorTextureRHI; }
virtual void SetHmd(ovrHmd InHmd) override;
virtual bool AllocateRenderTargetTexture(uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, uint32 Flags, uint32 TargetableTextureFlags, FTexture2DRHIRef& OutTargetableTexture, FTexture2DRHIRef& OutShaderResourceTexture, uint32 NumSamples);
protected:
void Init(ovrHmd InHmd);
void Reset_RenderThread();
protected: // data
ovrD3D11Config Cfg;
ovrD3D11Texture EyeTexture[2];
TRefCountPtr<class FD3D11Texture2DSet> ColorTextureSet;
TRefCountPtr<class FD3D11Texture2DSet> DepthTextureSet;
// Mirror texture
ovrTexture* MirrorTexture;
FTexture2DRHIRef MirrorTextureRHI;
};
#endif
@@ -430,7 +413,7 @@ public:
// Resets Viewport-specific resources.
virtual void OnBackBufferResize() override;
// Returns true if Engine should perform its own Present.
virtual bool Present(int SyncInterval) override;
virtual bool Present(int& SyncInterval) override;
// Implementation of FCustomPresent, called by Plugin itself
virtual void BeginRendering(FHMDViewExtension& InRenderContext, const FTexture2DRHIRef& RT) override;
@@ -446,16 +429,9 @@ public:
ovrGLTexture EyeTexture[2];
};
#endif // OVR_GL
FCustomPresent* GetActiveRHIBridgeImpl() const;
void ShutdownRendering();
#else
virtual void FinishRenderingFrame_RenderThread(FRHICommandListImmediate& RHICmdList) override;
#endif // #ifdef OVR_SDK_RENDERING
/** Constructor */
FOculusRiftHMD();
@@ -484,11 +460,8 @@ private:
*/
virtual void UpdateStereoRenderingParams() override;
virtual void UpdateHmdRenderInfo() override;
virtual void UpdateDistortionCaps() override;
virtual void UpdateHmdCaps() override;
virtual void ApplySystemOverridesOnStereo(bool force = false) override;
/**
* Called when state changes from 'stereo' to 'non-stereo'. Suppose to distribute
* the event further to user's code (?).
@@ -500,49 +473,29 @@ private:
void LoadFromIni();
void SaveToIni();
/** Saves system values before applying overrides. */
void SaveSystemValues();
/** Restores system values after overrides applied. */
void RestoreSystemValues();
void PrecalculateDistortionMesh();
class FSceneViewport* FindSceneViewport();
FGameFrame* GetFrame();
const FGameFrame* GetFrame() const;
// Copies one texture to another
void CopyTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef DstTexture, FTexture2DRHIParamRef SrcTexture, FIntRect DstRect = FIntRect(), FIntRect SrcRect = FIntRect()) const;
private: // data
ovrHmd Hmd;
TRefCountPtr<FCustomPresent>pCustomPresent;
IRendererModule* RendererModule;
ovrHmd Hmd;
union
{
struct
{
bool64 _PlaceHolder_ : 1;
uint64 _PlaceHolder_ : 1;
};
uint64 Raw;
} OCFlags;
#ifdef OVR_SDK_RENDERING
#if defined(OVR_D3D_VERSION) && (OVR_D3D_VERSION == 11)
TRefCountPtr<D3D11Bridge> pD3D11Bridge;
#endif
#if defined(OVR_GL)
TRefCountPtr<OGLBridge> pOGLBridge;
#endif
#else // !OVR_SDK_RENDERING
// this can be set and accessed only from renderthread!
TSharedPtr<FViewExtension, ESPMode::ThreadSafe> RenderContext;
//TSharedPtr<FViewExtension, ESPMode::ThreadSafe> FindRenderContext(const FSceneViewFamily& ViewFamily) const;
FGameFrame* GetRenderFrameFromContext() const;
#endif // OVR_SDK_RENDERING
void* OSWindowHandle;
FGameFrame* GetGameFrame()
{
return (FGameFrame*)(Frame.Get());
@@ -562,9 +515,7 @@ private: // data
{
return (const FSettings*)(Settings.Get());
}
public:
static bool bDirectModeHack; // a hack to allow quickly check if Oculus is in Direct mode
};
#endif //OCULUS_RIFT_SUPPORTED_PLATFORMS
#endif //#if PLATFORM_MAC

View File

@@ -0,0 +1,161 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
//
#include "HMDPrivatePCH.h"
#include "OculusRiftHMD.h"
#if !PLATFORM_MAC
#if OCULUS_RIFT_SUPPORTED_PLATFORMS
#if defined(OVR_GL)
#include "OVR_CAPI_GL.h"
#include "RendererPrivate.h"
#include "ScenePrivate.h"
#include "PostProcess/PostProcessHMD.h"
#include "ScreenRendering.h"
#include "SlateBasics.h"
//////////////////////////////////////////////////////////////////////////
FOculusRiftHMD::OGLBridge::OGLBridge() :
FCustomPresent()
{
FMemory::Memset(Cfg, 0);
FMemory::Memset(EyeTexture, 0);
}
void FOculusRiftHMD::OGLBridge::BeginRendering(FHMDViewExtension& InRenderContext, const FTexture2DRHIRef& RT)
{
SetRenderContext(&InRenderContext);
if (!bInitialized)
{
Cfg.OGL.Header.API = ovrRenderAPI_OpenGL;
bNeedReinitRendererAPI = true;
bInitialized = true;
}
if (bInitialized)
{
FGameFrame* CurrentFrame = GetRenderFrame();
check(CurrentFrame);
FSettings* FrameSettings = CurrentFrame->GetSettings();
check(FrameSettings);
bool bWinChanged = false;
#if PLATFORM_WINDOWS
HWND Window = *(HWND*)ViewportRHI->GetNativeWindow();
bWinChanged = (Cfg.OGL.Window != Window);
#elif PLATFORM_MAC
//@TODO
//NSWindow
#elif PLATFORM_LINUX
//@TODO
#endif
if (bWinChanged ||
Cfg.OGL.Header.BackBufferSize.w != CurrentFrame->ViewportSize.X ||
Cfg.OGL.Header.BackBufferSize.h != CurrentFrame->ViewportSize.Y)
{
Cfg.OGL.Header.BackBufferSize = OVR::Sizei(CurrentFrame->ViewportSize.X, CurrentFrame->ViewportSize.Y);
#if PLATFORM_WINDOWS
Cfg.OGL.Window = Window;
#elif PLATFORM_MAC
//@TODO
#elif PLATFORM_LINUX
//@TODO
// Cfg.OGL.Disp = AddParams; //?
// Cfg.OGL.Win = hWnd; //?
#endif
bNeedReinitRendererAPI = true;
}
check(IsValidRef(RT));
const uint32 RTSizeX = RT->GetSizeX();
const uint32 RTSizeY = RT->GetSizeY();
GLuint RTTexId = *(GLuint*)RT->GetNativeResource();
if ((EyeTexture[0].OGL.TexId != RTTexId ||
EyeTexture[0].OGL.Header.TextureSize.w != RTSizeX || EyeTexture[0].OGL.Header.TextureSize.h != RTSizeY))
{
EyeTexture[0].OGL.Header.API = ovrRenderAPI_OpenGL;
EyeTexture[0].OGL.Header.TextureSize = OVR::Sizei(RTSizeX, RTSizeY);
EyeTexture[0].OGL.Header.RenderViewport = ToOVRRecti(FrameSettings->EyeRenderViewport[0]);
EyeTexture[0].OGL.TexId = RTTexId;
// Right eye uses the same texture, but different rendering viewport.
EyeTexture[1] = EyeTexture[0];
EyeTexture[1].OGL.Header.RenderViewport = ToOVRRecti(FrameSettings->EyeRenderViewport[1]);
}
if (bNeedReinitRendererAPI)
{
if (!ovrHmd_ConfigureRendering(RenderContext->Hmd, &Cfg.Config, FrameSettings->DistortionCaps,
FrameSettings->EyeFov, FrameSettings->EyeRenderDesc))
{
UE_LOG(LogHMD, Warning, TEXT("OGL ovrHmd_ConfigureRenderAPI failed."));
return;
}
bNeedReinitRendererAPI = false;
}
}
}
void FOculusRiftHMD::OGLBridge::FinishRendering()
{
check(IsInRenderingThread());
check(RenderContext.IsValid());
FViewExtension* const RenderContext = GetRenderContext();
if (RenderContext->bFrameBegun)
{
// Finish the frame and let OVR do buffer swap (Present) and flush/sync.
const ovrTexture eyeTextures[2] = { EyeTexture[0].Texture, EyeTexture[1].Texture };
ovrHmd_SubmitFrameLegacy(RenderContext->Hmd, RenderContext->RenderFrame->FrameNumber, RenderContext->CurEyeRenderPose, eyeTextures); // This function will present
RenderContext->bFrameBegun = false;
}
else
{
UE_LOG(LogHMD, Warning, TEXT("Skipping frame: FinishRendering called with no corresponding BeginRendering (was BackBuffer re-allocated?)"));
}
SetRenderContext(nullptr);
}
void FOculusRiftHMD::OGLBridge::Reset()
{
check(IsInRenderingThread());
EyeTexture[0].OGL.TexId = 0;
EyeTexture[1].OGL.TexId = 0;
bNeedReinitRendererAPI = false;
bInitialized = false;
if (RenderContext.IsValid())
{
RenderContext->bFrameBegun = false;
SetRenderContext(nullptr);
}
}
void FOculusRiftHMD::OGLBridge::OnBackBufferResize()
{
bNeedReinitRendererAPI = true;
// if we are in the middle of rendering: prevent from calling EndFrame
if (RenderContext.IsValid())
{
RenderContext->bFrameBegun = false;
}
}
bool FOculusRiftHMD::OGLBridge::Present(int SyncInterval)
{
check(IsInRenderingThread());
FinishRendering();
return false; // indicates that we are presenting here, UE shouldn't do Present.
}
#endif // #if defined(OVR_GL)
#endif // OCULUS_RIFT_SUPPORTED_PLATFORMS
#endif //#if !PLATFORM_MAC

View File

@@ -34,6 +34,7 @@ FSceneViewport::FSceneViewport( FViewportClient* InViewportClient, TSharedPtr<SV
, RTTSize( 0, 0 )
, NumBufferedFrames(1)
, CurrentBufferedTargetIndex(0)
, NextBufferedTargetIndex(0)
{
bIsSlateViewport = true;
RenderThreadSlateTexture = new FSlateRenderTargetRHI(nullptr, 0, 0);
@@ -1173,8 +1174,12 @@ void FSceneViewport::EnqueueBeginRenderFrame()
{
check( IsInGameThread() );
CurrentBufferedTargetIndex = (CurrentBufferedTargetIndex + 1) % BufferedSlateHandles.Num();
RenderTargetTextureRHI = BufferedRenderTargetsRHI[CurrentBufferedTargetIndex];
CurrentBufferedTargetIndex = NextBufferedTargetIndex;
NextBufferedTargetIndex = (CurrentBufferedTargetIndex + 1) % BufferedSlateHandles.Num();
if (BufferedRenderTargetsRHI[CurrentBufferedTargetIndex])
{
RenderTargetTextureRHI = BufferedRenderTargetsRHI[CurrentBufferedTargetIndex];
}
// check if we need to reallocate rendertarget for HMD and update HMD rendering viewport
if (GEngine->StereoRenderingDevice.IsValid() && IsStereoRenderingAllowed())
@@ -1361,28 +1366,31 @@ void FSceneViewport::InitDynamicRHI()
{
NumBufferedFrames = 1;
if (GEngine->IsStereoscopic3D(this) && GEngine->StereoRenderingDevice.IsValid())
const bool bStereo = (IsStereoRenderingAllowed() && GEngine->StereoRenderingDevice.IsValid() && GEngine->StereoRenderingDevice->IsStereoEnabledOnNextFrame());
bool bUseCustomPresentTexture = false;
if (bStereo)
{
GEngine->StereoRenderingDevice->CalculateRenderTargetSize(*this, TexSizeX, TexSizeY);
//todo, get from HMD
NumBufferedFrames = 3;
NumBufferedFrames = GEngine->StereoRenderingDevice->GetNumberOfBufferedFrames();
}
check(BufferedSlateHandles.Num() == BufferedRenderTargetsRHI.Num() && BufferedSlateHandles.Num() == BufferedShaderResourceTexturesRHI.Num());
if (BufferedSlateHandles.Num() != NumBufferedFrames)
//clear existing entries
for (int32 i = 0; i < BufferedSlateHandles.Num(); ++i)
{
//clear existing entries
for (int32 i = 0; i < BufferedSlateHandles.Num(); ++i)
if (!BufferedSlateHandles[i])
{
if (!BufferedSlateHandles[i])
{
BufferedSlateHandles[i] = new FSlateRenderTargetRHI(nullptr, 0, 0);
}
BufferedRenderTargetsRHI[i] = nullptr;
BufferedShaderResourceTexturesRHI[i] = nullptr;
BufferedSlateHandles[i] = new FSlateRenderTargetRHI(nullptr, 0, 0);
}
BufferedRenderTargetsRHI[i] = nullptr;
BufferedShaderResourceTexturesRHI[i] = nullptr;
}
if (BufferedSlateHandles.Num() < NumBufferedFrames)
{
//add sufficient entires for buffering.
for (int32 i = BufferedSlateHandles.Num(); i < NumBufferedFrames; i++)
{
@@ -1391,33 +1399,48 @@ void FSceneViewport::InitDynamicRHI()
BufferedShaderResourceTexturesRHI.Add(nullptr);
}
}
else if (BufferedSlateHandles.Num() > NumBufferedFrames)
{
BufferedSlateHandles.SetNum(NumBufferedFrames);
BufferedRenderTargetsRHI.SetNum(NumBufferedFrames);
BufferedShaderResourceTexturesRHI.SetNum(NumBufferedFrames);
}
check(BufferedSlateHandles.Num() == BufferedRenderTargetsRHI.Num() && BufferedSlateHandles.Num() == BufferedShaderResourceTexturesRHI.Num());
FRHIResourceCreateInfo CreateInfo;
FTexture2DRHIRef BufferedRTRHI;
FTexture2DRHIRef BufferedSRVRHI;
for (int32 i = 0; i < NumBufferedFrames; ++i)
{
RHICreateTargetableShaderResource2D(TexSizeX, TexSizeY, PF_B8G8R8A8, 1, TexCreate_None, TexCreate_RenderTargetable, false, CreateInfo, BufferedRTRHI, BufferedSRVRHI);
// try to allocate texture via StereoRenderingDevice; if not successful, use the default way
if (!bStereo || !GEngine->StereoRenderingDevice->AllocateRenderTargetTexture(i, TexSizeX, TexSizeY, PF_B8G8R8A8, 1, TexCreate_None, TexCreate_RenderTargetable, BufferedRTRHI, BufferedSRVRHI))
{
RHICreateTargetableShaderResource2D(TexSizeX, TexSizeY, PF_B8G8R8A8, 1, TexCreate_None, TexCreate_RenderTargetable, false, CreateInfo, BufferedRTRHI, BufferedSRVRHI);
}
BufferedRenderTargetsRHI[i] = BufferedRTRHI;
BufferedShaderResourceTexturesRHI[i] = BufferedSRVRHI;
BufferedSlateHandles[i]->SetRHIRef(BufferedShaderResourceTexturesRHI[0], TexSizeX, TexSizeY);
if (BufferedSlateHandles[i])
{
BufferedSlateHandles[i]->SetRHIRef(BufferedShaderResourceTexturesRHI[0], TexSizeX, TexSizeY);
}
}
// clear out any extra entries we have hanging around
for (int32 i = NumBufferedFrames; i < BufferedSlateHandles.Num(); ++i)
{
BufferedSlateHandles[i]->SetRHIRef(nullptr, 0, 0);
if (BufferedSlateHandles[i])
{
BufferedSlateHandles[i]->SetRHIRef(nullptr, 0, 0);
}
BufferedRenderTargetsRHI[i] = nullptr;
BufferedShaderResourceTexturesRHI[i] = nullptr;
}
CurrentBufferedTargetIndex = 0;
NextBufferedTargetIndex = (CurrentBufferedTargetIndex + 1) % BufferedSlateHandles.Num();
RenderTargetTextureRHI = BufferedShaderResourceTexturesRHI[CurrentBufferedTargetIndex];
}
else
{
@@ -1431,6 +1454,7 @@ void FSceneViewport::InitDynamicRHI()
NumBufferedFrames = 1;
RenderTargetTextureRHI = nullptr;
CurrentBufferedTargetIndex = NextBufferedTargetIndex = 0;
}
//how is this useful at all? Pinning a weakptr to get a non-threadsafe shared ptr? Pinning a weakptr is supposed to be protecting me from my weakptr dying underneath me...

View File

@@ -349,6 +349,7 @@ private:
int32 NumBufferedFrames;
int32 CurrentBufferedTargetIndex;
int32 NextBufferedTargetIndex;
};

View File

@@ -10,10 +10,16 @@ class IStereoRendering
{
public:
/**
* Whether or not stereo rendering is on.
* Whether or not stereo rendering is on this frame.
*/
virtual bool IsStereoEnabled() const = 0;
/**
* Whether or not stereo rendering is on on next frame. Useful to determine if some preparation work
* should be done before stereo got enabled in next frame.
*/
virtual bool IsStereoEnabledOnNextFrame() const { return IsStereoEnabled(); }
/**
* Switches stereo rendering on / off. Returns current state of stereo.
* @return Returns current state of stereo (true / false).
@@ -66,12 +72,12 @@ public:
/**
* Calculates dimensions of the render target texture for direct rendering of distortion.
*/
virtual void CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) const {}
virtual void CalculateRenderTargetSize(const class FViewport& Viewport, uint32& InOutSizeX, uint32& InOutSizeY) {}
/**
* Returns true, if render target texture must be re-calculated.
*/
virtual bool NeedReAllocateViewportRenderTarget(const class FViewport& Viewport) const { return false; }
virtual bool NeedReAllocateViewportRenderTarget(const class FViewport& Viewport) { return false; }
// Whether separate render target should be used or not.
virtual bool ShouldUseSeparateRenderTarget() const { return false; }
@@ -117,4 +123,24 @@ public:
*/
virtual void SetClippingPlanes(float NCP, float FCP) {}
/**
* Returns currently active custom present.
*/
virtual FRHICustomPresent* GetCustomPresent() { return nullptr; }
/**
* Returns number of required buffered frames.
*/
virtual uint32 GetNumberOfBufferedFrames() const { return 3; }
/**
* Allocates a render target texture.
*
* @param Index (in) index of the buffer, changing from 0 to GetNumberOfBufferedFrames()
* @return true, if texture was allocated; false, if the default texture allocation should be used.
*/
virtual bool AllocateRenderTargetTexture(uint32 Index, uint32 SizeX, uint32 SizeY, uint8 Format, uint32 NumMips, uint32 Flags, uint32 TargetableTextureFlags, FTexture2DRHIRef& OutTargetableTexture, FTexture2DRHIRef& OutShaderResourceTexture, uint32 NumSamples = 1)
{
return false;
}
};

View File

@@ -577,6 +577,11 @@ public:
* Sets custom Present handler on the viewport
*/
virtual void SetCustomPresent(class FRHICustomPresent*) {}
/**
* Returns currently set custom present handler.
*/
virtual class FRHICustomPresent* GetCustomPresent() const { return nullptr; }
};
//
@@ -1044,8 +1049,10 @@ public:
// Called when viewport is resized.
virtual void OnBackBufferResize() = 0;
// @return true if normal Present should be performed; false otherwise.
virtual bool Present(int32 SyncInterval) = 0;
// @param InOutSyncInterval - in out param, indicates if vsync is on (>0) or off (==0).
// @return true if normal Present should be performed; false otherwise. If it returns
// true, then InOutSyncInterval could be modified to switch between VSync/NoVSync for the normal Present.
virtual bool Present(int32& InOutSyncInterval) = 0;
protected:
// Weak reference, don't create a circular dependency that would prevent the viewport from being destroyed.

View File

@@ -1247,7 +1247,7 @@ void FSceneRenderTargets::InitEditorPrimitivesDepth()
GRenderTargetPool.FindFreeElement(Desc, EditorPrimitivesDepth, TEXT("EditorPrimitivesDepth"));
}
void FSceneRenderTargets::QuantizeBufferSize(int32& InOutBufferSizeX, int32& InOutBufferSizeY) const
void FSceneRenderTargets::QuantizeBufferSize(int32& InOutBufferSizeX, int32& InOutBufferSizeY)
{
// ensure sizes are dividable by DividableBy to get post processing effects with lower resolution working well
const uint32 DividableBy = 8;

View File

@@ -106,7 +106,7 @@ END_UNIFORM_BUFFER_STRUCT( FGBufferResourceStruct )
/**
* Encapsulates the render targets used for scene rendering.
*/
class FSceneRenderTargets : public FRenderResource
class RENDERER_API FSceneRenderTargets : public FRenderResource
{
public:
/** Destructor. */
@@ -453,6 +453,13 @@ public:
TRefCountPtr<IPooledRenderTarget>& GetReflectionBrightnessTarget();
/**
* Takes the requested buffer size and quantizes it to an appropriate size for the rest of the
* rendering pipeline. Currently ensures that sizes are multiples of 8 so that they can safely
* be halved in size several times.
*/
static void QuantizeBufferSize(int32& InOutBufferSizeX, int32& InOutBufferSizeY);
private: // Get...() methods instead of direct access
// 0 before BeginRenderingSceneColor and after tone mapping in deferred shading
@@ -552,13 +559,6 @@ private:
/** to detect when LargestDesiredSizeThisFrame is outdated */
uint32 ThisFrameNumber;
/**
* Takes the requested buffer size and quantizes it to an appropriate size for the rest of the
* rendering pipeline. Currently ensures that sizes are multiples of 8 so that they can safely
* be halved in size several times.
*/
void QuantizeBufferSize(int32& InOutBufferSizeX, int32& InOutBufferSizeY) const;
/**
* Initializes the editor primitive color render target
*/
@@ -654,4 +654,4 @@ private:
};
/** The global render targets used for scene rendering. */
extern TGlobalResource<FSceneRenderTargets> GSceneRenderTargets;
extern RENDERER_API TGlobalResource<FSceneRenderTargets> GSceneRenderTargets;

View File

@@ -37,8 +37,6 @@ DECLARE_LOG_CATEGORY_EXTERN(LogD3D11RHI, Log, All);
// DX11 doesn't support higher MSAA count
#define DX_MAX_MSAA_COUNT 8
// Definitions.
#define D3D11 1
/**
* The D3D RHI stats.
@@ -265,7 +263,7 @@ struct FD3DGPUProfiler : public FGPUProfiler
};
/** The interface which is implemented by the dynamically bound RHI. */
class FD3D11DynamicRHI : public FDynamicRHI, public IRHICommandContext
class D3D11RHI_API FD3D11DynamicRHI : public FDynamicRHI, public IRHICommandContext
{
public:

Some files were not shown because too many files have changed in this diff Show More