Skip to content

Commit 4a1351d

Browse files
Merge branch 'master' into HDRP/staging
2 parents 452cd6b + a7a4b36 commit 4a1351d

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

TestProjects/UniversalGraphicsTest/Assets/Test/Runtime/UniversalGraphicsTests.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using UnityEngine.XR;
77
using UnityEngine.TestTools.Graphics;
88
using UnityEngine.SceneManagement;
9+
using UnityEngine.Rendering;
910
using UnityEngine.Rendering.Universal;
1011
using UnityEngine.Experimental.Rendering.Universal;
1112

@@ -24,9 +25,9 @@ public class UniversalGraphicsTests
2425

2526
public IEnumerator Run(GraphicsTestCase testCase)
2627
{
27-
#if ENABLE_VR && ENABLE_XR_MODULE
28+
#if ENABLE_VR
2829
// XRTODO: Fix XR tests on macOS or disable them from Yamato directly
29-
if (XRSystem.testModeEnabled && (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer))
30+
if (XRGraphicsAutomatedTests.enabled && (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer))
3031
Assert.Ignore("Universal XR tests do not run on macOS.");
3132
#endif
3233
SceneManager.LoadScene(testCase.ScenePath);
@@ -36,14 +37,14 @@ public IEnumerator Run(GraphicsTestCase testCase)
3637

3738
var cameras = GameObject.FindGameObjectsWithTag("MainCamera").Select(x=>x.GetComponent<Camera>());
3839
var settings = Object.FindObjectOfType<UniversalGraphicsTestSettings>();
39-
Assert.IsNotNull(settings, "Invalid test scene, couldn't find UniversalGraphicsTestSettings");
40+
Assert.IsNotNull(settings, "Invalid test scene, couldn't find UniversalGraphicsTestSettings");
4041

41-
#if ENABLE_VR && ENABLE_XR_MODULE
42-
if (XRSystem.testModeEnabled)
42+
#if ENABLE_VR
43+
if (XRGraphicsAutomatedTests.enabled)
4344
{
4445
if (settings.XRCompatible)
4546
{
46-
XRSystem.automatedTestRunning = true;
47+
XRGraphicsAutomatedTests.running = true;
4748
}
4849
else
4950
{
@@ -104,11 +105,11 @@ public void DumpImagesInEditor()
104105
UnityEditor.TestTools.Graphics.ResultsUtility.ExtractImagesFromTestProperties(TestContext.CurrentContext.Test);
105106
}
106107

107-
#if ENABLE_VR && ENABLE_XR_MODULE
108+
#if ENABLE_VR
108109
[TearDown]
109110
public void ResetSystemState()
110111
{
111-
XRSystem.automatedTestRunning = false;
112+
XRGraphicsAutomatedTests.running = false;
112113
}
113114
#endif
114115
#endif

com.unity.render-pipelines.universal/Runtime/ForwardRendererData.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ public sealed class ShaderResources
5353
[Reload("Runtime/Data/PostProcessData.asset")]
5454
public PostProcessData postProcessData = null;
5555

56+
#if ENABLE_VR && ENABLE_XR_MODULE
5657
[Reload("Runtime/Data/XRSystemData.asset")]
5758
public XRSystemData xrSystemData = null;
59+
#endif
5860

5961
public ShaderResources shaders = null;
6062

@@ -70,7 +72,9 @@ protected override ScriptableRenderer Create()
7072
{
7173
ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
7274
ResourceReloader.TryReloadAllNullIn(postProcessData, UniversalRenderPipelineAsset.packagePath);
75+
#if ENABLE_VR && ENABLE_XR_MODULE
7376
ResourceReloader.TryReloadAllNullIn(xrSystemData, UniversalRenderPipelineAsset.packagePath);
77+
#endif
7478
}
7579
#endif
7680
return new ForwardRenderer(this);
@@ -139,7 +143,9 @@ protected override void OnEnable()
139143
#if UNITY_EDITOR
140144
ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
141145
ResourceReloader.TryReloadAllNullIn(postProcessData, UniversalRenderPipelineAsset.packagePath);
146+
#if ENABLE_VR && ENABLE_XR_MODULE
142147
ResourceReloader.TryReloadAllNullIn(xrSystemData, UniversalRenderPipelineAsset.packagePath);
148+
#endif
143149
#endif
144150
}
145151
}

com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ static void InitializeStackedCameraData(Camera baseCamera, UniversalAdditionalCa
551551

552552
#if ENABLE_VR && ENABLE_XR_MODULE
553553
cameraData.xr = m_XRSystem.emptyPass;
554+
XRSystem.UpdateMSAALevel(msaaSamples);
554555
XRSystem.UpdateRenderScale(cameraData.renderScale);
555556
#else
556557
cameraData.xr = XRPass.emptyPass;

com.unity.render-pipelines.universal/Runtime/XR/XRSystem.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ internal partial class XRSystem
2727
Material mirrorViewMaterial = null;
2828
MaterialPropertyBlock mirrorViewMaterialProperty = new MaterialPropertyBlock();
2929

30-
// Set by test framework
31-
internal static bool automatedTestRunning = false;
32-
33-
// Used by test framework and to enable debug features
34-
static bool testModeEnabledInitialization { get => Array.Exists(Environment.GetCommandLineArgs(), arg => arg == "-xr-tests"); }
35-
internal static bool testModeEnabled = testModeEnabledInitialization;
36-
3730
RenderTexture testRenderTexture = null;
3831

3932
const string k_XRMirrorTag = "XR Mirror View";
@@ -109,7 +102,7 @@ internal int GetMaxViews()
109102
// XRTODO : replace by API from XR SDK, assume we have 2 slices until then
110103
maxViews = 2;
111104
}
112-
else if (testModeEnabled)
105+
else if (XRGraphicsAutomatedTests.enabled)
113106
{
114107
maxViews = Math.Max(maxViews, 2);
115108
}
@@ -144,7 +137,7 @@ internal List<XRPass> SetupFrame(CameraData cameraData)
144137
bool isGameCamera = (camera.cameraType == CameraType.Game || camera.cameraType == CameraType.VR);
145138
bool xrSupported = isGameCamera && camera.targetTexture == null;
146139

147-
if (testModeEnabled && automatedTestRunning && isGameCamera && LayoutSinglePassTestMode(cameraData, new XRLayout() { camera = camera, xrSystem = this }))
140+
if (XRGraphicsAutomatedTests.enabled && XRGraphicsAutomatedTests.running && isGameCamera && LayoutSinglePassTestMode(cameraData, new XRLayout() { camera = camera, xrSystem = this }))
148141
{
149142
// test layout in used
150143
}

0 commit comments

Comments
 (0)