Skip to content

Commit ec1d461

Browse files
guillaumelevassEvergreen
authored andcommitted
Upgrade SRPTests projects to GTF 9.0.0-exp.43, update test resolution to 1080p accordingly
1 parent 11e0912 commit ec1d461

17 files changed

Lines changed: 634 additions & 584 deletions

File tree

Tests/SRPTests/Packages/com.unity.testing.hdrp/TestRunner/Editor/HDRP_TestSettings_Editor.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,23 @@ override public void OnInspectorGUI()
8181
EditorGUILayout.PropertyField(containsVFX);
8282
EditorGUILayout.PropertyField(doBeforeTest);
8383

84-
if(typedTarget.ImageComparisonSettings.UseBackBuffer)
84+
string resolutionSource = "";
85+
86+
if (typedTarget.ImageComparisonSettings.UseBackBuffer)
8587
{
86-
targetResolution = GetResolutionFromBackBufferResolutionEnum(typedTarget.ImageComparisonSettings.ImageResolution.ToString());
88+
// Default to 1080p when using backbuffer
89+
targetResolution = new Vector2(1920, 1080);
90+
resolutionSource = "Backbuffer Default (1920x1080)";
8791
}
8892
else
8993
{
9094
targetResolution = new Vector2(typedTarget.ImageComparisonSettings.TargetWidth, typedTarget.ImageComparisonSettings.TargetHeight);
95+
resolutionSource = $"Target {targetResolution.x}x{targetResolution.y}";
9196
}
9297

9398
liveViewSize = GUILayout.Toggle(liveViewSize, "When enabled, Game View resolution is updated live.");
9499

95-
if (GUILayout.Button("Set Game View Size") || liveViewSize && (prevWidth != targetResolution.x || prevHeight != targetResolution.y))
100+
if (GUILayout.Button($"Set Game View Size to {resolutionSource}") || liveViewSize && (prevWidth != targetResolution.x || prevHeight != targetResolution.y))
96101
{
97102
prevWidth = (int)targetResolution.x;
98103
prevHeight = (int)targetResolution.y;

Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTestSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using UnityEngine;
12
using UnityEngine.TestTools.Graphics;
23

34
public class UniversalGraphicsTestSettings : GraphicsTestSettings
@@ -16,7 +17,7 @@ public enum RenderBackendCompatibility
1617
}
1718
public RenderBackendCompatibility renderBackendCompatibility = RenderBackendCompatibility.RenderGraphAndNonRenderGraph;
1819

19-
[UnityEngine.Tooltip("If enabled, the back buffer resolution will be set to the value specified by Image Comparison Settings -> Image Resolution, before doing the back buffer capture.")]
20+
[HideInInspector]
2021
public bool SetBackBufferResolution = false;
2122

2223
public UniversalGraphicsTestSettings()

Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Runtime/UniversalGraphicsTests.cs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public static IEnumerator RunGraphicsTest(SceneGraphicsTestCase testCase)
5353
Watermark.showDeveloperWatermark = false;
5454
GraphicsTestLogger.Log(
5555
$"Running test case '{testCase}' with scene '{testCase.ScenePath}'.");
56-
GlobalResolutionSetter.SetResolution(RuntimePlatform.Android, width: 1920, height: 1080);
57-
GlobalResolutionSetter.SetResolution(RuntimePlatform.EmbeddedLinuxArm64, width: 1920, height: 1080);
5856

5957
SceneManager.LoadScene(testCase.ScenePath);
6058

@@ -113,22 +111,20 @@ public static IEnumerator RunGraphicsTest(SceneGraphicsTestCase testCase)
113111

114112
if (settings.SetBackBufferResolution)
115113
{
116-
// Set screen/backbuffer resolution before doing the capture in ImageAssert.AreEqual. This will avoid doing
117-
// any resizing/scaling of the rendered image when comparing with the reference image in ImageAssert.AreEqual.
118-
// This has to be done before WaitForEndOfFrame, as the request will only be applied after the frame ends.
119-
int targetWidth = settings.ImageComparisonSettings.TargetWidth;
120-
int targetHeight = settings.ImageComparisonSettings.TargetHeight;
121-
Screen.SetResolution(targetWidth, targetHeight, settings.ImageComparisonSettings.UseBackBuffer ? FullScreenMode.FullScreenWindow : Screen.fullScreenMode);
122-
123-
// Yield once to finish the current frame (this code runs before the rendering in a frame) with the former
124-
// resolution.
125-
// Yield twice to finish the next frame with the new resolution taking effect.
126-
// Note that once the yields finish and the test resumes after the next for loop, the rendering will be
127-
// in the same frame where the new resolution first took place. For effects such as motion vector
128-
// rendering it means if the aspect ratio changes after setting the resolution, the previous camera matrix
129-
// will be reset, cancelling out all the camera-based motions.
130-
// In this case (e.g. UniversalGraphicsTest_Terrain, test scene 300 and 301) increase the wait frame to 3
131-
// on the UniversalGraphicsTestSettings component.
114+
//This option is disabled and we keep it only to keep the extra wait frames and preserve the existing
115+
// reference image.
116+
117+
// Changing resolution during a test run introduce instabilities.
118+
// Decides of a resolution for a test run and leave it to that. The resolution for most
119+
// test projects is set to a constant 1080p,except when running in XR compatibility mode.
120+
121+
// XR compatibility mode changes resolution depending on the target size, because the image is
122+
// always captured from the backbuffer.
123+
124+
GraphicsTestLogger.Log(LogType.Log, "Set back buffer resolution is being deprecated and does not change the resolution anymore, it only introduces extra wait frames to the test.");
125+
126+
// Removing this line causes a subset of tests to fail. Removing it would require to update images
127+
// and revisit some tests.
132128
waitFrames = Mathf.Max(waitFrames, 2);
133129
}
134130

