Skip to content

Commit ba49d61

Browse files
axolotoEvergreen
authored andcommitted
Graphics/SRP/RPF - [UUM-70492 bis] Calling Render Graph Viewer before resources deallocation
This is a follow-up PR of #48436 which was a temporary fix of [UUM-70492](https://jira.unity3d.com/browse/UUM-70492): - Safety test is re-enabled in RenderGraphResourceRegistry - Debug data function is called only in Editor mode as Render Graph Viewer is only visible within it. - Debug data filling Render Graph Viewer is generated before Render Graph execution pass where we deallocate resources, potentially corrupting debug data.
1 parent 554cd08 commit ba49d61

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,11 @@ internal void Execute()
12241224

12251225
m_Resources.BeginExecute(m_CurrentFrameIndex);
12261226

1227+
#if UNITY_EDITOR
1228+
// Feeding Render Graph Viewer before resource deallocation at pass execution
1229+
GenerateDebugData();
1230+
#endif
1231+
12271232
if (nativeRenderPassesEnabled)
12281233
ExecuteNativeRenderGraph();
12291234
else
@@ -1249,8 +1254,6 @@ internal void Execute()
12491254
}
12501255
finally
12511256
{
1252-
GenerateDebugData();
1253-
12541257
if (m_DebugParameters.immediateMode)
12551258
ReleaseImmediateModeResources();
12561259

@@ -2547,7 +2550,7 @@ void CleanupDebugData()
25472550
m_DebugData.Clear();
25482551
}
25492552

2550-
#endregion
2553+
#endregion
25512554

25522555

25532556
Dictionary<int, TextureHandle> registeredGlobals = new Dictionary<int, TextureHandle>();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ internal void GetRenderTargetInfo(in ResourceHandle res, out RenderTargetInfo ou
778778
else
779779
{
780780
// Managed by rendergraph, it might not be created yet so we look at the desc to find out
781-
var desc = GetTextureResourceDesc(res, true); // TODO: remove true, we should throw on invalid desc here
781+
var desc = GetTextureResourceDesc(res);
782782
var dim = desc.CalculateFinalDimensions();
783783
outInfo = new RenderTargetInfo();
784784
outInfo.width = dim.x;

0 commit comments

Comments
 (0)