浏览代码

Merge pull request #1731 from Unity-Technologies/xrsettings

Removed XRSettings usage from HDRP. Protected XR usage in XRGraphicsConfig with ifdefs.
/main
GitHub 6 年前
当前提交
ae4294ea
共有 4 个文件被更改,包括 46 次插入22 次删除
  1. 46
      com.unity.render-pipelines.core/CoreRP/Common/XRGraphicsConfig.cs
  2. 9
      com.unity.render-pipelines.high-definition/HDRP/Camera/HDCamera.cs
  3. 6
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  4. 7
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/Settings/FrameSettings.cs

46
com.unity.render-pipelines.core/CoreRP/Common/XRGraphicsConfig.cs


using System;
using UnityEditor;
using UnityEngine.XR;
#if UNITY_2017_2_OR_NEWER
using UnityEngine.XR;
using XRSettings = UnityEngine.XR.XRSettings;
#elif UNITY_5_6_OR_NEWER
using UnityEngine.VR;
using XRSettings = UnityEngine.VR.VRSettings;
#endif
namespace UnityEngine.Experimental.Rendering
{

public float occlusionMaskScale;
public bool showDeviceView;
public GameViewRenderMode gameViewRenderMode;
public void SetConfig()
{ // If XR is enabled, sets XRSettings from our saved config
if (!enabled)

return false;
#endif
}
}
}
#if UNITY_EDITOR
// FIXME: We should probably have StereoREnderingPath defined in UnityEngine.XR, not UnityEditor...
public static StereoRenderingPath stereoRenderingMode
{
get
{
if (!enabled)
Assert.IsFalse(enabled);
#if UNITY_2018_3_OR_NEWER
return (StereoRenderingPath)XRSettings.stereoRenderingMode;
#else
if (eyeTextureDesc.vrUsage == VRTextureUsage.TwoEyes)
return StereoRenderingPath.SinglePass;
else if (eyeTextureDesc.dimension == UnityEngine.Rendering.TextureDimension.Tex2DArray)
return StereoRenderingPath.Instancing;
else
return StereoRenderingPath.MultiPass;
#endif
}
}
#endif
public static RenderTextureDescriptor eyeTextureDesc
{
get

}
}
public static string[] supportedDevices
public static int eyeTextureWidth
{
get
{
if (!enabled)
Assert.IsFalse(enabled);
return XRSettings.eyeTextureWidth;
}
}
public static int eyeTextureHeight
return XRSettings.supportedDevices;
return XRSettings.eyeTextureHeight;
}
}
}

9
com.unity.render-pipelines.high-definition/HDRP/Camera/HDCamera.cs


using System.Collections.Generic;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.XR;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

m_ActualHeight = camera.pixelHeight;
var screenWidth = m_ActualWidth;
var screenHeight = m_ActualHeight;
#if !UNITY_SWITCH
screenWidth = XRSettings.eyeTextureWidth;
screenHeight = XRSettings.eyeTextureHeight;
screenWidth = XRGraphicsConfig.eyeTextureWidth;
screenHeight = XRGraphicsConfig.eyeTextureHeight;
var xrDesc = XRSettings.eyeTextureDesc;
var xrDesc = XRGraphicsConfig.eyeTextureDesc;
#endif
// Unfortunately sometime (like in the HDCameraEditor) HDUtils.hdrpSettings can be null because of scripts that change the current pipeline...
m_msaaSamples = HDUtils.hdrpSettings != null ? HDUtils.hdrpSettings.msaaSampleCount : MSAASamples.None;

6
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


using System.Linq;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.XR;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

return false;
}
#if !UNITY_SWITCH
if (XRSettings.isDeviceActive)
if (XRGraphicsConfig.enabled)
#endif
return true;
}

7
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/Settings/FrameSettings.cs


using System;
using System.Collections.Generic;
using UnityEngine.XR;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline

// Planar and real time cubemap doesn't need post process and render in FP16
aggregate.enablePostprocess = camera.cameraType != CameraType.Reflection && srcFrameSettings.enablePostprocess;
#if UNITY_SWITCH
aggregate.enableStereo = false;
#else
aggregate.enableStereo = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableStereo && XRSettings.isDeviceActive && (camera.stereoTargetEye == StereoTargetEyeMask.Both) && renderPipelineSettings.supportStereo;
#endif
aggregate.enableStereo = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableStereo && XRGraphicsConfig.enabled && (camera.stereoTargetEye == StereoTargetEyeMask.Both);
aggregate.enableAsyncCompute = srcFrameSettings.enableAsyncCompute && SystemInfo.supportsAsyncCompute;

正在加载...
取消
保存