Tests/SRPTests/Packages/com.unity.testing.xr/Runtime/ConfigureMockHMD.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ static public int SetupTest(bool xrCompatible, int waitFrames, UnityEngine.TestT
3333
Unity.XR.MockHMD.MockHMD.SetRenderMode(Unity.XR.MockHMD.MockHMDBuildSettings.RenderMode.SinglePassInstanced);
3434

3535
// Configure MockHMD to match the original settings from the test scene
36-
UnityEngine.TestTools.Graphics.ImageAssert.GetImageResolution(settings, out int w, out int h);
36+
int w = 1920;
37+
int h = 1080;
38+
39+
if(!settings.UseBackBuffer)
40+
{
41+
w = settings.TargetWidth;
42+
h = settings.TargetHeight;
43+
}
44+
3745
Unity.XR.MockHMD.MockHMD.SetEyeResolution(w, h);
3846
Unity.XR.MockHMD.MockHMD.SetMirrorViewCrop(0.0f);
3947

Tests/SRPTests/Packages/local.gtf.references/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
],
1515
"category": "Libraries",
1616
"dependencies": {
17-
"com.unity.testframework.graphics": "9.0.0-exp.33"
17+
"com.unity.testframework.graphics": "9.0.0-exp.43"
1818
}
1919
}

Tests/SRPTests/Projects/HDRP_DXR_Tests/Assets/Tests/HDRP_DXR_Graphics_Tests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ public IEnumerator Run(SceneGraphicsTestCase testCase)
9292
yield return HDRP_GraphicTestRunner.Run(testCase);
9393
}
9494

95+
[OneTimeSetUp]
96+
public void OneTimeSetUp()
97+
{
98+
// Standard resolution for backbuffer capture is 1080p
99+
Screen.SetResolution(1920, 1080, true);
100+
}
101+
95102
#if UNITY_EDITOR
96103

97104
public void Setup()
@@ -143,6 +150,8 @@ public HDRP_GRD_DXR_Graphics_Tests(GpuResidentDrawerContext grdContext)
143150
[OneTimeSetUp]
144151
public void OneTimeSetUp()
145152
{
153+
// Standard resolution for backbuffer capture is 1080p
154+
Screen.SetResolution(1920, 1080, true);
146155
SceneManager.LoadScene("GraphicsTestTransitionScene", LoadSceneMode.Single);
147156
}
148157

Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Tests/HDRP_Runtime_Graphics_Tests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ public class HDRP_Runtime_Graphics_Tests
1313
: IPrebuildSetup
1414
#endif
1515
{
16+
[OneTimeSetUp]
17+
public void SetDefaultResolution()
18+
{
19+
// Standard resolution for backbuffer capture is 1080p
20+
Screen.SetResolution(1920, 1080, true);
21+
}
22+
1623
[UnityTest]
1724
[SceneGraphicsTest(@"Assets/Scenes/^[0-9]+")]
1825
[Timeout(450 * 1000)] // Set timeout to 450 sec. to handle complex scenes with many shaders (previous timeout was 300s)
@@ -44,6 +51,11 @@ public class HDRP_Runtime_Graphics_Tests
4451
"",
4552
graphicsDeviceTypes: new GraphicsDeviceType[] { GraphicsDeviceType.Metal }
4653
)]
54+
[IgnoreGraphicsTest(
55+
"011-HighQualityLines",
56+
"https://jira.unity3d.com/browse/UUM-132442",
57+
runtimePlatforms: new RuntimePlatform[] { RuntimePlatform.Switch }
58+
)]
4759
[IgnoreGraphicsTest(
4860
"004-CloudsFlaresDecals$",
4961
"Area with cloud-coverage is blue on Intel-based MacOS (CI).",

Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Tests/HDRP_Graphics_Tests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public HDRP_Graphics_Tests(GpuResidentDrawerContext grdContext)
5454
[OneTimeSetUp]
5555
public void OneTimeSetUp()
5656
{
57+
// Standard resolution for backbuffer capture is 1080p
58+
Screen.SetResolution(1920, 1080, true);
5759
SceneManager.LoadScene("GraphicsTestTransitionScene", LoadSceneMode.Single);
5860
}
5961

Tests/SRPTests/Projects/HDRP_Tests/Assets/Tests/LightBaker/InputExtractionMaterials.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Vector4[] textureData
163163
}
164164
};
165165

166-
[Test, Category("Graphics"), GraphicsTest(TextureFormat = TextureFormat .RGBAHalf, Extension = "exr")]
166+
[Test, Category("Graphics"), GraphicsTest(TextureFormat = TextureFormat .RGBAHalf, ImageExtension = ImageExtension.EXR)]
167167
public void MetaPassTemplateTests(
168168
GraphicsTestCase testCase,
169169
[ValueSource(nameof(metaPassTests))] MetaPassSceneTest metaPassTest

0 commit comments

Comments
 (0)