Skip to content

Commit 9e7888e

Browse files
kirill-titov-uEvergreen
authored andcommitted
Revert "Merge PR #74054 from graphics/srp/urp-force-on-tile/intermedi…
1 parent af804c3 commit 9e7888e

34 files changed

+522
-1236
lines changed

Packages/com.unity.render-pipelines.universal/Editor/2D/PixelPerfectCameraEditor.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ private class Style
2222
public const string cameraStackingWarning = "Pixel Perfect Camera won't function properly if stacked with another camera.";
2323
public const string nonRenderer2DWarning = "URP Pixel Perfect Camera requires a camera using a 2D Renderer. Some features, such as Upscale Render Texture, are not supported with other Renderers.";
2424
public const string nonRenderer2DError = "URP Pixel Perfect Camera requires a camera using a 2D Renderer.";
25-
public const string intermediateTextureForbiddenError = "URP Pixel Perfect Camera requires intermediate texture to apply but this is currently prevented on the current URP Asset.";
2625

2726
public GUIStyle centeredLabel;
2827

@@ -86,14 +85,6 @@ bool UsingRenderer2D()
8685
return false;
8786
}
8887

89-
bool IsIntermediateTextureForbidden()
90-
{
91-
var asset = UniversalRenderPipeline.asset as UniversalRenderPipelineAsset;
92-
if (asset == null)
93-
return false;
94-
return asset.intermediateTextureMode == IntermediateTextureMode.Never;
95-
}
96-
9788
void CheckForCameraStacking()
9889
{
9990
m_CameraStacking = false;
@@ -148,11 +139,6 @@ public override void OnInspectorGUI()
148139
EditorGUILayout.HelpBox(Style.nonRenderer2DError, MessageType.Error);
149140
return;
150141
}
151-
else if (IsIntermediateTextureForbidden())
152-
{
153-
EditorGUILayout.HelpBox(Style.intermediateTextureForbiddenError, MessageType.Error);
154-
return;
155-
}
156142
else if (!UsingRenderer2D())
157143
{
158144
EditorGUILayout.HelpBox(Style.nonRenderer2DWarning, MessageType.Warning);

Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DDataEditor.cs

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ private void OnDestroy()
143143
public override void OnInspectorGUI()
144144
{
145145
serializedObject.Update();
146-
147-
DisplayIntermediateTextureWarnings();
148146

149147
DrawFiltering();
150148
DrawGeneral();
@@ -222,11 +220,7 @@ private void DrawGeneral()
222220
if (m_DefaultMaterialType.intValue == (int)Renderer2DData.Renderer2DDefaultMaterialType.Custom)
223221
EditorGUILayout.PropertyField(m_DefaultCustomMaterial, Styles.defaultCustomMaterial);
224222

225-
if (isIntermediateTextureForbidden)
226-
using (new EditorGUI.DisabledScope(true))
227-
EditorGUILayout.Toggle(UniversalRenderPipelineAssetUI.Styles.GetNoIntermediateTextureVariant(Styles.useDepthStencilBuffer), false);
228-
else
229-
EditorGUILayout.PropertyField(m_UseDepthStencilBuffer, Styles.useDepthStencilBuffer);
223+
EditorGUILayout.PropertyField(m_UseDepthStencilBuffer, Styles.useDepthStencilBuffer);
230224

231225
EditorGUI.BeginChangeCheck();
232226
EditorGUILayout.PropertyField(m_HDREmulationScale, Styles.hdrEmulationScale);
@@ -280,28 +274,17 @@ private void DrawPostProcessing()
280274
if (!m_PostProcessingFoldout.value)
281275
return;
282276

283-
if (isIntermediateTextureForbidden)
284-
using (new EditorGUI.DisabledScope(true))
285-
{
286-
EditorGUILayout.Toggle(UniversalRenderPipelineAssetUI.Styles.GetNoIntermediateTextureVariant(Styles.postProcessIncluded), false);
287-
EditorGUI.indentLevel++;
288-
EditorGUILayout.ObjectField(UniversalRenderPipelineAssetUI.Styles.GetNoIntermediateTextureVariant(Styles.postProcessData), null, typeof(PostProcessData), allowSceneObjects: false);
289-
EditorGUI.indentLevel--;
290-
}
291-
else
277+
EditorGUI.BeginChangeCheck();
278+
var postProcessIncluded = EditorGUILayout.Toggle(Styles.postProcessIncluded, m_PostProcessData.objectReferenceValue != null);
279+
if (EditorGUI.EndChangeCheck())
292280
{
293-
EditorGUI.BeginChangeCheck();
294-
var postProcessIncluded = EditorGUILayout.Toggle(Styles.postProcessIncluded, m_PostProcessData.objectReferenceValue != null);
295-
if (EditorGUI.EndChangeCheck())
296-
{
297-
m_PostProcessData.objectReferenceValue = postProcessIncluded ? UnityEngine.Rendering.Universal.PostProcessData.GetDefaultPostProcessData() : null;
298-
}
299-
300-
EditorGUI.indentLevel++;
301-
EditorGUILayout.PropertyField(m_PostProcessData, Styles.postProcessData);
302-
EditorGUI.indentLevel--;
281+
m_PostProcessData.objectReferenceValue = postProcessIncluded ? UnityEngine.Rendering.Universal.PostProcessData.GetDefaultPostProcessData() : null;
303282
}
304283

284+
EditorGUI.indentLevel++;
285+
EditorGUILayout.PropertyField(m_PostProcessData, Styles.postProcessData);
286+
EditorGUI.indentLevel--;
287+
305288
EditorGUILayout.Space();
306289
}
307290
}
Lines changed: 42 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,64 @@
1-
using System.Text;
21
using UnityEditor.Build;
32
using UnityEditor.Build.Reporting;
43
using UnityEngine;
54
using UnityEngine.Rendering;
65
using UnityEngine.Rendering.Universal;
7-
using UnityEngine.SceneManagement;
86

97
namespace UnityEditor.Rendering.Universal
108
{
119
class URPProcessScene : IProcessSceneWithReport
1210
{
1311
public int callbackOrder => 0;
1412

15-
public void OnProcessScene(Scene scene, BuildReport report)
13+
public void OnProcessScene(UnityEngine.SceneManagement.Scene scene, BuildReport report)
1614
{
17-
if (GraphicsSettings.currentRenderPipeline is not UniversalRenderPipelineAsset rpAsset)
18-
return;
19-
20-
var builder = new StringBuilder();
21-
int warningCount = 0;
22-
foreach (GameObject root in scene.GetRootGameObjects())
15+
bool usesURP = false;
16+
if (GraphicsSettings.defaultRenderPipeline as UniversalRenderPipelineAsset != null)
2317
{
24-
foreach (Light light in root.GetComponentsInChildren<Light>(includeInactive: true))
25-
CheckLights(builder, ref warningCount, light);
26-
27-
if (rpAsset.intermediateTextureMode != IntermediateTextureMode.Never)
28-
continue;
29-
30-
foreach (UniversalAdditionalCameraData cameraData in root.GetComponentsInChildren<UniversalAdditionalCameraData>(includeInactive: true))
31-
CheckCameraData(builder, ref warningCount, cameraData);
18+
// ^ The global pipeline is set to URP
19+
usesURP = true;
3220
}
33-
34-
if (warningCount > 0)
35-
Debug.LogWarning($"Scene '{scene.path}' has {warningCount} incompatibilit{(warningCount > 1 ? "ies" : "y")}:\n{builder}");
36-
}
37-
38-
private void CheckLights(StringBuilder builder, ref int count, Light light)
39-
{
40-
switch (light.type)
21+
else
4122
{
42-
case LightType.Rectangle when light.lightmapBakeType != LightmapBakeType.Baked:
43-
AddWarning(builder, ref count,
44-
$"The GameObject '{GetHierarchyPath(light.transform)}' is an area light type, but the mode is not set to baked. URP only supports baked area lights, not realtime or mixed ones.");
45-
break;
46-
case LightType.Directional:
47-
case LightType.Point:
48-
case LightType.Spot:
49-
case LightType.Rectangle:
50-
break; // Supported types.
51-
default:
52-
AddWarning(builder, ref count, $"The {light.type} light type on the GameObject '{GetHierarchyPath(light.transform)}' is unsupported by URP and will not be rendered.");
53-
break;
23+
// ^ The global pipeline isn't set to URP, but a quality setting could still use it
24+
for (int i = 0; i < QualitySettings.count; i++)
25+
{
26+
if (QualitySettings.GetRenderPipelineAssetAt(i) as UniversalRenderPipelineAsset != null)
27+
{
28+
// ^ This quality setting uses URP
29+
usesURP = true;
30+
break;
31+
}
32+
}
5433
}
55-
}
5634

57-
private void CheckCameraData(StringBuilder builder, ref int count, UniversalAdditionalCameraData camData)
58-
{
59-
CheckCameraSetting(builder, ref count, camData, camData.renderPostProcessing, "Post-processing");
60-
CheckCameraSetting(builder, ref count, camData, camData.allowHDROutput, "HDR Output");
61-
CheckCameraSetting(builder, ref count, camData, camData.requiresColorTexture, "_CameraOpaqueTexture");
62-
CheckCameraSetting(builder, ref count, camData, camData.requiresDepthTexture, "_CameraDepthTexture");
63-
}
64-
65-
void CheckCameraSetting(StringBuilder builder, ref int count, UniversalAdditionalCameraData data, bool isEnabled, string featureName)
66-
{
67-
if (isEnabled)
68-
AddWarning(builder, ref count,
69-
$"Camera '{GetHierarchyPath(data.transform)}': '{featureName}' is enabled, but the URP Asset disables the required intermediate texture. The feature will be skipped.");
70-
}
71-
72-
void AddWarning(StringBuilder builder, ref int currentCount, string message)
73-
{
74-
currentCount++;
75-
builder.AppendLine($" - {currentCount}: {message}");
76-
}
77-
78-
string GetHierarchyPath(Transform transform)
79-
{
80-
using (ListPool<string>.Get(out var pathSegments))
35+
if (usesURP)
8136
{
82-
for (var t = transform; t != null; t = t.parent)
83-
pathSegments.Add(t.name);
84-
pathSegments.Reverse();
85-
return string.Join("/", pathSegments);
37+
GameObject[] roots = scene.GetRootGameObjects();
38+
39+
foreach (GameObject root in roots)
40+
{
41+
Light[] lights = root.GetComponentsInChildren<Light>();
42+
foreach (Light light in lights)
43+
{
44+
if (light.type != LightType.Directional &&
45+
light.type != LightType.Point &&
46+
light.type != LightType.Spot &&
47+
light.type != LightType.Rectangle)
48+
{
49+
Debug.LogWarning(
50+
$"The {light.type} light type on the GameObject '{light.gameObject.name}' is unsupported by URP, and will not be rendered."
51+
);
52+
}
53+
else if (light.type == LightType.Rectangle && light.lightmapBakeType != LightmapBakeType.Baked)
54+
{
55+
Debug.LogWarning(
56+
$"The GameObject '{light.gameObject.name}' is an area light type, but the mode is not set to baked. URP only supports baked area lights, not realtime or mixed ones."
57+
);
58+
}
59+
}
60+
}
8661
}
8762
}
8863
}
89-
}
64+
}

0 commit comments

Comments
 (0)