/// <inheritdoc/> public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { if (m_SamplingMaterial == null) { Debug.LogErrorFormat("Missing {0}. {1} render pass will not execute. Check for missing reference in the renderer resources.", m_SamplingMaterial, GetType().Name); return; } CommandBuffer cmd = CommandBufferPool.Get(); //It is possible that the given color target is now the frontbuffer if (source == renderingData.cameraData.renderer.GetCameraColorFrontBuffer(cmd)) { source = renderingData.cameraData.renderer.cameraColorTarget; } using (new ProfilingScope(cmd, ProfilingSampler.Get(URPProfileId.CopyColor))) { RenderTargetIdentifier opaqueColorRT = destination.Identifier(); ScriptableRenderer.SetRenderTarget(cmd, opaqueColorRT, BuiltinRenderTextureType.CameraTarget, clearFlag, clearColor); bool useDrawProceduleBlit = renderingData.cameraData.xr.enabled; switch (m_DownsamplingMethod) { case Downsampling.None: RenderingUtils.Blit(cmd, source, opaqueColorRT, m_CopyColorMaterial, 0, useDrawProceduleBlit); break; case Downsampling._2xBilinear: RenderingUtils.Blit(cmd, source, opaqueColorRT, m_CopyColorMaterial, 0, useDrawProceduleBlit); break; case Downsampling._4xBox: m_SamplingMaterial.SetFloat(m_SampleOffsetShaderHandle, 2); RenderingUtils.Blit(cmd, source, opaqueColorRT, m_SamplingMaterial, 0, useDrawProceduleBlit); break; case Downsampling._4xBilinear: RenderingUtils.Blit(cmd, source, opaqueColorRT, m_CopyColorMaterial, 0, useDrawProceduleBlit); break; } } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }