Skip to content

Commit f92d8cb

Browse files
committed
backport of #4976
1 parent 4022294 commit f92d8cb

26 files changed

Lines changed: 389 additions & 204 deletions

TestProjects/UniversalGraphicsTest/Assets/Test/Editor/Unity.Testing.SRP.Universal.Editor.asmdef

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"GUID:e18141520846dcc44b725b2f74e91229",
55
"GUID:ed05cc0a83a5a40c0a6e72098212c312",
66
"GUID:27619889b8ba8c24980f49ee34dbb44a",
7-
"GUID:0acc523941302664db1f4e527237feb3"
7+
"GUID:0acc523941302664db1f4e527237feb3",
8+
"GUID:c579267770062bf448e75eb160330b7f",
9+
"GUID:15fc0a57446b3144c949da3e2b9737a9"
810
],
911
"includePlatforms": [
1012
"Editor"
@@ -19,5 +21,6 @@
1921
"defineConstraints": [
2022
"UNITY_INCLUDE_TESTS"
2123
],
22-
"versionDefines": []
24+
"versionDefines": [],
25+
"noEngineReferences": false
2326
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using NUnit.Framework;
2+
using UnityEngine.Rendering;
3+
using UnityEngine.Rendering.Universal;
4+
5+
public class UniversalProjectEditorTests
6+
{
7+
private static UniversalRenderPipelineAsset currentAsset;
8+
9+
[Test]
10+
public void GetCurrentAsset()
11+
{
12+
GetUniversalAsset();
13+
}
14+
15+
[Test]
16+
public void GetCurrentRenderer()
17+
{
18+
GetUniversalAsset();
19+
20+
Assert.IsNotNull(currentAsset.scriptableRenderer, "Current ScriptableRenderer is null.");
21+
}
22+
23+
//Utilities
24+
void GetUniversalAsset()
25+
{
26+
var renderpipelineAsset = GraphicsSettings.currentRenderPipeline;
27+
28+
if(renderpipelineAsset == null)
29+
Assert.Fail("No Render Pipeline Asset assigned.");
30+
31+
if (renderpipelineAsset.GetType() == typeof(UniversalRenderPipelineAsset))
32+
{
33+
currentAsset = renderpipelineAsset as UniversalRenderPipelineAsset;
34+
}
35+
else
36+
{
37+
Assert.Inconclusive("Project not setup for Universal RP.");
38+
}
39+
}
40+
}

TestProjects/UniversalGraphicsTest/Assets/Test/Editor/UniversalProjectEditorTests.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,11 @@ public static bool ArePostProcessesEnabled(Camera camera)
643643
for (int i = 0; i < UnityEditor.SceneView.sceneViews.Count; i++)
644644
{
645645
var sv = UnityEditor.SceneView.sceneViews[i] as UnityEditor.SceneView;
646-
if (sv.camera == camera && sv.sceneViewState.showImageEffects)
646+
647+
// Post-processing is disabled in scene view if either showImageEffects is disabled or we are
648+
// rendering in wireframe mode.
649+
if (sv.camera == camera &&
650+
(sv.sceneViewState.showImageEffects && sv.cameraMode.drawMode != UnityEditor.DrawCameraMode.Wireframe))
647651
{
648652
enabled = true;
649653
break;

com.unity.render-pipelines.universal/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- Deprecated the CinemachineUniversalPixelPerfect extension. Use the one from Cinemachine v2.4 instead.
1515

1616
### Fixed
17+
- Fixed an issue where linear to sRGB conversion occurred twice on certain Android devices.
18+
- Fixed an issue where Unity rendered fullscreen quads with the pink error shader when you enabled the Stop NaN post-processing pass.
1719
- Fixed an issue where 2D Lighting was broken for Perspective Cameras.
1820
- Fixed an issue where resetting a Freeform 2D Light would throw null reference exceptions. [case 1184536](https://issuetracker.unity3d.com/issues/lwrp-changing-light-type-to-freeform-after-clicking-on-reset-throws-multiple-arguementoutofrangeexception)
1921
- Fixed an issue where Freeform 2D Lights were not culled correctly when there was a Falloff Offset.
2022
- Fixed an issue where Tilemap palettes were invisible in the Tile Palette window when the 2D Renderer was in use. [case 1162550](https://issuetracker.unity3d.com/issues/adding-tiles-in-the-tile-palette-makes-the-tiles-invisible)
23+
- Fixed user LUT sampling being done in Linear instead of sRGB.
24+
- Fixed an issue when trying to get the Renderer via API on the first frame [case 1189196](https://issuetracker.unity3d.com/product/unity/issues/guid/1189196/)
25+
- Fixed an issue where deleting an entry from the Renderer List and then undoing that change could cause a null reference. [case 1191896](https://issuetracker.unity3d.com/issues/nullreferenceexception-when-attempting-to-remove-entry-from-renderer-features-list-after-it-has-been-removed-and-then-undone)
26+
- Fixed an issue where the user would get an error if they removed the Additional Camera Data component. [case 1189926](https://issuetracker.unity3d.com/issues/unable-to-remove-universal-slash-hd-additional-camera-data-component-serializedobject-target-destroyed-error-is-thrown)
27+
- Fixed an issue that caused shaders containing `HDRP` string in their path to be stripped from the build.
28+
- Fixed an issue that caused only selected object to render in SceneView when Wireframe drawmode was selected.
29+
- Fixed Renderer Features UI tooltips. [case 1191901](https://issuetracker.unity3d.com/issues/forward-renderers-render-objects-layer-mask-tooltip-is-incorrect-and-contains-a-typo)
2130
- Fixed an issue where the Scene lighting button didn't work when you used the 2D Renderer.
2231
- Fixed a performance regression when you used the 2D Renderer.
2332
- Fixed an issue where the Freeform 2D Light gizmo didn't correctly show the Falloff offset.

com.unity.render-pipelines.universal/Editor/RendererFeatures/RenderObjectsPassFeatureEditor.cs

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
1-
using System.Collections.Generic;
1+
using System;
22
using System.Linq;
33
using UnityEngine;
44
using UnityEditorInternal;
55
using UnityEngine.Experimental.Rendering.Universal;
66

7-
namespace UnityEditor.Experimental.Rendering.Universal
7+
namespace UnityEditor.Experimental.Rendering.Universal
88
{
99
[CustomPropertyDrawer(typeof(RenderObjects.RenderObjectsSettings), true)]
1010
internal class RenderObjectsPassFeatureEditor : PropertyDrawer
1111
{
1212
internal class Styles
1313
{
1414
public static float defaultLineSpace = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
15-
public static GUIContent callback = new GUIContent("Event", "Chose the Callback position for this render pass object.");
15+
public static GUIContent callback = new GUIContent("Event", "Choose at which point this render pass is executed in the frame.");
1616

1717
//Headers
18-
public static GUIContent filtersHeader = new GUIContent("Filters", "Filters.");
19-
public static GUIContent renderHeader = new GUIContent("Overrides", "Different parts fo the rendering that you can choose to override.");
18+
public static GUIContent filtersHeader = new GUIContent("Filters", "Settings that control which objects should be rendered.");
19+
public static GUIContent renderHeader = new GUIContent("Overrides", "Different parts of the rendering that you can choose to override.");
2020

2121
//Filters
22-
public static GUIContent renderQueueFilter = new GUIContent("Queue", "Filter the render queue range you want to render.");
23-
public static GUIContent layerMask = new GUIContent("Layer Mask", "Chose the Callback position for this render pass object.");
24-
public static GUIContent shaderPassFilter = new GUIContent("Shader Passes", "Chose the Callback position for this render pass object.");
22+
public static GUIContent renderQueueFilter = new GUIContent("Queue", "Only render objects in the selected render queue range.");
23+
public static GUIContent layerMask = new GUIContent("Layer Mask", "Only render objects in a layer that match the given layer mask.");
24+
public static GUIContent shaderPassFilter = new GUIContent("Shader Passes", "Controls which shader passes to use when rendering objects. The name given here must match the LightMode tag in a shader pass.");
2525

2626
//Render Options
27-
public static GUIContent overrideMaterial = new GUIContent("Material", "Chose an override material, every renderer will be rendered with this material.");
27+
public static GUIContent overrideMaterial = new GUIContent("Material", "Choose an override material, every renderer will be rendered with this material.");
2828
public static GUIContent overrideMaterialPass = new GUIContent("Pass Index", "The pass index for the override material to use.");
2929

3030
//Depth Settings
3131
public static GUIContent overrideDepth = new GUIContent("Depth", "Override depth rendering.");
32-
public static GUIContent writeDepth = new GUIContent("Write Depth", "Chose to write depth to the screen.");
33-
public static GUIContent depthState = new GUIContent("Depth Test", "Choose a new test setting for the depth.");
32+
public static GUIContent writeDepth = new GUIContent("Write Depth", "Choose to write depth to the screen.");
33+
public static GUIContent depthState = new GUIContent("Depth Test", "Choose a new depth test function.");
3434

3535
//Camera Settings
36-
public static GUIContent overrideCamera = new GUIContent("Camera", "Override camera projections.");
36+
public static GUIContent overrideCamera = new GUIContent("Camera", "Override camera matrices.");
3737
public static GUIContent cameraFOV = new GUIContent("Field Of View", "Field Of View to render this pass in.");
3838
public static GUIContent positionOffset = new GUIContent("Position Offset", "This Vector acts as a relative offset for the camera.");
39-
public static GUIContent restoreCamera = new GUIContent("Restore", "Restore to the original camera projection before this pass.");
40-
41-
}
39+
public static GUIContent restoreCamera = new GUIContent("Restore", "Restore to the original camera matrices before this pass.");
40+
}
4241

4342
//Headers and layout
4443
private HeaderBool m_FiltersFoldout;
@@ -47,9 +46,9 @@ internal class Styles
4746
private int m_MaterialLines = 2;
4847
private int m_DepthLines = 3;
4948
private int m_CameraLines = 4;
50-
51-
private bool firstTime = true;
52-
49+
50+
private SerializedProperty m_Property;
51+
5352
// Serialized Properties
5453
private SerializedProperty m_Callback;
5554
private SerializedProperty m_PassTag;
@@ -83,7 +82,7 @@ private void Init(SerializedProperty property)
8382
m_FiltersFoldout = new HeaderBool($"{key}.FiltersFoldout", true);
8483
m_RenderFoldout = new HeaderBool($"{key}.RenderFoldout");
8584

86-
85+
8786
m_Callback = property.FindPropertyRelative("Event");
8887
m_PassTag = property.FindPropertyRelative("passTag");
8988
//Filter props
@@ -106,7 +105,7 @@ private void Init(SerializedProperty property)
106105
m_FOV = m_CameraSettings.FindPropertyRelative("cameraFieldOfView");
107106
m_CameraOffset = m_CameraSettings.FindPropertyRelative("offset");
108107
m_RestoreCamera = m_CameraSettings.FindPropertyRelative("restoreCamera");
109-
108+
110109
m_ShaderPassesList = new ReorderableList(null, m_ShaderPasses, true, true, true, true);
111110

112111
m_ShaderPassesList.drawElementCallback =
@@ -119,20 +118,20 @@ private void Init(SerializedProperty property)
119118
element.stringValue = EditorGUI.TextField(propRect, "Name", element.stringValue);
120119
EditorGUIUtility.labelWidth = labelWidth;
121120
};
122-
121+
123122
m_ShaderPassesList.drawHeaderCallback = (Rect testHeaderRect) => {
124123
EditorGUI.LabelField(testHeaderRect, Styles.shaderPassFilter);
125124
};
126-
127-
firstTime = false;
125+
126+
m_Property = property;
128127
}
129128

130129
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
131130
{
132-
rect.height = EditorGUIUtility.singleLineHeight;
131+
rect.height = EditorGUIUtility.singleLineHeight;
133132
EditorGUI.BeginChangeCheck();
134133
EditorGUI.BeginProperty(rect, label, property);
135-
if(firstTime)
134+
if (property != m_Property)
136135
Init(property);
137136

138137
var passName = property.serializedObject.FindProperty("m_Name").stringValue;
@@ -169,7 +168,7 @@ public override void OnGUI(Rect rect, SerializedProperty property, GUIContent la
169168

170169
EditorGUI.indentLevel--;
171170
}
172-
171+
173172
EditorGUI.EndProperty();
174173
if (EditorGUI.EndChangeCheck())
175174
property.serializedObject.ApplyModifiedProperties();
@@ -227,7 +226,7 @@ void DoDepthOverride(ref Rect rect)
227226
EditorGUI.indentLevel--;
228227
}
229228
}
230-
229+
231230
void DoCameraOverride(ref Rect rect)
232231
{
233232
EditorGUI.PropertyField(rect, m_OverrideCamera, Styles.overrideCamera);
@@ -248,33 +247,34 @@ void DoCameraOverride(ref Rect rect)
248247
//Restore prev camera projections
249248
EditorGUI.PropertyField(rect, m_RestoreCamera, Styles.restoreCamera);
250249
rect.y += Styles.defaultLineSpace;
251-
250+
252251
EditorGUI.indentLevel--;
253252
}
254253
}
255254

256255
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
257256
{
258257
float height = Styles.defaultLineSpace;
259-
if (!firstTime)
260-
{
261-
262-
height += Styles.defaultLineSpace * (m_FiltersFoldout.value ? m_FilterLines : 1);
263-
height += m_FiltersFoldout.value ? m_ShaderPassesList.GetHeight() : 0;
264-
265-
height += Styles.defaultLineSpace; // add line for overrides dropdown
266-
if (m_RenderFoldout.value)
267-
{
268-
height += Styles.defaultLineSpace * (m_OverrideMaterial.objectReferenceValue != null ? m_MaterialLines : 1);
269-
height += Styles.defaultLineSpace * (m_OverrideDepth.boolValue ? m_DepthLines : 1);
270-
height += EditorGUI.GetPropertyHeight(m_OverrideStencil);
271-
height += Styles.defaultLineSpace * (m_OverrideCamera.boolValue ? m_CameraLines : 1);
272-
}
273-
}
258+
if (property != m_Property)
259+
{
260+
Init(property);
261+
}
262+
263+
height += Styles.defaultLineSpace * (m_FiltersFoldout.value ? m_FilterLines : 1);
264+
height += m_FiltersFoldout.value ? m_ShaderPassesList.GetHeight() : 0;
274265

275-
return height;
266+
height += Styles.defaultLineSpace; // add line for overrides dropdown
267+
if (m_RenderFoldout.value)
268+
{
269+
height += Styles.defaultLineSpace * (m_OverrideMaterial.objectReferenceValue != null ? m_MaterialLines : 1);
270+
height += Styles.defaultLineSpace * (m_OverrideDepth.boolValue ? m_DepthLines : 1);
271+
height += EditorGUI.GetPropertyHeight(m_OverrideStencil);
272+
height += Styles.defaultLineSpace * (m_OverrideCamera.boolValue ? m_CameraLines : 1);
273+
}
274+
275+
return height;
276276
}
277-
277+
278278
private void SaveHeaderBool(HeaderBool boolObj)
279279
{
280280
EditorPrefs.SetBool(boolObj.key, boolObj.value);

0 commit comments

Comments
 (0)