diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index 7313f2087da..53b4d776d74 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -9,7 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Version Updated The version number for this package has increased due to a version update of a related graphics package. -### Fixed +## Fixed +- Fixed a performance regression in the 2D renderer regarding the PostProcessPass [case 1347893] +- Fixed a regression where filtering the scene view yielded incorrect visual results [case 1360233] (https://issuetracker.unity3d.com/product/unity/issues/guid/1360233) - Fixed broken soft shadow filtering. [case 1374960](https://issuetracker.unity3d.com/product/unity/issues/guid/1374960/) - Fixed incorrect light indexing on Windows Editor with Android target. [case 1378103](https://issuetracker.unity3d.com/product/unity/issues/guid/1378103/) diff --git a/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs b/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs index d481dafe5f1..7acb9c14e0f 100644 --- a/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs +++ b/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs @@ -541,6 +541,7 @@ void Swap(ref ScriptableRenderer r) RenderTargetHandle cameraTargetHandle = RenderTargetHandle.GetCameraTarget(cameraData.xr); RenderTargetIdentifier cameraTarget = (cameraData.targetTexture != null && !cameraData.xr.enabled) ? new RenderTargetIdentifier(cameraData.targetTexture) : cameraTargetHandle.Identifier(); + // With camera stacking we not always resolve post to final screen as we might run post-processing in the middle of the stack. if (m_UseSwapBuffer) { cameraTarget = (m_ResolveToScreen) ? cameraTarget : targetDestination; @@ -551,9 +552,6 @@ void Swap(ref ScriptableRenderer r) m_ResolveToScreen = cameraData.resolveFinalTarget || (m_Destination == cameraTargetHandle || m_HasFinalPass == true); } - // With camera stacking we not always resolve post to final screen as we might run post-processing in the middle of the stack. - bool finishPostProcessOnScreen = m_ResolveToScreen; - #if ENABLE_VR && ENABLE_XR_MODULE if (cameraData.xr.enabled) { @@ -575,7 +573,7 @@ void Swap(ref ScriptableRenderer r) // For now, when render post - processing in the middle of the camera stack(not resolving to screen) // we do an extra blit to ping pong results back to color texture. In future we should allow a Swap of the current active color texture // in the pipeline to avoid this extra blit. - if (!finishPostProcessOnScreen && !m_UseSwapBuffer) + if (!m_ResolveToScreen && !m_UseSwapBuffer) { cmd.SetGlobalTexture(ShaderPropertyId.sourceTex, cameraTarget); cmd.SetRenderTarget(new RenderTargetIdentifier(m_Source, 0, CubemapFace.Unknown, -1), @@ -602,7 +600,7 @@ void Swap(ref ScriptableRenderer r) // For now, when render post-processing in the middle of the camera stack (not resolving to screen) // we do an extra blit to ping pong results back to color texture. In future we should allow a Swap of the current active color texture // in the pipeline to avoid this extra blit. - if (!finishPostProcessOnScreen && !m_UseSwapBuffer) + if (!m_ResolveToScreen && !m_UseSwapBuffer) { cmd.SetGlobalTexture(ShaderPropertyId.sourceTex, cameraTarget); cmd.SetRenderTarget(m_Source, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.DontCare); diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index 082616b3f66..be3144b1ae6 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -538,9 +538,11 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re if (cameraData.renderType == CameraRenderType.Base) { RenderTargetHandle cameraTargetHandle = RenderTargetHandle.GetCameraTarget(cameraData.xr); + bool sceneViewFilterEnabled = camera.sceneViewFilterMode == Camera.SceneViewFilterMode.ShowFiltered; - m_ActiveCameraColorAttachment = (createColorTexture) ? m_ColorBufferSystem.GetBackBuffer() : cameraTargetHandle; - m_ActiveCameraDepthAttachment = (createDepthTexture) ? m_CameraDepthAttachment : cameraTargetHandle; + //Scene filtering redraws the objects on top of the resulting frame. It has to draw directly to the sceneview buffer. + m_ActiveCameraColorAttachment = (createColorTexture && !sceneViewFilterEnabled) ? m_ColorBufferSystem.GetBackBuffer() : cameraTargetHandle; + m_ActiveCameraDepthAttachment = (createDepthTexture && !sceneViewFilterEnabled) ? m_CameraDepthAttachment : cameraTargetHandle; bool intermediateRenderTexture = createColorTexture || createDepthTexture;