public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { var camera = renderingData.cameraData.camera; var outlineEffect = Outliner; if (outlineEffect == null || !outlineEffect.enabled) { return; } #if UNITY_EDITOR Parameters.Buffer.name = renderingData.cameraData.camera.name; #endif Outlinable.GetAllActiveOutlinables(renderingData.cameraData.camera, Parameters.OutlinablesToRender); RendererFilteringUtility.Filter(renderingData.cameraData.camera, Parameters); Outliner.UpdateSharedParameters(Parameters, renderingData.cameraData.camera, renderingData.cameraData.isSceneViewCamera); var targetTexture = camera.targetTexture == null ? camera.activeTexture : camera.targetTexture; if (UnityEngine.XR.XRSettings.enabled && !Parameters.IsEditorCamera && Parameters.EyeMask != StereoTargetEyeMask.None) { var descriptor = UnityEngine.XR.XRSettings.eyeTextureDesc; Parameters.TargetWidth = descriptor.width; Parameters.TargetHeight = descriptor.height; } else { Parameters.TargetWidth = targetTexture != null ? targetTexture.width : (int)(camera.scaledPixelWidth * renderingData.cameraData.renderScale); Parameters.TargetHeight = targetTexture != null ? targetTexture.height : (int)(camera.scaledPixelHeight * renderingData.cameraData.renderScale); } Parameters.Antialiasing = renderingData.cameraData.cameraTargetDescriptor.msaaSamples; var useCustomRenderTarget = Outliner.HasCutomRenderTarget && !renderingData.cameraData.isSceneViewCamera; Parameters.Target = RenderTargetUtility.ComposeTarget(Parameters, useCustomRenderTarget ? Outliner.GetRenderTarget(Parameters) : Renderer.cameraColorTarget); Parameters.DepthTarget = #if UNITY_2019_3_OR_NEWER && !UNITY_2019_3_0 && !UNITY_2019_3_1 && !UNITY_2019_3_2 && !UNITY_2019_3_3 && !UNITY_2019_3_4 && !UNITY_2019_3_5 && !UNITY_2019_3_6 && !UNITY_2019_3_7 && !UNITY_2019_3_8 RenderTargetUtility.ComposeTarget(Parameters, UseColorTargetForDepth ? Renderer.cameraColorTarget : #if UNITY_2020_2_OR_NEWER Renderer.cameraDepthTarget); #else Renderer.cameraDepth); #endif #else RenderTargetUtility.ComposeTarget(Parameters, Renderer.cameraColorTarget); #endif Parameters.Buffer.Clear(); if (Outliner.RenderingStrategy == OutlineRenderingStrategy.Default) { OutlineEffect.SetupOutline(Parameters); Parameters.BlitMesh = null; Parameters.MeshPool.ReleaseAllMeshes(); } else { temporaryOutlinables.Clear(); temporaryOutlinables.AddRange(Parameters.OutlinablesToRender); Parameters.OutlinablesToRender.Clear(); Parameters.OutlinablesToRender.Add(null); foreach (var outlinable in temporaryOutlinables) { Parameters.OutlinablesToRender[0] = outlinable; OutlineEffect.SetupOutline(Parameters); Parameters.BlitMesh = null; } Parameters.MeshPool.ReleaseAllMeshes(); } context.ExecuteCommandBuffer(Parameters.Buffer); }