Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit bb72c8e

Browse files
XR settings commented out for Switch.
1 parent 1f012b0 commit bb72c8e

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

PostProcessing/Runtime/PostProcessDebug.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public sealed class PostProcessDebug : MonoBehaviour
1616

1717
Camera m_CurrentCamera;
1818
CommandBuffer m_CmdAfterEverything;
19-
19+
2020
void OnEnable()
2121
{
2222
m_CmdAfterEverything = new CommandBuffer { name = "Post-processing Debug Overlay" };
@@ -41,7 +41,7 @@ void OnDisable()
4141
m_CurrentCamera = null;
4242
m_PreviousPostProcessLayer = null;
4343
}
44-
44+
4545
#if !UNITY_EDITOR
4646
void Update()
4747
{
@@ -103,6 +103,9 @@ void OnGUI()
103103
if (postProcessLayer == null || !postProcessLayer.enabled)
104104
return;
105105

106+
// Some SRPs don't unbind render targets and leave them as-is
107+
RenderTexture.active = null;
108+
106109
var rect = new Rect(5, 5, 0, 0);
107110
var debugLayer = postProcessLayer.debugLayer;
108111
DrawMonitor(ref rect, debugLayer.lightMeter, lightMeter);

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using UnityEngine.Assertions;
@@ -279,12 +279,14 @@ void OnPreCull()
279279
m_Camera.ResetProjectionMatrix();
280280
m_Camera.nonJitteredProjectionMatrix = m_Camera.projectionMatrix;
281281

282+
#if !UNITY_SWITCH
282283
if (m_Camera.stereoEnabled)
283284
{
284285
m_Camera.ResetStereoProjectionMatrices();
285286
Shader.SetGlobalFloat(ShaderIDs.RenderViewportScaleFactor, XRSettings.renderViewportScale);
286287
}
287288
else
289+
#endif
288290
{
289291
Shader.SetGlobalFloat(ShaderIDs.RenderViewportScaleFactor, 1.0f);
290292
}

PostProcessing/Runtime/PostProcessRenderContext.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22

33
namespace UnityEngine.Rendering.PostProcessing
44
{
@@ -23,6 +23,7 @@ public Camera camera
2323
{
2424
m_Camera = value;
2525

26+
#if !UNITY_SWITCH
2627
if (m_Camera.stereoEnabled)
2728
{
2829
#if UNITY_2017_2_OR_NEWER
@@ -48,6 +49,7 @@ public Camera camera
4849
stereoActive = true;
4950
}
5051
else
52+
#endif
5153
{
5254
width = m_Camera.pixelWidth;
5355
height = m_Camera.pixelHeight;

PostProcessing/Runtime/Utils/RuntimeUtilities.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Linq.Expressions;
@@ -258,6 +258,8 @@ public static bool isSinglePassStereoEnabled
258258
{
259259
#if UNITY_EDITOR
260260
return isSinglePassStereoSelected && Application.isPlaying;
261+
#elif UNITY_SWITCH
262+
return false;
261263
#elif UNITY_2017_2_OR_NEWER
262264
return UnityEngine.XR.XRSettings.eyeTextureDesc.vrUsage == VRTextureUsage.TwoEyes;
263265
#else
@@ -272,7 +274,7 @@ public static bool isVREnabled
272274
{
273275
#if UNITY_EDITOR
274276
return UnityEditor.PlayerSettings.virtualRealitySupported;
275-
#elif UNITY_XBOXONE
277+
#elif UNITY_XBOXONE || UNITY_SWITCH
276278
return false;
277279
#elif UNITY_2017_2_OR_NEWER
278280
return UnityEngine.XR.XRSettings.enabled;

PostProcessing/Shaders/StdLib.hlsl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Because this framework is supposed to work with the legacy render pipelines AND scriptable render
1+
// Because this framework is supposed to work with the legacy render pipelines AND scriptable render
22
// pipelines we can't use Unity's shader libraries (some scriptable pipelines come with their own
33
// shader lib). So here goes a minimal shader lib only used for post-processing to ensure good
44
// compatibility with all pipelines.
@@ -19,8 +19,10 @@
1919
#include "API/D3D12.hlsl"
2020
#elif defined(SHADER_API_D3D9) || defined(SHADER_API_D3D11_9X)
2121
#include "API/D3D9.hlsl"
22-
#elif defined(SHADER_API_VULKAN) || defined(SHADER_API_SWITCH)
22+
#elif defined(SHADER_API_VULKAN)
2323
#include "API/Vulkan.hlsl"
24+
#elif defined(SHADER_API_SWITCH)
25+
#include "API/Switch.hlsl"
2426
#elif defined(SHADER_API_METAL)
2527
#include "API/Metal.hlsl"
2628
#else

0 commit comments

Comments
 (0)