/// <summary>
 /// Configure the pass with the source and destination to execute on.
 /// </summary>
 /// <param name="source">Source Render Target</param>
 /// <param name="destination">Destination Render Target</param>
 public void Setup(RenderTextureDescriptor descriptor, RenderTargetHandle source, RenderTargetHandle depth, RenderTargetHandle destination)
 {
     this.source      = source;
     this.destination = destination;
     this.depth       = depth;
     baseDescriptor   = descriptor;
 }
 public void Setup(
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     descriptor = baseDescriptor;
 }
示例#3
0
 /// <summary>
 /// Configure the pass with the source and destination to execute on.
 /// </summary>
 /// <param name="source">Source Render Target</param>
 /// <param name="destination">Destination Render Target</param>
 public void Setup(RenderTextureDescriptor baseDescriptor, SampleCount sampleCount, RenderTargetHandle source, RenderTargetHandle intermediate, RenderTargetHandle destination)
 {
     this.source       = source;
     this.destination  = destination;
     this.intermediate = intermediate;
     descriptor        = baseDescriptor;
     this.sampleCount  = sampleCount;
 }
示例#4
0
 public void Setup(
     PostProcessRenderContext postProcessRenderContext,
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     descriptor = baseDescriptor;
 }
示例#5
0
 public override void FrameCleanup(CommandBuffer cmd)
 {
     if (destination != RenderTargetHandle.CameraTarget)
     {
         cmd.ReleaseTemporaryRT(destination.id);
         destination = RenderTargetHandle.CameraTarget;
     }
 }
示例#6
0
 /// <summary>
 /// Setup the pass
 /// </summary>
 /// <param name="baseDescriptor"></param>
 /// <param name="colorAttachmentHandle">Source of rendering to execute the post on</param>
 /// <param name="destination">Destination target for the final blit</param>
 public void Setup(
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle,
     RenderTargetIdentifier destination)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     this.destination           = destination;
     descriptor = baseDescriptor;
 }
 /// <summary>
 /// Configure the pass
 /// </summary>
 public void Setup(
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle,
     SampleCount samples)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     this.samples = samples;
     descriptor   = baseDescriptor;
 }
示例#8
0
        public void Setup(
            RenderTextureDescriptor baseDescriptor,
            RenderTargetHandle colorAttachmentHandle)
        {
            this.colorAttachmentHandle = colorAttachmentHandle;

            baseDescriptor.depthBufferBits = 0;
            baseDescriptor.colorFormat     = m_ColorFormat;
            descriptor = baseDescriptor;
        }
 public void Setup(
     PostProcessRenderContext postProcessRenderContext,
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle,
     RenderTargetIdentifier destination)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     this.postContext           = postProcessRenderContext;
     this.destination           = destination;
     descriptor = baseDescriptor;
 }
 /// <summary>
 /// Configure the pass before execution
 /// </summary>
 /// <param name="baseDescriptor">Current target descriptor</param>
 /// <param name="colorAttachmentHandle">Color attachment to render into</param>
 /// <param name="depthAttachmentHandle">Depth attachment to render into</param>
 /// <param name="configuration">Specific render configuration</param>
 public void Setup(
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle,
     RenderTargetHandle depthAttachmentHandle,
     RendererConfiguration configuration)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     this.depthAttachmentHandle = depthAttachmentHandle;
     descriptor            = baseDescriptor;
     rendererConfiguration = configuration;
 }
        public void Setup(RenderTargetHandle destination, int maxVisibleLocalLights)
        {
            this.destination = destination;

            if (m_LocalShadowMatrices.Length != maxVisibleLocalLights)
            {
                m_LocalShadowMatrices = new Matrix4x4[maxVisibleLocalLights];
                m_LocalLightSlices    = new ShadowSliceData[maxVisibleLocalLights];
                m_LocalShadowStrength = new float[maxVisibleLocalLights];
            }
        }
        /// <summary>
        /// Configure the pass before execution
        /// </summary>
        /// <param name="baseDescriptor">Current target descriptor</param>
        /// <param name="colorAttachmentHandle">Color attachment to render into</param>
        /// <param name="depthAttachmentHandle">Depth attachment to render into</param>
        /// <param name="configuration">Specific render configuration</param>
        public void Setup(
            RenderTextureDescriptor baseDescriptor,
            RenderTargetHandle colorAttachmentHandle,
            RenderTargetHandle depthAttachmentHandle,
            RendererConfiguration configuration,
            SampleCount samples)
        {
            this._ColorAttachmentHandle = colorAttachmentHandle;
            this._DepthAttachmentHandle = depthAttachmentHandle;
            _Descriptor            = baseDescriptor;
            _RendererConfiguration = configuration;

            if ((int)samples > 1)
            {
                baseDescriptor.bindMS      = false;
                baseDescriptor.msaaSamples = (int)samples;
            }

            baseDescriptor.colorFormat     = RenderTextureFormat.ARGBHalf;
            baseDescriptor.depthBufferBits = 0;
            _DescriptorAC = baseDescriptor;

            baseDescriptor.colorFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RHalf)
                ? RenderTextureFormat.RHalf
                : RenderTextureFormat.ARGBHalf;
            _DescriptorAA = baseDescriptor;

            _AccumColorHandle.Init("_AccumColor");
            _AccumGIHandle.Init("_AccumGI");
            _AccumAlphaHandle.Init("_AccumAlpha");

            _AccumBinding = new RenderTargetBinding(new RenderTargetIdentifier[]
            {
                _AccumColorHandle.Identifier(),
                _AccumGIHandle.Identifier(),
                _AccumAlphaHandle.Identifier(),
            },
                                                    new RenderBufferLoadAction[]
            {
                RenderBufferLoadAction.DontCare,
                RenderBufferLoadAction.DontCare,
                RenderBufferLoadAction.DontCare,
            },
                                                    new RenderBufferStoreAction[]
            {
                RenderBufferStoreAction.Store,
                RenderBufferStoreAction.Store,
                RenderBufferStoreAction.Store,
            },
                                                    _DepthAttachmentHandle.Identifier(),
                                                    RenderBufferLoadAction.Load,
                                                    RenderBufferStoreAction.DontCare);
        }
示例#13
0
        /// <inheritdoc/>
        public override void FrameCleanup(CommandBuffer cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException("cmd");
            }

            if (destination != RenderTargetHandle.CameraTarget)
            {
                cmd.ReleaseTemporaryRT(destination.id);
                destination = RenderTargetHandle.CameraTarget;
            }
        }
        public bool Setup(RenderTargetHandle destination, ref RenderingData renderingData)
        {
            Clear();
            this.destination = destination;

            int shadowLightIndex = renderingData.lightData.mainLightIndex;

            if (shadowLightIndex == -1)
            {
                return(false);
            }

            VisibleLight shadowLight = renderingData.lightData.visibleLights[shadowLightIndex];
            Light        light       = shadowLight.light;

            if (light.shadows == LightShadows.None)
            {
                return(false);
            }

            if (shadowLight.lightType != LightType.Directional)
            {
                Debug.LogWarning("Only directional lights are supported as main light.");
            }

            Bounds bounds;

            if (!renderingData.cullResults.GetShadowCasterBounds(shadowLightIndex, out bounds))
            {
                return(false);
            }

            m_ShadowCasterCascadesCount = renderingData.shadowData.mainLightShadowCascadesCount;

            int shadowResolution = ShadowUtils.GetMaxTileResolutionInAtlas(renderingData.shadowData.mainLightShadowmapWidth,
                                                                           renderingData.shadowData.mainLightShadowmapHeight, m_ShadowCasterCascadesCount);

            for (int cascadeIndex = 0; cascadeIndex < m_ShadowCasterCascadesCount; ++cascadeIndex)
            {
                bool success = ShadowUtils.ExtractDirectionalLightMatrix(ref renderingData.cullResults, ref renderingData.shadowData,
                                                                         shadowLightIndex, cascadeIndex, shadowResolution, light.shadowNearPlane,
                                                                         out m_CascadeSplitDistances[cascadeIndex], out m_CascadeSlices[cascadeIndex], out m_CascadeSlices[cascadeIndex].viewMatrix, out m_CascadeSlices[cascadeIndex].projectionMatrix);

                if (!success)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#15
0
 /// <summary>
 /// Configure the pass
 /// </summary>
 public void Setup(
     RenderTextureDescriptor baseDescriptor, RenderTargetHandle depthNormalsHandle, RenderTargetHandle depthAttachmentHandle, bool depthPrepass, SampleCount samples)
 {
     this.depthNormalsHandle        = depthNormalsHandle;
     this.depthAttachmentHandle     = depthAttachmentHandle;
     baseDescriptor.depthBufferBits = depthPrepass ? 0 : kDepthBufferBits;
     baseDescriptor.colorFormat     = RenderTextureFormat.ARGB32;
     if ((int)samples > 1 && depthPrepass)
     {
         baseDescriptor.bindMS      = false;
         baseDescriptor.msaaSamples = (int)samples;
     }
     descriptor = baseDescriptor;
     this.isDepthPrepassEnabled = depthPrepass;
 }
 /// <summary>
 /// Configure the pass before execution
 /// </summary>
 /// <param name="baseDescriptor">Current target descriptor</param>
 /// <param name="colorAttachmentHandle">Color attachment to render into</param>
 /// <param name="depthAttachmentHandle">Depth attachment to render into</param>
 /// <param name="clearFlag">Camera clear flag</param>
 /// <param name="clearColor">Camera clear color</param>
 /// <param name="configuration">Specific render configuration</param>
 public void Setup(
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle,
     RenderTargetHandle depthAttachmentHandle,
     ClearFlag clearFlag,
     Color clearColor,
     RendererConfiguration configuration)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     this.depthAttachmentHandle = depthAttachmentHandle;
     this.clearColor            = CoreUtils.ConvertSRGBToActiveColorSpace(clearColor);
     this.clearFlag             = clearFlag;
     descriptor = baseDescriptor;
     this.rendererConfiguration = configuration;
 }
 public void Setup(
     RenderTextureDescriptor baseDescriptor,
     RenderTargetHandle colorAttachmentHandle,
     RenderTargetHandle depthAttachmentHandle,
     ClearFlag clearFlag,
     Color clearColor,
     RendererConfiguration configuration,
     bool dynamicbatching)
 {
     this.colorAttachmentHandle = colorAttachmentHandle;
     this.depthAttachmentHandle = depthAttachmentHandle;
     this.clearColor            = clearColor;
     this.clearFlag             = clearFlag;
     descriptor = baseDescriptor;
     this.rendererConfiguration = configuration;
     this.dynamicBatching       = dynamicbatching;
 }
示例#18
0
        /// <summary>
        /// Configure the pass
        /// </summary>
        public void Setup(
            RenderTextureDescriptor baseDescriptor,
            RenderTargetHandle depthAttachmentHandle,
            SampleCount samples)
        {
            this.depthAttachmentHandle     = depthAttachmentHandle;
            baseDescriptor.colorFormat     = RenderTextureFormat.Depth;
            baseDescriptor.depthBufferBits = kDepthBufferBits;

            if ((int)samples > 1)
            {
                baseDescriptor.bindMS      = (int)samples > 1;
                baseDescriptor.msaaSamples = (int)samples;
            }

            descriptor = baseDescriptor;
        }
示例#19
0
        /// <summary>
        /// Setup the pass
        /// </summary>
        /// <param name="baseDescriptor"></param>
        /// <param name="sourceHandle">Source of rendering to execute the post on</param>
        /// <param name="destinationHandle">Destination target for the final blit</param>
        public void Setup(
            RenderTextureDescriptor baseDescriptor,
            RenderTargetHandle sourceHandle,
            RenderTargetHandle destinationHandle,
            bool opaquePost,
            bool flip)
        {
            if (sourceHandle == destinationHandle)
            {
                throw new InvalidOperationException($"{nameof(sourceHandle)} should not be the same as {nameof(destinationHandle)}");
            }

            source          = sourceHandle;
            destination     = destinationHandle;
            descriptor      = baseDescriptor;
            this.flip       = flip;
            this.opaquePost = opaquePost;
        }
示例#20
0
 public override void FrameCleanup(CommandBuffer cmd)
 {
     if (cmd == null)
     {
         throw new ArgumentNullException("cmd");
     }
     if (_DeepShadowLut != RenderTargetHandle.CameraTarget)
     {
         cmd.ReleaseTemporaryRT(_DeepShadowLut.id);
         _DeepShadowLut = RenderTargetHandle.CameraTarget;
     }
     if (_DeepShadowTmp != RenderTargetHandle.CameraTarget)
     {
         cmd.ReleaseTemporaryRT(_DeepShadowTmp.id);
         _DeepShadowTmp = RenderTargetHandle.CameraTarget;
     }
     base.FrameCleanup(cmd);
 }
 public override void FrameCleanup(CommandBuffer cmd)
 {
     if (cmd == null)
     {
         throw new ArgumentNullException("cmd");
     }
     if (_AccumColorHandle != RenderTargetHandle.CameraTarget)
     {
         cmd.ReleaseTemporaryRT(_AccumColorHandle.id);
         _AccumColorHandle = RenderTargetHandle.CameraTarget;
     }
     if (_AccumGIHandle != RenderTargetHandle.CameraTarget)
     {
         cmd.ReleaseTemporaryRT(_AccumGIHandle.id);
         _AccumGIHandle = RenderTargetHandle.CameraTarget;
     }
     if (_AccumAlphaHandle != RenderTargetHandle.CameraTarget)
     {
         cmd.ReleaseTemporaryRT(_AccumAlphaHandle.id);
         _AccumAlphaHandle = RenderTargetHandle.CameraTarget;
     }
     base.FrameCleanup(cmd);
 }
示例#22
0
        public bool Setup(ScriptableRenderer renderer, RenderTextureDescriptor baseDescriptor, RenderTargetHandle destination, ref RenderingData renderingData)
        {
            //int shadowLightIndex = renderingData.lightData.mainLightIndex;
            //if (shadowLightIndex == -1)
            //    return false;


            //VisibleLight shadowLight = renderingData.lightData.visibleLights[shadowLightIndex];
            //Light light = shadowLight.light;
            //if (light.shadows == LightShadows.None)
            //    return false;


            //if (shadowLight.lightType != LightType.Directional)
            //{
            //    Debug.LogWarning("Only directional lights are supported as main light.");
            //}

            //Bounds bounds;
            //if (!renderingData.cullResults.GetShadowCasterBounds(shadowLightIndex, out bounds))
            //    return false;

            //TODO : More branches
            _CountBuffer = renderer.GetBuffer(ComputeBufferHandle.DeepShadowMapsCount);
            _DataBuffer  = renderer.GetBuffer(ComputeBufferHandle.DeepShadowMapsData);

            _Destination = destination;

            _Descriptor                 = baseDescriptor;
            _Descriptor.colorFormat     = _ShadowLutFormat;
            _Descriptor.depthBufferBits = 0;
            _DeepShadowLut.Init("_DSMLut");
            _DeepShadowTmp.Init("_DSMTmp");
            _DeepShadowTest.Init("_DeepShadowTest");

            return(true);
        }
示例#23
0
 public void Setup(RenderTargetHandle source, RenderTargetHandle destination)
 {
     this.source      = source;
     this.destination = destination;
 }
示例#24
0
 public bool Equals(RenderTargetHandle other)
 {
     return(id == other.id);
 }
 public void Setup(RenderTargetHandle source)
 {
     this.source = source;
 }
示例#26
0
        public void Setup(ScriptableRenderer renderer, ref RenderingData renderingData)
        {
            Init();

            Camera camera = renderingData.cameraData.camera;

            renderer.SetupPerObjectLightIndices(ref renderingData.cullResults, ref renderingData.lightData);
            RenderTextureDescriptor baseDescriptor   = ScriptableRenderer.CreateRenderTextureDescriptor(ref renderingData.cameraData);
            RenderTextureDescriptor shadowDescriptor = baseDescriptor;

            shadowDescriptor.dimension = TextureDimension.Tex2D;

            bool mainLightShadows = false;

            if (renderingData.shadowData.supportsMainLightShadows)
            {
                mainLightShadows = m_MainLightShadowCasterPass.Setup(MainLightShadowmap, ref renderingData);
                if (mainLightShadows)
                {
                    renderer.EnqueuePass(m_MainLightShadowCasterPass);
                }
            }

            if (renderingData.shadowData.supportsAdditionalLightShadows)
            {
                bool additionalLightShadows = m_AdditionalLightsShadowCasterPass.Setup(AdditionalLightsShadowmap, ref renderingData, renderer.maxVisibleAdditionalLights);
                if (additionalLightShadows)
                {
                    renderer.EnqueuePass(m_AdditionalLightsShadowCasterPass);
                }
            }

            bool resolveShadowsInScreenSpace = mainLightShadows && renderingData.shadowData.requiresScreenSpaceShadowResolve;
            bool requiresDepthPrepass        = resolveShadowsInScreenSpace || renderingData.cameraData.isSceneViewCamera ||
                                               (renderingData.cameraData.requiresDepthTexture && (!CanCopyDepth(ref renderingData.cameraData) || renderingData.cameraData.isOffscreenRender));

            // For now VR requires a depth prepass until we figure out how to properly resolve texture2DMS in stereo
            requiresDepthPrepass |= renderingData.cameraData.isStereoEnabled;

            renderer.EnqueuePass(m_SetupForwardRenderingPass);

            /*if (requiresDepthPrepass)
             * {
             *  m_DepthOnlyPass.Setup(baseDescriptor, DepthTexture, SampleCount.One);
             *  renderer.EnqueuePass(m_DepthOnlyPass);
             *
             *  foreach (var pass in camera.GetComponents<IAfterDepthPrePass>())
             *      renderer.EnqueuePass(pass.GetPassToEnqueue(m_DepthOnlyPass.descriptor, DepthTexture));
             * }*/

            // LINDEN DEPTH PASS
            if (true)
            {
                m_LindenDepthPass.Setup(baseDescriptor, DepthTexture);
                renderer.EnqueuePass(m_LindenDepthPass);
            }

            if (resolveShadowsInScreenSpace)
            {
                m_ScreenSpaceShadowResolvePass.Setup(baseDescriptor, ScreenSpaceShadowmap);
                renderer.EnqueuePass(m_ScreenSpaceShadowResolvePass);
            }

            bool requiresRenderToTexture = ScriptableRenderer.RequiresIntermediateColorTexture(ref renderingData.cameraData, baseDescriptor);

            RenderTargetHandle colorHandle = RenderTargetHandle.CameraTarget;
            RenderTargetHandle depthHandle = RenderTargetHandle.CameraTarget;

            if (requiresRenderToTexture)
            {
                colorHandle = ColorAttachment;
                depthHandle = DepthAttachment;

                var sampleCount = (SampleCount)renderingData.cameraData.msaaSamples;
                m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount);
                renderer.EnqueuePass(m_CreateLightweightRenderTexturesPass);
            }

            if (renderingData.cameraData.isStereoEnabled)
            {
                renderer.EnqueuePass(m_BeginXrRenderingPass);
            }

            RendererConfiguration rendererConfiguration = ScriptableRenderer.GetRendererConfiguration(renderingData.lightData.additionalLightsCount);

            m_SetupLightweightConstants.Setup(renderer.maxVisibleAdditionalLights, renderer.perObjectLightIndices);
            renderer.EnqueuePass(m_SetupLightweightConstants);

            m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, ScriptableRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration);
            renderer.EnqueuePass(m_RenderOpaqueForwardPass);
            foreach (var pass in camera.GetComponents <IAfterOpaquePass>())
            {
                renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
            }

            if (renderingData.cameraData.postProcessEnabled &&
                renderingData.cameraData.postProcessLayer.HasOpaqueOnlyEffects(renderer.postProcessingContext))
            {
                m_OpaquePostProcessPass.Setup(baseDescriptor, colorHandle);
                renderer.EnqueuePass(m_OpaquePostProcessPass);

                foreach (var pass in camera.GetComponents <IAfterOpaquePostProcess>())
                {
                    renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
                }
            }

            if (camera.clearFlags == CameraClearFlags.Skybox)
            {
                m_DrawSkyboxPass.Setup(colorHandle, depthHandle);
                renderer.EnqueuePass(m_DrawSkyboxPass);
            }

            foreach (var pass in camera.GetComponents <IAfterSkyboxPass>())
            {
                renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
            }

            /*if (renderingData.cameraData.requiresDepthTexture && !requiresDepthPrepass)
             * {
             *  m_CopyDepthPass.Setup(depthHandle, DepthTexture);
             *  renderer.EnqueuePass(m_CopyDepthPass);
             * }*/

            if (renderingData.cameraData.requiresOpaqueTexture)
            {
                m_CopyColorPass.Setup(colorHandle, OpaqueColor);
                renderer.EnqueuePass(m_CopyColorPass);
            }

            m_RenderTransparentForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, rendererConfiguration);
            renderer.EnqueuePass(m_RenderTransparentForwardPass);

            foreach (var pass in camera.GetComponents <IAfterTransparentPass>())
            {
                renderer.EnqueuePass(pass.GetPassToEnqueue(baseDescriptor, colorHandle, depthHandle));
            }

            if (!renderingData.cameraData.isStereoEnabled && renderingData.cameraData.postProcessEnabled)
            {
                m_TransparentPostProcessPass.Setup(baseDescriptor, colorHandle, BuiltinRenderTextureType.CameraTarget);
                renderer.EnqueuePass(m_TransparentPostProcessPass);
            }
            else if (!renderingData.cameraData.isOffscreenRender && colorHandle != RenderTargetHandle.CameraTarget)
            {
                m_FinalBlitPass.Setup(baseDescriptor, colorHandle);
                renderer.EnqueuePass(m_FinalBlitPass);
            }

            foreach (var pass in camera.GetComponents <IAfterRender>())
            {
                renderer.EnqueuePass(pass.GetPassToEnqueue());
            }

            if (renderingData.cameraData.isStereoEnabled)
            {
                renderer.EnqueuePass(m_EndXrRenderingPass);
            }

