You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- RHISupportsMultiviewport made to work on relevant shader platforms. - RHISetStereoViewport implemented - Unused outputs removal fixed to always consider viewport index used. - Renamed confusing terminology (multiview -> multiviewport). - Added a CVar (vr.MultiViewport) to force disable - Added a canvas output to know the method in non-Shipping #jira UE-151349 #review @Robert.Srinivasiah, @Jules.Blok, @JeanNoe.Morissette #rb Robert.Srinivasiah, Jules.Blok, Chris.Waters #preflight 62d193c43b057e727491c9d2 [CL 21153050 by Arciel Rekman in ue5-main branch]
57 lines
2.3 KiB
C++
57 lines
2.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "StereoRenderUtils.h"
|
|
#include "RenderUtils.h"
|
|
|
|
namespace UE::StereoRenderUtils
|
|
{
|
|
|
|
RENDERCORE_API FStereoShaderAspects::FStereoShaderAspects(EShaderPlatform Platform) :
|
|
bInstancedStereoEnabled(false)
|
|
, bMobileMultiViewEnabled(false)
|
|
, bInstancedMultiViewportEnabled(false)
|
|
, bInstancedStereoNative(false)
|
|
, bMobileMultiViewNative(false)
|
|
, bMobileMultiViewFallback(false)
|
|
{
|
|
check(Platform < EShaderPlatform::SP_NumPlatforms);
|
|
|
|
// Would be nice to use URendererSettings, but not accessible in RenderCore
|
|
static FShaderPlatformCachedIniValue<bool> CVarInstancedStereo(TEXT("vr.InstancedStereo"));
|
|
static FShaderPlatformCachedIniValue<bool> CVarMobileMultiView(TEXT("vr.MobileMultiView"));
|
|
static FShaderPlatformCachedIniValue<bool> CVarMultiViewport(TEXT("vr.MultiViewport"));
|
|
static FShaderPlatformCachedIniValue<bool> CVarMobileHDR(TEXT("r.MobileHDR"));
|
|
|
|
const bool bInstancedStereo = CVarInstancedStereo.Get(Platform);
|
|
|
|
const bool bMobilePlatform = IsMobilePlatform(Platform);
|
|
const bool bMobilePostprocessing = CVarMobileHDR.Get(Platform);
|
|
const bool bMobileMultiView = CVarMobileMultiView.Get(Platform);
|
|
const bool bMultiViewport = CVarMultiViewport.Get(Platform);
|
|
|
|
bInstancedStereoNative = !bMobilePlatform && bInstancedStereo && RHISupportsInstancedStereo(Platform);
|
|
|
|
const bool bMobileMultiViewCoreSupport = bMobilePlatform && bMobileMultiView && !bMobilePostprocessing;
|
|
if (bMobileMultiViewCoreSupport)
|
|
{
|
|
if (RHISupportsMobileMultiView(Platform))
|
|
{
|
|
bMobileMultiViewNative = true;
|
|
}
|
|
else if (RHISupportsInstancedStereo(Platform))
|
|
{
|
|
bMobileMultiViewFallback = true;
|
|
}
|
|
}
|
|
|
|
bInstancedStereoEnabled = bInstancedStereoNative || bMobileMultiViewFallback;
|
|
bInstancedMultiViewportEnabled = bInstancedStereoNative && bMultiViewport && GRHISupportsArrayIndexFromAnyShader && RHISupportsMultiViewport(Platform);
|
|
bMobileMultiViewEnabled = bMobileMultiViewNative || bMobileMultiViewFallback;
|
|
}
|
|
|
|
RENDERCORE_API bool FStereoShaderAspects::IsInstancedStereoEnabled() const { return bInstancedStereoEnabled; }
|
|
RENDERCORE_API bool FStereoShaderAspects::IsMobileMultiViewEnabled() const { return bMobileMultiViewEnabled; }
|
|
RENDERCORE_API bool FStereoShaderAspects::IsInstancedMultiViewportEnabled() const { return bInstancedMultiViewportEnabled; }
|
|
|
|
} // namespace UE::RenderUtils
|