diff --git a/.yamato/config/hdrp.metafile b/.yamato/config/hdrp.metafile index 61fbee415cb..0f9be6822c4 100644 --- a/.yamato/config/hdrp.metafile +++ b/.yamato/config/hdrp.metafile @@ -16,7 +16,7 @@ test_platforms: - type: playmode name: playmode_XR utr_flags: - - [all]: --extra-editor-arg="-xr-tests" + - [all]: --extra-editor-arg="-xr-reuse-tests" - type: editmode - type: Standalone utr_flags: diff --git a/.yamato/config/hdrp_dxr.metafile b/.yamato/config/hdrp_dxr.metafile index da9854682ae..349950753b2 100644 --- a/.yamato/config/hdrp_dxr.metafile +++ b/.yamato/config/hdrp_dxr.metafile @@ -16,7 +16,7 @@ test_platforms: - type: playmode name: playmode_XR utr_flags: - - [all]: --extra-editor-arg="-xr-tests" + - [all]: --extra-editor-arg="-xr-reuse-tests" expression_trigger: expression: "" platforms: diff --git a/.yamato/config/hdrp_hybrid.metafile b/.yamato/config/hdrp_hybrid.metafile index 68a2c52d65f..8150c08987a 100644 --- a/.yamato/config/hdrp_hybrid.metafile +++ b/.yamato/config/hdrp_hybrid.metafile @@ -18,7 +18,7 @@ test_platforms: - type: playmode name: playmode_XR utr_flags: - - [all]: --extra-editor-arg="-xr-tests" + - [all]: --extra-editor-arg="-xr-reuse-tests" - [all]: --compilation-errors-as-warnings # - type: editmode # utr_flags: diff --git a/.yamato/config/vfx_hdrp.metafile b/.yamato/config/vfx_hdrp.metafile index a43593b2688..934fe5256b5 100644 --- a/.yamato/config/vfx_hdrp.metafile +++ b/.yamato/config/vfx_hdrp.metafile @@ -18,7 +18,7 @@ test_platforms: - type: playmode name: playmode_XR utr_flags: - - [all]: --extra-editor-arg="-xr-tests" + - [all]: --extra-editor-arg="-xr-reuse-tests" - type: editmode expression_trigger: expression: 'pull_request.target eq "master" AND NOT pull_request.draft AND pull_request.changes.any match ["com.unity.visualeffectgraph/**/*", "TestProjects/VisualEffectGraph_HDRP/**/*"]' diff --git a/.yamato/hdrp-osx-metal.yml b/.yamato/hdrp-osx-metal.yml index fd077e06873..548080acde6 100644 --- a/.yamato/hdrp-osx-metal.yml +++ b/.yamato/hdrp-osx-metal.yml @@ -84,7 +84,7 @@ HDRP_OSX_Metal_playmode_XR_mono_Linear_trunk: - ssh -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" bokken@$BOKKEN_DEVICE_IP '$(python3 -m site --user-base)/bin/unity-downloader-cli -u {{editor_versions.trunk_latest_internal.macos.revision}} -c editor -c il2cpp --wait --published-only' - |5- - ssh -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" bokken@$BOKKEN_DEVICE_IP "export UPM_REGISTRY=https://artifactory-slo.bf.unity3d.com/artifactory/api/npm/upm-candidates; echo \$UPM_REGISTRY; cd ~/Graphics/TestProjects/HDRP_Tests && ~/Graphics/TestProjects/HDRP_Tests/utr --artifacts_path=/Users/bokken/Graphics/TestProjects/HDRP_Tests/test-results --editor-location=/Users/bokken/.Editor --extra-editor-arg="-colorspace=Linear" --extra-editor-arg="-xr-tests" --reruncount=2 --scripting-backend=Mono2x --suite=playmode --testfilter=$TEST_FILTER --testproject=/Users/bokken/Graphics/TestProjects/HDRP_Tests --zero-tests-are-ok=1" + ssh -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" bokken@$BOKKEN_DEVICE_IP "export UPM_REGISTRY=https://artifactory-slo.bf.unity3d.com/artifactory/api/npm/upm-candidates; echo \$UPM_REGISTRY; cd ~/Graphics/TestProjects/HDRP_Tests && ~/Graphics/TestProjects/HDRP_Tests/utr --artifacts_path=/Users/bokken/Graphics/TestProjects/HDRP_Tests/test-results --editor-location=/Users/bokken/.Editor --extra-editor-arg="-colorspace=Linear" --extra-editor-arg="-xr-reuse-tests" --reruncount=2 --scripting-backend=Mono2x --suite=playmode --testfilter=$TEST_FILTER --testproject=/Users/bokken/Graphics/TestProjects/HDRP_Tests --zero-tests-are-ok=1" UTR_RESULT=$? mkdir -p TestProjects/HDRP_Tests/test-results/ scp -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" -r bokken@$BOKKEN_DEVICE_IP:/Users/bokken/Graphics/TestProjects/HDRP_Tests/test-results/ TestProjects/HDRP_Tests/test-results/ @@ -209,7 +209,7 @@ HDRP_OSX_Metal_playmode_XR_mono_Linear_CUSTOM-REVISION: - ssh -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" bokken@$BOKKEN_DEVICE_IP '$(python3 -m site --user-base)/bin/unity-downloader-cli --source-file ~/Graphics/unity_revision.txt -c editor -c il2cpp --wait --published-only' - |5- - ssh -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" bokken@$BOKKEN_DEVICE_IP "export UPM_REGISTRY=https://artifactory-slo.bf.unity3d.com/artifactory/api/npm/upm-candidates; echo \$UPM_REGISTRY; cd ~/Graphics/TestProjects/HDRP_Tests && ~/Graphics/TestProjects/HDRP_Tests/utr --artifacts_path=/Users/bokken/Graphics/TestProjects/HDRP_Tests/test-results --editor-location=/Users/bokken/.Editor --extra-editor-arg="-colorspace=Linear" --extra-editor-arg="-xr-tests" --reruncount=2 --scripting-backend=Mono2x --suite=playmode --testfilter=$TEST_FILTER --testproject=/Users/bokken/Graphics/TestProjects/HDRP_Tests --zero-tests-are-ok=1" + ssh -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" bokken@$BOKKEN_DEVICE_IP "export UPM_REGISTRY=https://artifactory-slo.bf.unity3d.com/artifactory/api/npm/upm-candidates; echo \$UPM_REGISTRY; cd ~/Graphics/TestProjects/HDRP_Tests && ~/Graphics/TestProjects/HDRP_Tests/utr --artifacts_path=/Users/bokken/Graphics/TestProjects/HDRP_Tests/test-results --editor-location=/Users/bokken/.Editor --extra-editor-arg="-colorspace=Linear" --extra-editor-arg="-xr-reuse-tests" --reruncount=2 --scripting-backend=Mono2x --suite=playmode --testfilter=$TEST_FILTER --testproject=/Users/bokken/Graphics/TestProjects/HDRP_Tests --zero-tests-are-ok=1" UTR_RESULT=$? mkdir -p TestProjects/HDRP_Tests/test-results/ scp -i ~/.ssh/id_rsa_macmini -o "StrictHostKeyChecking=no" -r bokken@$BOKKEN_DEVICE_IP:/Users/bokken/Graphics/TestProjects/HDRP_Tests/test-results/ TestProjects/HDRP_Tests/test-results/ diff --git a/.yamato/hdrp-win-dx11.yml b/.yamato/hdrp-win-dx11.yml index 06b9e641deb..b81a19ee575 100644 --- a/.yamato/hdrp-win-dx11.yml +++ b/.yamato/hdrp-win-dx11.yml @@ -85,7 +85,7 @@ HDRP_Win_DX11_playmode_XR_mono_Linear_trunk: set /p GIT_REVISIONDATE=x.GetComponent()); + int waitFrames = settings.WaitFrames; + + if (XRGraphicsAutomatedTests.enabled) + { + waitFrames = Unity.Testing.XR.Runtime.ConfigureMockHMD.SetupTest(true, waitFrames, settings.ImageComparisonSettings); + } + // WaitFrames according to settings - for (int i = 0; i < settings.WaitFrames; i++) - yield return null; + for (int i = 0; i < waitFrames; i++) + yield return new WaitForEndOfFrame(); // Test Assert ImageAssert.AreEqual(testCase.ReferenceImage, cameras.Where(x => x != null), settings.ImageComparisonSettings); // Always wait one frame for scene load - yield return null; + yield return new WaitForEndOfFrame(); } @@ -60,6 +67,8 @@ public void DumpImagesInEditor() #endif CleanUp(); + + XRGraphicsAutomatedTests.running = false; } public void CleanUp() diff --git a/TestProjects/HDRP_HybridTests/Assets/Tests/Runtime/TestRuntime.asmdef b/TestProjects/HDRP_HybridTests/Assets/Tests/Runtime/TestRuntime.asmdef index 4ced46acd78..bb0827ab299 100644 --- a/TestProjects/HDRP_HybridTests/Assets/Tests/Runtime/TestRuntime.asmdef +++ b/TestProjects/HDRP_HybridTests/Assets/Tests/Runtime/TestRuntime.asmdef @@ -1,8 +1,10 @@ { "name": "TestRuntime", "references": [ + "GUID:df380645f10b7bc4b97d4f5eb6303d95", "GUID:c081bc530f560634bb5c21d4b323a7f1", "GUID:27619889b8ba8c24980f49ee34dbb44a", + "GUID:1d4ad4ead25f33942b7dcf63e8c0820b", "GUID:0acc523941302664db1f4e527237feb3", "GUID:734d92eba21c94caba915361bd5ac177", "GUID:d8b63aba1907145bea998dd612889d6b", diff --git a/TestProjects/HDRP_HybridTests/Packages/manifest.json b/TestProjects/HDRP_HybridTests/Packages/manifest.json index 33c1fab6095..2186a33f3a9 100644 --- a/TestProjects/HDRP_HybridTests/Packages/manifest.json +++ b/TestProjects/HDRP_HybridTests/Packages/manifest.json @@ -20,6 +20,7 @@ "com.unity.test-framework.build": "0.0.1-preview.12", "com.unity.test-framework.utp-reporter": "0.2.3-preview", "com.unity.testframework.graphics": "7.8.0-preview", + "com.unity.testing.xr": "file:../../../com.unity.testing.xr", "com.unity.textmeshpro": "3.0.0-preview.1", "com.unity.timeline": "1.3.0-preview.2", "com.unity.ugui": "1.0.0", @@ -58,6 +59,7 @@ }, "testables": [ "com.unity.testframework.graphics", + "com.unity.testing.xr", "com.unity.rendering.hybrid" ], "useSatSolver": true, diff --git a/TestProjects/HDRP_RuntimeTests/Packages/manifest.json b/TestProjects/HDRP_RuntimeTests/Packages/manifest.json index 1fe200c1ef1..909c5471481 100644 --- a/TestProjects/HDRP_RuntimeTests/Packages/manifest.json +++ b/TestProjects/HDRP_RuntimeTests/Packages/manifest.json @@ -11,6 +11,7 @@ "com.unity.test-framework.utp-reporter": "1.0.2-preview", "com.unity.testframework.graphics": "7.8.0-preview", "com.unity.testing.hdrp": "file:../../../com.unity.testing.hdrp", + "com.unity.testing.xr": "file:../../../com.unity.testing.xr", "com.unity.ugui": "1.0.0", "com.unity.visualeffectgraph": "file:../../../com.unity.visualeffectgraph", "com.unity.modules.ai": "1.0.0", @@ -50,6 +51,7 @@ "com.unity.render-pipelines.core", "com.unity.render-pipelines.high-definition", "com.unity.testframework.graphics", - "com.unity.testing.hdrp" + "com.unity.testing.hdrp", + "com.unity.testing.xr" ] } diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1102_Unlit_Distortion.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1102_Unlit_Distortion.unity index 88518156c35..40068ad4943 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1102_Unlit_Distortion.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1102_Unlit_Distortion.unity @@ -41224,6 +41224,11 @@ PrefabInstance: propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 value: 70005818916701 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1103_Unlit_Distortion_DepthTest.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1103_Unlit_Distortion_DepthTest.unity index e8169064c3a..ad8eeec5d1c 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1103_Unlit_Distortion_DepthTest.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1103_Unlit_Distortion_DepthTest.unity @@ -38403,6 +38403,11 @@ PrefabInstance: propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 value: 70005818916701 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1710_Decals_Normal_Patch.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1710_Decals_Normal_Patch.unity index 0d526b567a8..427bb830125 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1710_Decals_Normal_Patch.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1710_Decals_Normal_Patch.unity @@ -968,7 +968,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &1152350158 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2099,6 +2099,11 @@ PrefabInstance: propertyPath: renderGraphCompatible value: 1 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 3 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} --- !u!1 &2135916994 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1802_Depth_Pre_Post_Lit.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1802_Depth_Pre_Post_Lit.unity index d14f433e298..8d4f5de341a 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1802_Depth_Pre_Post_Lit.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1802_Depth_Pre_Post_Lit.unity @@ -12090,6 +12090,11 @@ PrefabInstance: propertyPath: renderingPathCustomFrameSettingsOverrideMask.mask.data1 value: 16384 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1803_Depth_Pre_Post_LitTess.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1803_Depth_Pre_Post_LitTess.unity index a6e60847602..f595dbc515f 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1803_Depth_Pre_Post_LitTess.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1803_Depth_Pre_Post_LitTess.unity @@ -12142,6 +12142,11 @@ PrefabInstance: propertyPath: renderingPathCustomFrameSettingsOverrideMask.mask.data1 value: 16384 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1804_Depth_Pre_Post_SG.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1804_Depth_Pre_Post_SG.unity index 81e9adf75e1..391685ac186 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1804_Depth_Pre_Post_SG.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1804_Depth_Pre_Post_SG.unity @@ -3429,6 +3429,11 @@ PrefabInstance: propertyPath: renderingPathCustomFrameSettingsOverrideMask.mask.data1 value: 16384 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 2 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2004_Light_AnimatedCookie.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2004_Light_AnimatedCookie.unity index c51c3ba0857..aa416b5c54c 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2004_Light_AnimatedCookie.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2004_Light_AnimatedCookie.unity @@ -725,6 +725,10 @@ PrefabInstance: propertyPath: waitForFrames value: 3 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth value: 400 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2222_ReflectionProbeDistanceBased.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2222_ReflectionProbeDistanceBased.unity index 8c25362020e..ff3f635cd12 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2222_ReflectionProbeDistanceBased.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2222_ReflectionProbeDistanceBased.unity @@ -1090,5 +1090,10 @@ PrefabInstance: propertyPath: checkMemoryAllocation value: 0 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrThresholdMultiplier + value: 1.5 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2318_Mixed_Cached_ShadowMap_Spot.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2318_Mixed_Cached_ShadowMap_Spot.unity index 6bc341de300..64ce3d4843a 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2318_Mixed_Cached_ShadowMap_Spot.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2318_Mixed_Cached_ShadowMap_Spot.unity @@ -714,6 +714,11 @@ PrefabInstance: propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 value: 70005818916701 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: renderPipelineAsset diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2551_SSR.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2551_SSR.unity index 7c1777e2d21..4f84bea9199 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2551_SSR.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2551_SSR.unity @@ -1054,6 +1054,11 @@ PrefabInstance: propertyPath: m_ObsoleteFrameSettings.lightLoopSettings.isFptlEnabled value: 0 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} --- !u!20 &776213426 stripped diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4011_MotionBlur_PerObject.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4011_MotionBlur_PerObject.unity index 67383a9936f..a7ecfb6a289 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4011_MotionBlur_PerObject.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4011_MotionBlur_PerObject.unity @@ -509,6 +509,11 @@ PrefabInstance: propertyPath: waitFrames value: 40 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_Mode diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4014_PrecomputedVelocityAlembic.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4014_PrecomputedVelocityAlembic.unity index cae875dd857..79020bc847e 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4014_PrecomputedVelocityAlembic.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4014_PrecomputedVelocityAlembic.unity @@ -3115,6 +3115,11 @@ PrefabInstance: propertyPath: waitFrames value: 30 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: captureFramerate diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4060_CustomPostProcess.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4060_CustomPostProcess.unity index 1d6c993067f..2a797a82cfb 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4060_CustomPostProcess.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/4x_PostProcessing/4060_CustomPostProcess.unity @@ -533,6 +533,11 @@ PrefabInstance: propertyPath: antialiasing value: 2 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity index d4643158c09..4ccb722e24a 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity @@ -256,6 +256,11 @@ PrefabInstance: propertyPath: waitFrames value: 5 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: ImageComparisonSettings.TargetWidth diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/8x_ShaderGraph/8107_UnlitShadowMatteAmbientOcclusion.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/8x_ShaderGraph/8107_UnlitShadowMatteAmbientOcclusion.unity index ca7e95f2d3e..0a3626ad9d6 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/8x_ShaderGraph/8107_UnlitShadowMatteAmbientOcclusion.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/8x_ShaderGraph/8107_UnlitShadowMatteAmbientOcclusion.unity @@ -723,6 +723,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} --- !u!1 &1495890662 diff --git a/TestProjects/HDRP_Tests/Packages/manifest.json b/TestProjects/HDRP_Tests/Packages/manifest.json index f123073ec93..fdead7cd24b 100644 --- a/TestProjects/HDRP_Tests/Packages/manifest.json +++ b/TestProjects/HDRP_Tests/Packages/manifest.json @@ -10,6 +10,7 @@ "com.unity.test-framework": "1.1.14", "com.unity.testframework.graphics": "7.8.0-preview", "com.unity.testing.hdrp": "file:../../../com.unity.testing.hdrp", + "com.unity.testing.xr": "file:../../../com.unity.testing.xr", "com.unity.ugui": "1.0.0", "com.unity.visualeffectgraph": "file:../../../com.unity.visualeffectgraph", "com.unity.modules.ai": "1.0.0", @@ -49,6 +50,7 @@ "com.unity.render-pipelines.core", "com.unity.render-pipelines.high-definition", "com.unity.testframework.graphics", - "com.unity.testing.hdrp" + "com.unity.testing.hdrp", + "com.unity.testing.xr" ] } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 25a7bf2b45a..978fe28f3d2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -2312,7 +2312,7 @@ out ScriptableCullingParameters cullingParams cullingParams = hdCamera.xr.cullingParams; // Sync the FOV on the camera to match the projection from the XR device in order to cull shadows accurately - if (!camera.usePhysicalProperties) + if (!camera.usePhysicalProperties && !XRGraphicsAutomatedTests.enabled) camera.fieldOfView = Mathf.Rad2Deg * Mathf.Atan(1.0f / cullingParams.stereoProjectionMatrix.m11) * 2.0f; } else diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRPass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRPass.cs index 636e826e351..0c6d25a6431 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRPass.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRPass.cs @@ -152,6 +152,28 @@ internal static XRPass Create(XRPassCreateInfo createInfo) return passInfo; } + internal void UpdateView(int viewId, XRDisplaySubsystem.XRRenderPass xrSdkRenderPass, XRDisplaySubsystem.XRRenderParameter xrSdkRenderParameter) + { + if (viewId >= views.Count) + throw new NotImplementedException($"Invalid XR setup to update, trying to update non-existing xr view."); + + views[viewId] = new XRView(xrSdkRenderPass, xrSdkRenderParameter); + } + + internal void UpdateView(int viewId, Matrix4x4 proj, Matrix4x4 view, Rect vp, int textureArraySlice = -1) + { + if (viewId >= views.Count) + throw new NotImplementedException($"Invalid XR setup to update, trying to update non-existing xr view."); + + views[viewId] = new XRView(proj, view, vp, textureArraySlice); + } + + internal void UpdateCullingParams(int cullingPassId, ScriptableCullingParameters cullingParams) + { + this.cullingPassId = cullingPassId; + this.cullingParams = cullingParams; + } + internal void AddView(Matrix4x4 proj, Matrix4x4 view, Rect vp, int textureArraySlice = -1) { AddViewInternal(new XRView(proj, view, vp, textureArraySlice)); @@ -373,6 +395,11 @@ internal void EndCamera(CommandBuffer cmd, HDCamera hdCamera) internal void RenderOcclusionMeshes(CommandBuffer cmd, Color clearColor, RTHandle colorBuffer, RTHandle depthBuffer) { + #if DEVELOPMENT_BUILD || UNITY_EDITOR + if (XRGraphicsAutomatedTests.enabled && XRGraphicsAutomatedTests.running) + return; + #endif + if (isOcclusionMeshSupported) { CoreUtils.SetRenderTarget(cmd, colorBuffer, depthBuffer, ClearFlag.None, clearColor, 0, CubemapFace.Unknown, -1); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs index 7f8324d0b13..5d29dd0e776 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/XR/XRSystem.cs @@ -130,13 +130,6 @@ internal int GetMaxViews() // Enable XR layout only for gameview camera bool xrSupported = camera.cameraType == CameraType.Game && camera.targetTexture == null && HDUtils.TryGetAdditionalCameraDataOrDefault(camera).xrRendering; -#if DEVELOPMENT_BUILD || UNITY_EDITOR - if (singlePassTestMode && LayoutSinglePassTestMode(new XRLayout() { camera = camera, xrSystem = this })) - { - // single-pass test layout in used - } - else -#endif if (customLayout != null && customLayout(new XRLayout() { camera = camera, xrSystem = this })) { // custom layout in used @@ -154,6 +147,11 @@ internal int GetMaxViews() } CreateLayoutFromXrSdk(camera, singlePassAllowed); + +#if DEVELOPMENT_BUILD || UNITY_EDITOR + if (singlePassTestMode) + OverrideForAutomatedTests(camera); +#endif } #endif else @@ -357,55 +355,47 @@ void CaptureDebugInfo() } #if DEVELOPMENT_BUILD || UNITY_EDITOR - bool LayoutSinglePassTestMode(XRLayout frameLayout) + private void OverrideForAutomatedTests(Camera camera) { - Camera camera = frameLayout.camera; + var camProjMatrix = camera.projectionMatrix; + var camViewMatrix = camera.worldToCameraMatrix; - if (camera != null && camera.cameraType == CameraType.Game && camera.TryGetCullingParameters(false, out var cullingParams)) + if (camera.TryGetCullingParameters(false, out var cullingParams)) { - cullingParams.stereoProjectionMatrix = camera.projectionMatrix; - cullingParams.stereoViewMatrix = camera.worldToCameraMatrix; + cullingParams.stereoProjectionMatrix = camProjMatrix; + cullingParams.stereoViewMatrix = camViewMatrix; + cullingParams.stereoSeparationDistance = 0.0f; + cullingParams.cullingOptions &= ~CullingOptions.Stereo; - var passInfo = new XRPassCreateInfo - { - multipassId = 0, - cullingPassId = 0, - cullingParameters = cullingParams, - renderTarget = camera.targetTexture, - customMirrorView = null - }; - - var viewInfo2 = new XRViewCreateInfo - { - projMatrix = camera.projectionMatrix, - viewMatrix = camera.worldToCameraMatrix, - viewport = new Rect(camera.pixelRect.x, camera.pixelRect.y, camera.pixelWidth, camera.pixelHeight), - textureArraySlice = -1 - }; - - // Change the first view so that it's a different viewpoint and projection to detect more issues - var viewInfo1 = viewInfo2; - var planes = viewInfo1.projMatrix.decomposeProjection; - planes.left *= 0.44f; - planes.right *= 0.88f; - planes.top *= 0.11f; - planes.bottom *= 0.33f; - viewInfo1.projMatrix = Matrix4x4.Frustum(planes); - viewInfo1.viewMatrix *= Matrix4x4.Translate(new Vector3(.34f, 0.25f, -0.08f)); - - // single-pass 2x rendering + for (int passId = 0; passId < framePasses.Count; passId++) { - XRPass pass = frameLayout.CreatePass(passInfo); + var xrPass = framePasses[passId].Item2; + xrPass.UpdateCullingParams(xrPass.cullingPassId, cullingParams); - frameLayout.AddViewToPass(viewInfo1, pass); - frameLayout.AddViewToPass(viewInfo2, pass); - } + for (int viewId = 0; viewId < framePasses[passId].Item2.viewCount; viewId++) + { + var projMatrix = camProjMatrix; + var viewMatrix = camViewMatrix; - // valid layout - return true; - } + // Alter the first view in order to detect more issues + bool isFirstViewMultiPass = framePasses.Count == 2 && passId == 0; + bool isFirstViewSinglePass = framePasses.Count == 1 && viewId == 0; - return false; + if (isFirstViewMultiPass || isFirstViewSinglePass) + { + var planes = projMatrix.decomposeProjection; + planes.left *= 0.44f; + planes.right *= 0.88f; + planes.top *= 0.11f; + planes.bottom *= 0.33f; + projMatrix = Matrix4x4.Frustum(planes); + viewMatrix *= Matrix4x4.Translate(new Vector3(.34f, 0.25f, -0.08f)); + } + + xrPass.UpdateView(viewId, projMatrix, viewMatrix, xrPass.GetViewport(viewId), viewId); + } + } + } } #endif diff --git a/com.unity.testing.hdrp/Scripts/Setup/Assembly-CSharp-Editor.asmdef b/com.unity.testing.hdrp/Scripts/Setup/Assembly-CSharp-Editor.asmdef index ef435cd147f..c6282932487 100644 --- a/com.unity.testing.hdrp/Scripts/Setup/Assembly-CSharp-Editor.asmdef +++ b/com.unity.testing.hdrp/Scripts/Setup/Assembly-CSharp-Editor.asmdef @@ -1,6 +1,7 @@ { "name": "Assembly-CSharp-Editor-testable", "references": [ + "Unity.Testing.XR.Editor", "UnityEditor.TestTools.Graphics" ], "optionalUnityReferences": [ diff --git a/com.unity.testing.hdrp/Scripts/Setup/SetupGraphicsTestCases.cs b/com.unity.testing.hdrp/Scripts/Setup/SetupGraphicsTestCases.cs index ef3a218a0e4..4594a111f99 100644 --- a/com.unity.testing.hdrp/Scripts/Setup/SetupGraphicsTestCases.cs +++ b/com.unity.testing.hdrp/Scripts/Setup/SetupGraphicsTestCases.cs @@ -1,12 +1,15 @@ using UnityEngine.TestTools; -// Work around case #1033694, unable to use PrebuildSetup types directly from assemblies that don't have special names. -// Once that's fixed, this class can be deleted and the SetupGraphicsTestCases class in Unity.TestFramework.Graphics.Editor -// can be used directly instead. public class SetupGraphicsTestCases : IPrebuildSetup { public void Setup() { + // Work around case #1033694, unable to use PrebuildSetup types directly from assemblies that don't have special names. + // Once that's fixed, this class can be deleted and the SetupGraphicsTestCases class in Unity.TestFramework.Graphics.Editor + // can be used directly instead. UnityEditor.TestTools.Graphics.SetupGraphicsTestCases.Setup(); + + // Configure project for XR tests + Unity.Testing.XR.Editor.InjectMockHMD.SetupLoader(); } } diff --git a/com.unity.testing.hdrp/TestRunner/HDRP_GraphicTestRunner.cs b/com.unity.testing.hdrp/TestRunner/HDRP_GraphicTestRunner.cs index 5628078a5ad..effe7b43458 100644 --- a/com.unity.testing.hdrp/TestRunner/HDRP_GraphicTestRunner.cs +++ b/com.unity.testing.hdrp/TestRunner/HDRP_GraphicTestRunner.cs @@ -36,26 +36,21 @@ public IEnumerator Run(GraphicsTestCase testCase) Time.captureFramerate = settings.captureFramerate; + int waitFrames = settings.waitFrames; + if (XRGraphicsAutomatedTests.enabled) { - if (settings.xrCompatible) - { - XRGraphicsAutomatedTests.running = true; + waitFrames = Unity.Testing.XR.Runtime.ConfigureMockHMD.SetupTest(settings.xrCompatible, waitFrames, settings.ImageComparisonSettings); - // Increase tolerance to account for slight changes due to float precision - settings.ImageComparisonSettings.AverageCorrectnessThreshold *= settings.xrThresholdMultiplier; - settings.ImageComparisonSettings.PerPixelCorrectnessThreshold *= settings.xrThresholdMultiplier; + // Increase tolerance to account for slight changes due to float precision + settings.ImageComparisonSettings.AverageCorrectnessThreshold *= settings.xrThresholdMultiplier; + settings.ImageComparisonSettings.PerPixelCorrectnessThreshold *= settings.xrThresholdMultiplier; - // Increase number of volumetric slices to compensate for initial half-resolution due to XR single-pass optimization - foreach (var volume in GameObject.FindObjectsOfType()) - { - if (volume.profile.TryGet(out Fog fog)) - fog.volumeSliceCount.value *= 2; - } - } - else + // Increase number of volumetric slices to compensate for initial half-resolution due to XR single-pass optimization + foreach (var volume in GameObject.FindObjectsOfType()) { - Assert.Ignore("Test scene is not compatible with XR and will be skipped."); + if (volume.profile.TryGet(out Fog fog)) + fog.volumeSliceCount.value *= 2; } } @@ -70,7 +65,7 @@ public IEnumerator Run(GraphicsTestCase testCase) // Reset temporal effects on hdCamera HDCamera.GetOrCreate(camera).Reset(); - for (int i=0 ; i() as HDRP_ShaderGraph_TestSettings); @@ -161,7 +156,7 @@ public void DumpImagesInEditor() } [TearDown] - public void ResetSystemState() + public void TearDownXR() { XRGraphicsAutomatedTests.running = false; } diff --git a/com.unity.testing.hdrp/TestRunner/HDRP_TestRunner.asmdef b/com.unity.testing.hdrp/TestRunner/HDRP_TestRunner.asmdef index dececcbec0c..5ef778c6560 100644 --- a/com.unity.testing.hdrp/TestRunner/HDRP_TestRunner.asmdef +++ b/com.unity.testing.hdrp/TestRunner/HDRP_TestRunner.asmdef @@ -4,6 +4,7 @@ "Unity.RenderPipelines.HighDefinition.Runtime", "Unity.Postprocessing.Runtime", "Unity.RenderPipelines.Core.Runtime", + "Unity.Testing.XR.Runtime", "UnityEngine.TestTools.Graphics" ], "optionalUnityReferences": [