/*#if UNITY_EDITOR
 *          if (renderingData.cameraData.isSceneViewCamera)
 *          {
 *              m_SceneViewDepthCopyPass.Setup(DepthTexture);
 *              renderer.EnqueuePass(m_SceneViewDepthCopyPass);
 *          }
 #endif*/
        }
 public ScriptableRenderPass GetPassToEnqueue(RenderTextureDescriptor desc, RenderTargetHandle colorHandle, RenderTargetHandle depthHandle)
 {
     m_NyanCat.Setup(m_NyanCatTexture, colorHandle.Identifier(), m_Material);
     return(m_NyanCat);
 }
        public void Setup(LightweightForwardRenderer renderer, ref ScriptableRenderContext context,
                          ref CullResults cullResults, ref RenderingData renderingData)
        {
            Init();

            renderer.Clear();

            renderer.SetupPerObjectLightIndices(ref cullResults, ref renderingData.lightData);
            RenderTextureDescriptor baseDescriptor   = LightweightForwardRenderer.CreateRTDesc(ref renderingData.cameraData);
            RenderTextureDescriptor shadowDescriptor = baseDescriptor;

            shadowDescriptor.dimension = TextureDimension.Tex2D;

            bool requiresCameraDepth  = renderingData.cameraData.requiresDepthTexture;
            bool requiresDepthPrepass = renderingData.shadowData.requiresScreenSpaceShadowResolve ||
                                        renderingData.cameraData.isSceneViewCamera ||
                                        (requiresCameraDepth &&
                                         !LightweightForwardRenderer.CanCopyDepth(ref renderingData.cameraData));

            // For now VR requires a depth prepass until we figure out how to properly resolve texture2DMS in stereo
            requiresDepthPrepass |= renderingData.cameraData.isStereoEnabled;

            if (renderingData.shadowData.renderDirectionalShadows)
            {
                m_DirectionalShadowPass.Setup(DirectionalShadowmap);
                renderer.EnqueuePass(m_DirectionalShadowPass);
            }

            if (renderingData.shadowData.renderLocalShadows)
            {
                m_LocalShadowPass.Setup(LocalShadowmap, renderer.maxVisibleLocalLights);
                renderer.EnqueuePass(m_LocalShadowPass);
            }

            renderer.EnqueuePass(m_SetupForwardRenderingPass);

            if (requiresDepthPrepass)
            {
                m_DepthOnlyPass.Setup(baseDescriptor, DepthTexture, SampleCount.One);
                renderer.EnqueuePass(m_DepthOnlyPass);
            }

            if (renderingData.shadowData.renderDirectionalShadows &&
                renderingData.shadowData.requiresScreenSpaceShadowResolve)
            {
                m_ScreenSpaceShadowResovePass.Setup(baseDescriptor, ScreenSpaceShadowmap);
                renderer.EnqueuePass(m_ScreenSpaceShadowResovePass);
            }

            bool requiresDepthAttachment = requiresCameraDepth && !requiresDepthPrepass;
            bool requiresColorAttachment =
                LightweightForwardRenderer.RequiresIntermediateColorTexture(
                    ref renderingData.cameraData,
                    baseDescriptor,
                    requiresDepthAttachment);
            RenderTargetHandle colorHandle = (requiresColorAttachment) ? Color : RenderTargetHandle.CameraTarget;
            RenderTargetHandle depthHandle = (requiresDepthAttachment) ? DepthAttachment : RenderTargetHandle.CameraTarget;

            var sampleCount = (SampleCount)renderingData.cameraData.msaaSamples;

            m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount);
            renderer.EnqueuePass(m_CreateLightweightRenderTexturesPass);

            if (renderingData.cameraData.isStereoEnabled)
            {
                renderer.EnqueuePass(m_BeginXrRenderingPass);
            }

            Camera camera          = renderingData.cameraData.camera;
            bool   dynamicBatching = renderingData.supportsDynamicBatching;
            RendererConfiguration rendererConfiguration = LightweightForwardRenderer.GetRendererConfiguration(renderingData.lightData.totalAdditionalLightsCount);

            m_SetupLightweightConstants.Setup(renderer.maxVisibleLocalLights, renderer.perObjectLightIndices);
            renderer.EnqueuePass(m_SetupLightweightConstants);

            m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, LightweightForwardRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration, dynamicBatching);
            renderer.EnqueuePass(m_RenderOpaqueForwardPass);

            if (renderingData.cameraData.postProcessEnabled &&
                renderingData.cameraData.postProcessLayer.HasOpaqueOnlyEffects(renderer.postProcessRenderContext))
            {
                m_OpaquePostProcessPass.Setup(renderer.postProcessRenderContext, baseDescriptor, colorHandle);
                renderer.EnqueuePass(m_OpaquePostProcessPass);
            }

            if (camera.clearFlags == CameraClearFlags.Skybox)
            {
                renderer.EnqueuePass(m_DrawSkyboxPass);
            }

            if (depthHandle != RenderTargetHandle.CameraTarget)
            {
                m_CopyDepthPass.Setup(depthHandle, DepthTexture);
                renderer.EnqueuePass(m_CopyDepthPass);
            }

            if (renderingData.cameraData.requiresOpaqueTexture)
            {
                m_CopyColorPass.Setup(colorHandle, OpaqueColor);
                renderer.EnqueuePass(m_CopyColorPass);
            }

            m_RenderTransparentForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, ClearFlag.None, camera.backgroundColor, rendererConfiguration, dynamicBatching);
            renderer.EnqueuePass(m_RenderTransparentForwardPass);

            if (renderingData.cameraData.postProcessEnabled)
            {
                m_TransparentPostProcessPass.Setup(renderer.postProcessRenderContext, baseDescriptor, colorHandle);
                renderer.EnqueuePass(m_TransparentPostProcessPass);
            }
            else if (!renderingData.cameraData.isOffscreenRender && colorHandle != RenderTargetHandle.CameraTarget)
            {
                m_FinalBlitPass.Setup(baseDescriptor, colorHandle);
                renderer.EnqueuePass(m_FinalBlitPass);
            }

            if (renderingData.cameraData.isStereoEnabled)
            {
                renderer.EnqueuePass(m_EndXrRenderingPass);
            }

#if UNITY_EDITOR
            if (renderingData.cameraData.isSceneViewCamera)
            {
                m_SceneViewDepthCopyPass.Setup(DepthTexture);
                renderer.EnqueuePass(m_SceneViewDepthCopyPass);
            }
#endif
        }
 public void Setup(RenderTargetHandle destination)
 {
     this.destination = destination;
 }
 public void Setup(RenderTargetHandle colorHandle, RenderTargetHandle depthHandle)
 {
     this.colorAttachmentHandle = colorHandle;
     this.depthAttachmentHandle = depthHandle;
 }