浏览代码

Fix scenes list handling for playmode tests

Fix non deterministic behaviour of playmode tests
/main
Remy 7 年前
当前提交
472cdbf4
共有 16 个文件被更改,包括 2684 次插入3604 次删除
  1. 270
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity.png
  2. 576
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3003_CameraMotionVector_TranslateX.unity.png
  3. 170
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3004_CameraMotionVector_TranslateY.unity.png
  4. 999
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3005_CameraMotionVector_TranslateZ.unity.png
  5. 999
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3006_CameraMotionVector_RotateX.unity.png
  6. 999
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3007_CameraMotionVector_RotateY.unity.png
  7. 999
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3008_CameraMotionVector_RotateZ.unity.png
  8. 999
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3009_CameraMotionVector_FOV.unity.png
  9. 184
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity
  10. 8
      Tests/Scripts/GraphicTests/Framework/SetupSceneForRenderPipelineTest.cs
  11. 38
      Tests/Scripts/GraphicTests/Framework/TestFrameworkPlayMode.cs
  12. 3
      Tests/Scripts/GraphicTests/HDRenderPipeline/SinMove.cs
  13. 5
      Tests/Scripts/GraphicTests/HDRenderPipeline/SinRotate.cs
  14. 3
      Tests/Scripts/GraphicTests/HDRenderPipeline/Sin_ChangeFOV.cs
  15. 25
      Tests/Scripts/GraphicTests/HDRenderPipeline/SinScale.cs
  16. 11
      Tests/Scripts/GraphicTests/HDRenderPipeline/SinScale.cs.meta

270
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity.png
文件差异内容过多而无法显示
查看文件

576
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3003_CameraMotionVector_TranslateX.unity.png

之前 之后
宽度: 853  |  高度: 480  |  大小: 137 KiB

170
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3004_CameraMotionVector_TranslateY.unity.png

之前 之后
宽度: 853  |  高度: 480  |  大小: 119 KiB

999
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3005_CameraMotionVector_TranslateZ.unity.png
文件差异内容过多而无法显示
查看文件

999
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3006_CameraMotionVector_RotateX.unity.png
文件差异内容过多而无法显示
查看文件

999
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3007_CameraMotionVector_RotateY.unity.png
文件差异内容过多而无法显示
查看文件

999
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3008_CameraMotionVector_RotateZ.unity.png
文件差异内容过多而无法显示
查看文件

999
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3009_CameraMotionVector_FOV.unity.png
文件差异内容过多而无法显示
查看文件

184
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity


m_Script: {fileID: 11500000, guid: c413a5df32c4fec4eb320c4465678193, type: 3}
m_Name:
m_EditorClassIdentifier:
localSpace: 0
fps: 60
--- !u!23 &12769661
MeshRenderer:
m_ObjectHideFlags: 0

m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &29872219
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 29872223}
- component: {fileID: 29872222}
- component: {fileID: 29872221}
- component: {fileID: 29872220}
m_Layer: 0
m_Name: Rotate
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &29872220
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 29872219}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 14d7896b83927c247821fa13f452106f, type: 3}
m_Name:
m_EditorClassIdentifier:
localSpace: 0
angles: {x: 0, y: 0, z: 90}
frequency: 5
fps: 60
--- !u!23 &29872221
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 29872219}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 051804eacb0bc2144a9e96128a428a15, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &29872222
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 29872219}
m_Mesh: {fileID: 4300000, guid: b32e17769a31e9c4c8b3176dcb04dea9, type: 3}
--- !u!4 &29872223
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 29872219}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.5, y: -3, z: 0}
m_LocalScale: {x: 2, y: 1.9999996, z: 1.9999996}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &176131434
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: c413a5df32c4fec4eb320c4465678193, type: 3}
m_Name:
m_EditorClassIdentifier:
localSpace: 0
fps: 60
--- !u!23 &176131436
MeshRenderer:
m_ObjectHideFlags: 0

m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &764440502
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 764440506}
- component: {fileID: 764440505}
- component: {fileID: 764440504}
- component: {fileID: 764440503}
m_Layer: 0
m_Name: Scale
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &764440503
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 764440502}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 382c9a87993196d4596a688b68b60221, type: 3}
m_Name:
m_EditorClassIdentifier:
min: {x: 1.5, y: 1.5, z: 1.5}
max: {x: 3, y: 3, z: 3}
frequency: 5
fps: 60
--- !u!23 &764440504
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 764440502}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 051804eacb0bc2144a9e96128a428a15, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &764440505
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 764440502}
m_Mesh: {fileID: 4300000, guid: b32e17769a31e9c4c8b3176dcb04dea9, type: 3}
--- !u!4 &764440506
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 764440502}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -7, y: -3, z: 0}
m_LocalScale: {x: 2, y: 1.9999996, z: 1.9999996}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1243403287
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: c413a5df32c4fec4eb320c4465678193, type: 3}
m_Name:
m_EditorClassIdentifier:
localSpace: 0
fps: 60
--- !u!23 &1243403289
MeshRenderer:
m_ObjectHideFlags: 0

- target: {fileID: 114733060649624252, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: waitForFrames
value: 15
value: 29
objectReference: {fileID: 0}
- target: {fileID: 114733060649624252, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}

8
Tests/Scripts/GraphicTests/Framework/SetupSceneForRenderPipelineTest.cs


bool _readyForCapture = false;
public bool readyForCapture { get { return _readyForCapture; } }
public IEnumerator Start()
{
// Wait for other things to happend, in particular allow for the render pipeline to reset
yield return new WaitForEndOfFrame();
Time.captureFramerate = forcedFrameRate;
}
public void Update()
{
if ( waitedFrames < waitForFrames )

38
Tests/Scripts/GraphicTests/Framework/TestFrameworkPlayMode.cs


using System.IO;
using System.Linq;
public class GraphicTestsPlayMode : IPrebuildSetup, IPostBuildCleanup
public class GraphicTestsPlayMode : IPrebuildSetup
{
public virtual string pipelineID { get { return "NoPipeline"; } }

Debug.Log("Setup for the test");
#if UNITY_EDITOR
oldScenes = UnityEditor.EditorBuildSettings.scenes;

#endif
}
[OneTimeTearDown]
//UnityEditor.EditorBuildSettings.scenes = oldScenes;
UnityEditor.EditorBuildSettings.scenes = oldScenes;
//public IEnumerator TestScene([ValueSource(typeof(TestFrameworkTools.CollectScenesPlayMode), "HDRP")]TestFrameworkTools.TestInfo testInfo)
string prjRelativeGraphsPath;
string filePath;
var prjRelativeGraphsPath = TestFrameworkTools.s_Path.Aggregate(TestFrameworkTools.s_RootPath, Path.Combine);
var filePath = Path.Combine(prjRelativeGraphsPath, testInfo.relativePath);
for (int i = 0; i < UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings; ++i)
{
UnityEngine.SceneManagement.Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneByBuildIndex(i);
Debug.Log("build index "+i+" : "+scene.name);
}
prjRelativeGraphsPath = TestFrameworkTools.s_Path.Aggregate(TestFrameworkTools.s_RootPath, Path.Combine);
filePath = Path.Combine(prjRelativeGraphsPath, testInfo.relativePath);
//Assert.IsNotNull(testSetup, "No SetupSceneForRenderPipelineTest in scene " + testInfo.name);
//Assert.IsNotNull(testSetup.cameraToUse, "No configured camera in <SetupSceneForRenderPipelineTest>");
Time.captureFramerate = testSetup.forcedFrameRate;
// Initialize
testSetup.Setup();

var oldTarget = testSetup.cameraToUse.targetTexture;
testSetup.cameraToUse.targetTexture = tempTarget;
while (!testSetup.IsTestFinished) yield return null;
// Pause
float prevTimeScale = Time.timeScale;
Time.timeScale = 0f;
for (int f = 0; f < testSetup.waitForFrames; ++f) yield return null;
// render the scene

var captured = new Texture2D(tempTarget.width, tempTarget.height, TextureFormat.RGB24, false);
captured.ReadPixels(new Rect(0, 0, testSetup.width, testSetup.height), 0, 0);
RenderTexture.active = oldActive;
//Unpause
Time.timeScale = prevTimeScale;
// Load the template
Texture2D fromDisk = new Texture2D(2, 2);

3
Tests/Scripts/GraphicTests/HDRenderPipeline/SinMove.cs


[SerializeField] Vector3 vector = Vector3.right;
[SerializeField] float frequency = 1f;
[SerializeField] float fps = 60;
Vector3 startPosition = Vector3.zero;

// Update is called once per frame
void Update ()
{
transform.position = startPosition + Mathf.Sin(Mathf.PI * Time.time * frequency) * (localSpace?transform.TransformDirection(vector):vector);
transform.position = startPosition + Mathf.Sin(Mathf.PI * frequency * Time.frameCount / fps) * (localSpace?transform.TransformDirection(vector):vector);
}
}

5
Tests/Scripts/GraphicTests/HDRenderPipeline/SinRotate.cs


[SerializeField] Vector3 angles = new Vector3(45f, 0f, 0f);
[SerializeField] float frequency = 1f;
[SerializeField] float fps = 60;
Vector3 startAngles = Vector3.zero;

if (localSpace)
{
transform.eulerAngles = startAngles;
transform.Rotate(angles * Mathf.Sin(Mathf.PI * Time.time * frequency), Space.Self);
transform.Rotate(angles * Mathf.Sin(Mathf.PI * frequency * Time.frameCount / fps), Space.Self);
transform.eulerAngles = startAngles + Mathf.Sin(Mathf.PI * Time.time * frequency) * angles;
transform.eulerAngles = startAngles + Mathf.Sin(Mathf.PI * frequency * Time.frameCount / fps) * angles;
}
}
}

3
Tests/Scripts/GraphicTests/HDRenderPipeline/Sin_ChangeFOV.cs


[SerializeField] float max = 90f;
[SerializeField] float frequency = 1f;
[SerializeField] float fps = 60;
new Camera camera;

// Update is called once per frame
void Update()
{
camera.fieldOfView = min + (max - min) * Mathf.Sin(Mathf.PI * Time.time * frequency);
camera.fieldOfView = min + (max - min) * Mathf.Sin(Mathf.PI * frequency * Time.frameCount / fps);
}
}

25
Tests/Scripts/GraphicTests/HDRenderPipeline/SinScale.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SinScale : MonoBehaviour
{
[SerializeField] Vector3 min = new Vector3(1f, 1f, 1f);
[SerializeField] Vector3 max = new Vector3(2f, 2f, 2f);
[SerializeField] float frequency = 1f;
[SerializeField] float fps = 60;
Vector3 startAngles = Vector3.zero;
// Use this for initialization
void Start()
{
startAngles = transform.eulerAngles;
}
// Update is called once per frame
void Update()
{
transform.localScale = Vector3.Lerp(min, max, Mathf.Sin(Mathf.PI * frequency * Time.frameCount / fps) * 0.5f + 0.5f);
}
}

11
Tests/Scripts/GraphicTests/HDRenderPipeline/SinScale.cs.meta


fileFormatVersion: 2
guid: 382c9a87993196d4596a688b68b60221
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存