Skip to content

Update HDRP graphic test framework with Test Broken / TestFilter script #393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 153 additions & 5 deletions com.unity.testing.hdrp/ScenePrefabs/HDRP_Test_Camera.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 20109210616973140}
- component: {fileID: 114777190906822814}
- component: {fileID: 114995348509370400}
- component: {fileID: 580412863073167814}
m_Layer: 0
m_Name: HDRP_Test_Camera
m_TagString: MainCamera
Expand All @@ -29,7 +30,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 5491209476924004349}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -88,7 +90,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 5
m_Version: 7
m_ObsoleteRenderingPath: 0
m_ObsoleteFrameSettings:
overrides: 0
Expand Down Expand Up @@ -146,6 +148,12 @@ MonoBehaviour:
SMAAQuality: 2
dithering: 0
stopNaNs: 0
taaSharpenStrength: 0.6
TAAQuality: 1
taaHistorySharpening: 0.35
taaAntiFlicker: 0.5
taaMotionVectorRejection: 0
taaAntiHistoryRinging: 0
physicalParameters:
m_Iso: 200
m_ShutterSpeed: 0.005
Expand All @@ -155,21 +163,29 @@ MonoBehaviour:
m_BarrelClipping: 0.25
m_Anamorphism: 0
flipYMode: 0
xrRendering: 1
fullscreenPassthrough: 0
allowDynamicResolution: 0
customRenderingSettings: 0
invertFaceCulling: 0
probeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
hasPersistentHistory: 0
m_RenderingPathCustomFrameSettings:
bitDatas:
data1: 69284264410909
data1: 70005818916701
data2: 4539628424389459968
lodBias: 1
lodBiasMode: 0
lodBiasQualityLevel: 0
maximumLODLevel: 0
maximumLODLevelMode: 0
maximumLODLevelQualityLevel: 0
sssQualityMode: 0
sssQualityLevel: 0
sssCustomSampleBudget: 20
materialQuality: 0
renderingPathCustomFrameSettingsOverrideMask:
mask:
data1: 0
Expand All @@ -192,12 +208,144 @@ MonoBehaviour:
TargetHeight: 360
PerPixelCorrectnessThreshold: 0.001
AverageCorrectnessThreshold: 0.0001
UseHDR: 0
doBeforeTest:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
captureFramerate: 0
waitFrames: 0
xrCompatible: 1
xrThresholdMultiplier: 1
checkMemoryAllocation: 1
renderPipelineAsset: {fileID: 11400000, guid: d7fe5f39d2c099a4ea1f1f610af309d7,
type: 2}
--- !u!114 &580412863073167814
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1132393308280272}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aba9db29cdbc7481a86ff2d206b4dad6, type: 3}
m_Name:
m_EditorClassIdentifier:
renderer: {fileID: 131257220995741923}
camera: {fileID: 20109210616973140}
testSettings: {fileID: 114995348509370400}
screenSize: 0.8
nearPlaneOffset: 0.001
extend: {x: 4, y: 1.8}
place: 0
--- !u!1 &6002938546587368868
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5491209476924004349}
- component: {fileID: 131257220995741923}
- component: {fileID: 205429588873169433}
- component: {fileID: 704450088499825821}
m_Layer: 0
m_Name: BrokenTestText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5491209476924004349
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6002938546587368868}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.501}
m_LocalScale: {x: 0.08037274, y: 0.08037274, z: 0.08037274}
m_Children: []
m_Father: {fileID: 4209882255362944}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &131257220995741923
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6002938546587368868}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: d76269c34e0fa6d438942a0eba5acac8, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 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
m_AdditionalVertexStreams: {fileID: 0}
--- !u!102 &205429588873169433
TextMesh:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6002938546587368868}
m_Text: "+--------+\n\u299A\u299A\u299A\u299A| Test |\n| Broken |\u23BA\n+--------+"
m_OffsetZ: 0
m_CharacterSize: 1
m_LineSpacing: 1
m_Anchor: 4
m_Alignment: 0
m_TabSize: 4
m_FontSize: 1
m_FontStyle: 0
m_RichText: 0
m_Font: {fileID: 12800000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_Color:
serializedVersion: 2
rgba: 4278190335
--- !u!114 &704450088499825821
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6002938546587368868}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ca2f6272d55211f4eb843d4ae99aaecc, type: 3}
m_Name:
m_EditorClassIdentifier:
D3D11: 0
D3D12: 0
VukanWindows: 0
36 changes: 31 additions & 5 deletions com.unity.testing.hdrp/Scripts/DisplayOnPlatformAPI.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

