Skip to content

Commit fb37597

Browse files
axolotoEvergreen
authored andcommitted
Graphics/SRP - Removal of Legacy Render Graph (former HDRP Render Graph)
1 parent a744dc0 commit fb37597

39 files changed

Lines changed: 314 additions & 2174 deletions

File tree

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphTestsCore.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public void Setup()
144144

145145
// Getting the RG from the custom asset pipeline
146146
m_RenderGraph = m_RenderGraphTestPipeline.renderGraph;
147-
m_RenderGraph.nativeRenderPassesEnabled = true;
148147

149148
// Necessary to disable it for the Unit Tests, as the caller is not the same.
150149
RenderGraph.RenderGraphExceptionMessages.enableCaller = false;

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.SidePanel.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ public partial class RenderGraphViewer
1212
{
1313
static readonly string[] k_PassTypeNames =
1414
{
15-
"Legacy Render Pass",
1615
"Unsafe Render Pass",
1716
"Raster Render Pass",
1817
"Compute Pass"
1918
};
2019

2120
static readonly string[] k_PassTypeNamesNotMergedMessage =
2221
{
23-
"This is a Legacy Render Pass. Only Raster Render Passes can be merged.",
2422
"This is an Unsafe Render Pass. Only Raster Render Passes can be merged.",
2523
"Pass merging was disabled.",
2624
"This is a Compute Pass. Only Raster Render Passes can be merged."
@@ -292,8 +290,7 @@ void PopulateResourceList()
292290
resourceItem.Add(new Label($"Clear: {resourceData.textureData.clearBuffer}"));
293291
resourceItem.Add(new Label($"BindMS: {resourceData.textureData.bindMS}"));
294292
resourceItem.Add(new Label($"Samples: {resourceData.textureData.samples}"));
295-
if (m_CurrentDebugData.isNRPCompiler)
296-
resourceItem.Add(new Label($"Memoryless: {resourceData.memoryless}"));
293+
resourceItem.Add(new Label($"Memoryless: {resourceData.memoryless}"));
297294
}
298295
else if (type == RenderGraphResourceType.Buffer && resourceData.bufferData != null)
299296
{
@@ -315,11 +312,6 @@ void PopulateResourceList()
315312
void PopulatePassList()
316313
{
317314
HeaderFoldout headerFoldout = rootVisualElement.Q<HeaderFoldout>(Names.kPassListFoldout);
318-
if (!m_CurrentDebugData.isNRPCompiler)
319-
{
320-
headerFoldout.style.display = DisplayStyle.None;
321-
return;
322-
}
323315
headerFoldout.style.display = DisplayStyle.Flex;
324316

325317
ScrollView content = headerFoldout.Q<ScrollView>();
@@ -501,7 +493,7 @@ void SaveSplitViewFixedPaneHeight()
501493

502494
void UpdatePanelHeights()
503495
{
504-
bool passListExpanded = m_PassListExpanded && HasValidDebugData && m_CurrentDebugData.isNRPCompiler;
496+
bool passListExpanded = m_PassListExpanded && HasValidDebugData;
505497
const int kFoldoutHeaderHeightPx = 18;
506498
const int kFoldoutHeaderExpandedMinHeightPx = 50;
507499
const int kWindowExtraMarginPx = 6;

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs

Lines changed: 36 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ internal static partial class Classes
146146
int m_CurrentHoveredVisibleResourceIndex = -1;
147147
int m_CurrentSelectedVisiblePassIndex = -1;
148148

149-
const string kPassFilterLegacyEditorPrefsKey = "RenderGraphViewer.PassFilterLegacy";
150149
const string kPassFilterEditorPrefsKey = "RenderGraphViewer.PassFilter";
151150
const string kResourceFilterEditorPrefsKey = "RenderGraphViewer.ResourceFilter";
152151
const string kSelectedExecutionEditorPrefsKey = "RenderGraphViewer.SelectedExecution";
@@ -156,7 +155,6 @@ internal static partial class Classes
156155
IVisualElementScheduledItem m_RefreshUIDelayed;
157156

158157
PassFilter m_PassFilter = PassFilter.CulledPasses | PassFilter.RasterPasses | PassFilter.UnsafePasses | PassFilter.ComputePasses;
159-
PassFilterLegacy m_PassFilterLegacy = PassFilterLegacy.CulledPasses;
160158

161159
ResourceFilter m_ResourceFilter =
162160
ResourceFilter.ImportedResources | ResourceFilter.Textures |
@@ -215,12 +213,6 @@ static void Init()
215213
window.minSize = new Vector2(880f, 300f);
216214
}
217215

218-
[Flags]
219-
enum PassFilterLegacy
220-
{
221-
CulledPasses = 1 << 0,
222-
}
223-
224216
[Flags]
225217
enum PassFilter
226218
{
@@ -375,34 +367,31 @@ void UpdatePassBlocksToSelectedState(List<int> selectedPassIds)
375367
var pass = m_CurrentDebugData.passList[passIdInGroup];
376368

377369
// Native pass compatibility
378-
if (m_CurrentDebugData.isNRPCompiler)
370+
if (pass.nrpInfo.nativePassInfo != null && pass.nrpInfo.nativePassInfo.passCompatibility.Count > 0)
379371
{
380-
if (pass.nrpInfo.nativePassInfo != null && pass.nrpInfo.nativePassInfo.passCompatibility.Count > 0)
372+
foreach (var msg in pass.nrpInfo.nativePassInfo.passCompatibility)
381373
{
382-
foreach (var msg in pass.nrpInfo.nativePassInfo.passCompatibility)
374+
int linkedPassId = msg.Key;
375+
string compatibilityMessage = msg.Value.message;
376+
var linkedPassGroup = GetGroupedPassIds(linkedPassId);
377+
foreach (var passIdInLinkedPassGroup in linkedPassGroup)
383378
{
384-
int linkedPassId = msg.Key;
385-
string compatibilityMessage = msg.Value.message;
386-
var linkedPassGroup = GetGroupedPassIds(linkedPassId);
387-
foreach (var passIdInLinkedPassGroup in linkedPassGroup)
388-
{
389-
if (selectedPassIds.Contains(passIdInLinkedPassGroup))
390-
continue; // Don't show compatibility info among passes that are merged
379+
if (selectedPassIds.Contains(passIdInLinkedPassGroup))
380+
continue; // Don't show compatibility info among passes that are merged
391381

392-
if (m_PassIdToVisiblePassIndex.TryGetValue(passIdInLinkedPassGroup,
393-
out int visiblePassIndexInLinkedPassGroup))
394-
{
395-
var info = m_PassElementsInfo[visiblePassIndexInLinkedPassGroup];
396-
info.hasPassCompatibilityTooltip = true;
397-
info.isPassCompatibleToMerge = msg.Value.isCompatible;
398-
info.passBlock.tooltip = compatibilityMessage;
399-
}
382+
if (m_PassIdToVisiblePassIndex.TryGetValue(passIdInLinkedPassGroup,
383+
out int visiblePassIndexInLinkedPassGroup))
384+
{
385+
var info = m_PassElementsInfo[visiblePassIndexInLinkedPassGroup];
386+
info.hasPassCompatibilityTooltip = true;
387+
info.isPassCompatibleToMerge = msg.Value.isCompatible;
388+
info.passBlock.tooltip = compatibilityMessage;
400389
}
401390
}
402-
403-
// Each native pass has compatibility messages, it's enough to process the first one
404-
break;
405391
}
392+
393+
// Each native pass has compatibility messages, it's enough to process the first one
394+
break;
406395
}
407396

408397
// Async compute dependencies
@@ -1017,7 +1006,7 @@ void SaveFilterEnabledState(string prefsKey, bool enabled)
10171006

10181007
void UpdateFilterEnabledState(string prefsKey, bool enabled)
10191008
{
1020-
if (prefsKey == kPassFilterEditorPrefsKey || prefsKey == kPassFilterLegacyEditorPrefsKey)
1009+
if (prefsKey == kPassFilterEditorPrefsKey)
10211010
m_PassFilterEnabled = enabled;
10221011
else if (prefsKey == kResourceFilterEditorPrefsKey)
10231012
m_ResourceFilterEnabled = enabled;
@@ -1042,14 +1031,9 @@ void RebuildResourceFilterUI()
10421031
void RebuildPassFilterUI()
10431032
{
10441033
var passFilter = rootVisualElement.Q<ToggleDropdown>(Names.kPassFilterField);
1045-
if (m_CurrentDebugData?.isNRPCompiler ?? false)
1046-
{
1047-
BuildEnumFlagsToggleDropdown(passFilter, m_PassFilter, kPassFilterEditorPrefsKey, val => m_PassFilter = val, true);
1048-
}
1049-
else
1050-
{
1051-
BuildEnumFlagsToggleDropdown(passFilter, m_PassFilterLegacy, kPassFilterLegacyEditorPrefsKey, val => m_PassFilterLegacy = val, true);
1052-
}
1034+
1035+
BuildEnumFlagsToggleDropdown(passFilter, m_PassFilter, kPassFilterEditorPrefsKey, val => m_PassFilter = val, true);
1036+
10531037
passFilter.text = L10n.Tr("Pass Filter");
10541038
}
10551039

@@ -1203,6 +1187,17 @@ bool IsResourceVisible(RenderGraph.DebugData.ResourceData resource, RenderGraphR
12031187
return true;
12041188
}
12051189

1190+
private bool IsPassTypeAllowed(RenderGraphPassType passType)
1191+
{
1192+
return passType switch
1193+
{
1194+
RenderGraphPassType.Compute => m_PassFilter.HasFlag(PassFilter.ComputePasses),
1195+
RenderGraphPassType.Raster => m_PassFilter.HasFlag(PassFilter.RasterPasses),
1196+
RenderGraphPassType.Unsafe => m_PassFilter.HasFlag(PassFilter.UnsafePasses),
1197+
_ => true // Allow unknown types by default
1198+
};
1199+
}
1200+
12061201
bool IsPassVisible(RenderGraph.DebugData.PassData pass)
12071202
{
12081203
if (!pass.generateDebugData)
@@ -1211,24 +1206,10 @@ bool IsPassVisible(RenderGraph.DebugData.PassData pass)
12111206
if (!m_PassFilterEnabled)
12121207
return true;
12131208

1214-
if (m_CurrentDebugData.isNRPCompiler)
1215-
{
1216-
if (pass.culled && !m_PassFilter.HasFlag(PassFilter.CulledPasses))
1217-
return false;
1218-
if (pass.type == RenderGraphPassType.Compute && !m_PassFilter.HasFlag(PassFilter.ComputePasses))
1219-
return false;
1220-
if (pass.type == RenderGraphPassType.Raster && !m_PassFilter.HasFlag(PassFilter.RasterPasses))
1221-
return false;
1222-
if (pass.type == RenderGraphPassType.Unsafe && !m_PassFilter.HasFlag(PassFilter.UnsafePasses))
1223-
return false;
1224-
}
1225-
else
1226-
{
1227-
if (pass.culled && !m_PassFilterLegacy.HasFlag(PassFilterLegacy.CulledPasses))
1228-
return false;
1229-
}
1209+
if (pass.culled && !m_PassFilter.HasFlag(PassFilter.CulledPasses))
1210+
return false;
12301211

1231-
return true;
1212+
return IsPassTypeAllowed(pass.type);
12321213
}
12331214

12341215
static readonly string[] k_ResourceNames =
@@ -2091,8 +2072,6 @@ void CreateGUI()
20912072
{
20922073
s_EditorWindowEntityId = GetEntityId();
20932074

2094-
if (EditorPrefs.HasKey(kPassFilterLegacyEditorPrefsKey))
2095-
m_PassFilterLegacy = (PassFilterLegacy)EditorPrefs.GetInt(kPassFilterLegacyEditorPrefsKey);
20962075
if (EditorPrefs.HasKey(kPassFilterEditorPrefsKey))
20972076
m_PassFilter = (PassFilter)EditorPrefs.GetInt(kPassFilterEditorPrefsKey);
20982077
if (EditorPrefs.HasKey(kResourceFilterEditorPrefsKey))

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/CompilerContextData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal static int LastIndex<T>(this ref NativeList<T> list) where T : unmanage
4141

4242
// Note pass=node in the graph, both are sometimes mixed up here
4343
// Datastructure that contains passes and dependencies and allow you to iterate and reason on them more like a graph
44-
internal class CompilerContextData : IDisposable, RenderGraph.ICompiledGraph
44+
internal class CompilerContextData : IDisposable
4545
{
4646
public CompilerContextData()
4747
{

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ internal void GenerateNativeCompilerDebugData(ref RenderGraph.DebugData debugDat
136136
{
137137
ref var ctx = ref contextData;
138138

139-
debugData.isNRPCompiler = true;
140-
141139
// Resolve read/write lists per resource
142140
Dictionary<(RenderGraphResourceType, int), List<int>> resourceReadLists = new Dictionary<(RenderGraphResourceType, int), List<int>>();
143141
Dictionary<(RenderGraphResourceType, int), List<int>> resourceWriteLists = new Dictionary<(RenderGraphResourceType, int), List<int>>();

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,6 @@ void BuildGraph()
361361
{
362362
var inputPass = passes[passId];
363363

364-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
365-
if (inputPass.type == RenderGraphPassType.Legacy)
366-
{
367-
throw new Exception(RenderGraph.RenderGraphExceptionMessages.UsingLegacyRenderGraph(inputPass.name));
368-
}
369-
#endif
370-
371364
// Accessing already existing passData in place in the container through reference to avoid deep copy
372365
// Make sure everything is reset and initialized or we will use obsolete data from previous frame
373366
ref var ctxPass = ref ctx.passData.ElementAt(passId);

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Debug/RenderGraph.DebugData.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public DebugData(string executionName)
4242
// Compilation hash of the render graph that produced this DebugData.
4343
public int graphHash;
4444

45-
// If true, the data was output by NRP compiler, in which case PassData.nrpInfo is available.
46-
public bool isNRPCompiler;
47-
4845
[Serializable]
4946
public class ResourceLists<T>
5047
{

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Debug/RenderGraphDebugParams.cs

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,13 @@ class RenderGraphDebugParams : IDebugDisplaySettingsQuery
1212
public bool clearRenderTargetsAtRelease;
1313
public bool disablePassCulling;
1414
public bool disablePassMerging;
15-
public bool immediateMode;
16-
public bool logFrameInformation;
17-
public bool logResources;
18-
19-
public bool enableLogging => logFrameInformation || logResources;
20-
21-
public void ResetLogging()
22-
{
23-
logFrameInformation = false;
24-
logResources = false;
25-
}
2615

2716
internal void Reset()
2817
{
2918
clearRenderTargetsAtCreation = false;
3019
clearRenderTargetsAtRelease = false;
3120
disablePassCulling = false;
3221
disablePassMerging = false;
33-
immediateMode = false;
34-
35-
ResetLogging();
3622
}
3723

3824
private static class Strings
@@ -41,10 +27,6 @@ private static class Strings
4127
public static readonly NameAndTooltip ClearRenderTargetsAtFree = new() { name = "Clear Render Targets When Freed", tooltip = "Enable to clear all render textures when textures are freed by the graph to detect use after free of textures." };
4228
public static readonly NameAndTooltip DisablePassCulling = new() { name = "Disable Pass Culling", tooltip = "Enable to temporarily disable culling to assess if a pass is culled." };
4329
public static readonly NameAndTooltip DisablePassMerging = new() { name = "Disable Pass Merging", tooltip = "Enable to temporarily disable pass merging to diagnose issues or analyze performance." };
44-
public static readonly NameAndTooltip ImmediateMode = new() { name = "Immediate Mode", tooltip = "Enable to force render graph to execute all passes in the order you registered them." };
45-
public static readonly NameAndTooltip EnableLogging = new() { name = "Enable Logging", tooltip = "Enable to allow HDRP to capture information in the log." };
46-
public static readonly NameAndTooltip LogFrameInformation = new() { name = "Log Frame Information", tooltip = "Enable to log information output from each frame." };
47-
public static readonly NameAndTooltip LogResources = new() { name = "Log Resources", tooltip = "Enable to log the current render graph's global resource usage." };
4830
}
4931

5032
internal List<DebugUI.Widget> GetWidgetList(string name)
@@ -81,37 +63,6 @@ private static class Strings
8163
nameAndTooltip = Strings.DisablePassMerging,
8264
getter = () => disablePassMerging,
8365
setter = value => disablePassMerging = value,
84-
isHiddenCallback = () => !RenderGraph.hasAnyRenderGraphWithNativeRenderPassesEnabled
85-
},
86-
new DebugUI.BoolField
87-
{
88-
nameAndTooltip = Strings.ImmediateMode,
89-
getter = () => immediateMode,
90-
setter = value => immediateMode = value,
91-
// [UUM-64948] Temporarily disable for URP while we implement support for Immediate Mode in the RenderGraph
92-
isHiddenCallback = () => !IsImmediateModeSupported()
93-
},
94-
new DebugUI.Button
95-
{
96-
nameAndTooltip = Strings.LogFrameInformation,
97-
action = () =>
98-
{
99-
logFrameInformation = true;
100-
#if UNITY_EDITOR
101-
UnityEditor.SceneView.RepaintAll();
102-
#endif
103-
}
104-
},
105-
new DebugUI.Button
106-
{
107-
nameAndTooltip = Strings.LogResources,
108-
action = () =>
109-
{
110-
logResources = true;
111-
#if UNITY_EDITOR
112-
UnityEditor.SceneView.RepaintAll();
113-
#endif
114-
}
11566
}
11667
}
11768
}
@@ -120,12 +71,6 @@ private static class Strings
12071
return list;
12172
}
12273

123-
private bool IsImmediateModeSupported()
124-
{
125-
return GraphicsSettings.currentRenderPipeline is IRenderGraphEnabledRenderPipeline rgPipeline &&
126-
rgPipeline.isImmediateModeSupported;
127-
}
128-
12974
public void RegisterDebug(string name, DebugUI.Panel debugPanel = null)
13075
{
13176
var list = GetWidgetList(name);
@@ -152,9 +97,7 @@ public bool AreAnySettingsActive
15297
return clearRenderTargetsAtCreation ||
15398
clearRenderTargetsAtRelease ||
15499
disablePassCulling ||
155-
disablePassMerging ||
156-
immediateMode ||
157-
enableLogging;
100+
disablePassMerging;
158101
}
159102
}
160103
}

0 commit comments

Comments
 (0)