diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs index 4eed8e821fb..8e7ee09e4eb 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -27,8 +27,6 @@ public override void Setup() var hdrpAsset = HDRenderPipeline.defaultAsset; if (hdrpAsset != null) m_Material = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.alphaInjectionPS); - - name = "AlphaInjection"; // Needed to get a scope name in RenderDoc captures } public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs index 03e13a689e1..42241172924 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs @@ -30,8 +30,6 @@ public override void Setup() var hdrpAsset = HDRenderPipeline.defaultAsset; if (hdrpAsset != null) m_Material = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.chromaKeyingPS); - - name = "ChromaKeying"; // Needed to get a scope name in RenderDoc captures } public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index a475ebe798a..df1272d3647 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -551,6 +551,10 @@ void OnDestroy() CoreUtils.Destroy(volume); } } + + // We don't need the custom passes anymore + var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline; + UnRegisterCustomPasses(hdPipeline); } public void AddInputFilterAtLayer(CompositionFilter filter, int index) @@ -929,14 +933,12 @@ static internal void RegisterCustomPasses(HDRenderPipeline hdPipeline) } // If custom post processes are not registered in the HDRP asset, they are never executed so we have to add them manually - int indx = hdPipeline.asset.beforePostProcessCustomPostProcesses.FindIndex(x => x == typeof(ChromaKeying).AssemblyQualifiedName); - if (indx < 0) + if (!hdPipeline.asset.beforePostProcessCustomPostProcesses.Contains(typeof(ChromaKeying).AssemblyQualifiedName)) { hdPipeline.asset.beforePostProcessCustomPostProcesses.Add(typeof(ChromaKeying).AssemblyQualifiedName); } - indx = hdPipeline.asset.beforePostProcessCustomPostProcesses.FindIndex(x => x == typeof(AlphaInjection).AssemblyQualifiedName); - if (indx < 0) + if (!hdPipeline.asset.beforePostProcessCustomPostProcesses.Contains(typeof(AlphaInjection).AssemblyQualifiedName)) { hdPipeline.asset.beforePostProcessCustomPostProcesses.Add(typeof(AlphaInjection).AssemblyQualifiedName); } @@ -950,14 +952,12 @@ static internal void UnRegisterCustomPasses(HDRenderPipeline hdPipeline) return; } - int indx = hdPipeline.asset.beforePostProcessCustomPostProcesses.FindIndex(x => x == typeof(ChromaKeying).AssemblyQualifiedName); - if (indx >= 0) + if (hdPipeline.asset.beforePostProcessCustomPostProcesses.Contains(typeof(ChromaKeying).AssemblyQualifiedName)) { hdPipeline.asset.beforePostProcessCustomPostProcesses.Remove(typeof(ChromaKeying).AssemblyQualifiedName); } - indx = hdPipeline.asset.beforePostProcessCustomPostProcesses.FindIndex(x => x == typeof(AlphaInjection).AssemblyQualifiedName); - if (indx >= 0) + if (hdPipeline.asset.beforePostProcessCustomPostProcesses.Contains(typeof(AlphaInjection).AssemblyQualifiedName)) { hdPipeline.asset.beforePostProcessCustomPostProcesses.Remove(typeof(AlphaInjection).AssemblyQualifiedName); }