[ExecuteInEditMode]
public class DisplayOnPlatformAPI : MonoBehaviour
{
[SerializeField] List<PlatformAPI> platformApis = new List<PlatformAPI>();
public bool D3D11;
public bool D3D12;
public bool VukanWindows;
public bool Metal;

void Start()
List<PlatformAPI> platformApis = new List<PlatformAPI>();

void OnValidate()
{
platformApis.Clear();

if (D3D11)
platformApis.Add(new PlatformAPI(RuntimePlatform.WindowsEditor, GraphicsDeviceType.Direct3D11));

if (D3D12)
platformApis.Add(new PlatformAPI(RuntimePlatform.WindowsEditor, GraphicsDeviceType.Direct3D12));

if (VukanWindows)
platformApis.Add(new PlatformAPI(RuntimePlatform.WindowsEditor, GraphicsDeviceType.Vulkan));

if (Metal)
platformApis.Add(new PlatformAPI(RuntimePlatform.OSXEditor, GraphicsDeviceType.Metal));

bool display = false;

foreach (var platformApi in platformApis)
Expand All @@ -20,12 +40,18 @@ void Start()
}
}

gameObject.SetActive(display);
var textMeshRenderer = gameObject.GetComponent<MeshRenderer>();
textMeshRenderer.enabled = display;
}

[System.Serializable]
public struct PlatformAPI
{
public PlatformAPI(RuntimePlatform inPlatform, GraphicsDeviceType inGraphicsDeviceType)
{
platform = inPlatform;
graphicsDeviceType = inGraphicsDeviceType;
}

public RuntimePlatform platform;
public GraphicsDeviceType graphicsDeviceType;
}
Expand Down
6 changes: 4 additions & 2 deletions com.unity.testing.hdrp/Scripts/HDRP_Tests.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"Unity.Postprocessing.Runtime",
"Unity.RenderPipelines.HighDefinition.Runtime",
"UnityEngine.TestTools.Graphics",
"Unity.RenderPipelines.HighDefinition.Editor"
"Unity.RenderPipelines.HighDefinition.Editor",
"HDRP_TestRunner",
"UnityEditor.TestTools.Graphics"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -16,4 +18,4 @@
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
}
67 changes: 67 additions & 0 deletions com.unity.testing.hdrp/Scripts/SetToCameraNearPlane.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.TestTools.Graphics;

public class SetToCameraNearPlane : MonoBehaviour
{
new public MeshRenderer renderer;
new public Camera camera;
public GraphicsTestSettings testSettings;

[Range(0, 1)]
public float screenSize = 0.8f;
public float nearPlaneOffset = 0.001f;

public Vector2 extend = Vector2.one;

void Start()
{
PlaceObject();
}

void PlaceObject ()
{
float captureRatio = testSettings.ImageComparisonSettings.TargetWidth * 1.0f / testSettings.ImageComparisonSettings.TargetHeight;
float objectRatio = extend.x / extend.y;

bool scaleBaseOnX = objectRatio >= captureRatio;

float camDistance = camera.nearClipPlane + nearPlaneOffset;

float nearPlaneTargetSize = 1f;

if (camera.orthographic)
{
nearPlaneTargetSize = camera.orthographicSize * ((scaleBaseOnX) ? captureRatio : 1f) * screenSize;
}
else
{
nearPlaneTargetSize = Mathf.Sin(camera.fieldOfView * 0.5f * Mathf.Deg2Rad * ((scaleBaseOnX) ? captureRatio : 1f)) * camDistance * screenSize;
}

renderer.transform.parent = camera.transform;
renderer.transform.localPosition = new Vector3(0, 0, camDistance);
renderer.transform.localRotation = Quaternion.identity;
renderer.transform.localScale = Vector3.one * Mathf.Abs(nearPlaneTargetSize / ( (scaleBaseOnX) ? extend.x : extend.y ) );

}

public bool place = false;
private void OnValidate()
{
if (place)
{
place = false;
PlaceObject();
}
}

private void OnDrawGizmosSelected()
{
if (renderer == null) return;

Gizmos.matrix = renderer.transform.localToWorldMatrix;
Gizmos.DrawWireCube(Vector3.zero, extend * 2f);
}
}
11 changes: 11 additions & 0 deletions com.unity.testing.hdrp/Scripts/SetToCameraNearPlane.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading