/// <inheritdoc/> public override void Execute(ScriptableRenderer renderer, ScriptableRenderContext context, ref RenderingData renderingData) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } CommandBuffer cmd = CommandBufferPool.Get(k_PostProcessingTag); var layer = renderingData.cameraData.postProcessLayer; int effectsCount; if (opaquePost) { effectsCount = layer.sortedBundles[PostProcessEvent.BeforeTransparent].Count; } else { effectsCount = layer.sortedBundles[PostProcessEvent.BeforeStack].Count + layer.sortedBundles[PostProcessEvent.AfterStack].Count; } // If there's only one effect in the stack and soure is same as dest we // create an intermediate blit rendertarget to handle it. // Otherwise, PostProcessing system will create the intermediate blit targets itself. if (effectsCount == 1 && source.id == destination.id) { m_ReleaseTemporaryRenderTexture = true; cmd.GetTemporaryRT(m_TemporaryColorTexture.id, descriptor, FilterMode.Point); renderer.RenderPostProcess(cmd, ref renderingData.cameraData, descriptor.colorFormat, source.Identifier(), m_TemporaryColorTexture.Identifier(), opaquePost, flip); cmd.Blit(m_TemporaryColorTexture.Identifier(), source.Identifier()); } else { renderer.RenderPostProcess(cmd, ref renderingData.cameraData, descriptor.colorFormat, source.Identifier(), destination.Identifier(), opaquePost, flip); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
/// <inheritdoc/> public override void Execute(ScriptableRenderer renderer, ScriptableRenderContext context, ref RenderingData renderingData) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } CommandBuffer cmd = CommandBufferPool.Get(k_PostProcessingTag); renderer.RenderPostProcess(cmd, ref renderingData.cameraData, descriptor.colorFormat, source.Identifier(), destination.Identifier(), opaquePost, flip); context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }