public override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
 {
     foreach (var i in beforeRenderFrame)
     {
         i.func(i.obj);
     }
     beforeRenderFrame.Clear();
     SceneController.SetState();
     foreach (var cam in cameras)
     {
         PipelineCamera pipelineCam = cam.GetComponent <PipelineCamera>();
         if (!pipelineCam)
         {
             pipelineCam = Camera.main.GetComponent <PipelineCamera>();
             if (!pipelineCam)
             {
                 continue;
             }
         }
         Render(pipelineCam, BuiltinRenderTextureType.CameraTarget, ref renderContext, cam);
         PipelineFunctions.ReleaseRenderTarget(data.buffer, ref pipelineCam.targets);
         renderContext.Submit();
     }
     foreach (var i in afterRenderFrame)
     {
         i.func(i.obj);
     }
     afterRenderFrame.Clear();
 }
Exemplo n.º 2
0
        protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
        {
            bool *propertyCheckedFlags = stackalloc bool[]
            {
                false,
                false,
                false
            };

            GraphicsSettings.useScriptableRenderPipelineBatching = resources.useSRPBatcher;
            foreach (var i in beforeRenderFrame)
            {
                i.func(i.obj);
            }
            beforeRenderFrame.Clear();
            SceneController.SetState();
#if UNITY_EDITOR
            foreach (var pair in bakeList)
            {
                PipelineCamera pipelineCam = pair.pipelineCamera;
                for (int i = 0; i < pair.worldToCamera.Length; ++i)
                {
                    pipelineCam.cam.worldToCameraMatrix = pair.worldToCamera[i];
                    pipelineCam.cam.projectionMatrix    = pair.projection[i];
                    Render(pipelineCam, ref renderContext, pipelineCam.cam, propertyCheckedFlags);
                    data.buffer.Blit(pipelineCam.targets.renderTargetIdentifier, pair.tempTex);
                    PipelineFunctions.ReleaseRenderTarget(data.buffer, ref pipelineCam.targets);
                    data.buffer.CopyTexture(pair.tempTex, 0, 0, pair.texArray, i, 0);
                    data.ExecuteCommandBuffer();
                    renderContext.Submit();
                }
                pair.worldToCamera.Dispose();
                pair.projection.Dispose();
                renderContext.ExecuteCommandBuffer(pair.buffer);
                pair.buffer.Clear();
                renderContext.Submit();
            }
            bakeList.Clear();
#endif

            if (!PipelineCamera.allCamera.isCreated)
            {
                return;
            }

            foreach (var cam in cameras)
            {
                PipelineCamera pipelineCam;
                UIntPtr        pipelineCamPtr;
                if (!PipelineCamera.allCamera.Get(cam.gameObject.GetInstanceID(), out pipelineCamPtr))
                {
#if UNITY_EDITOR
                    renderingEditor = true;
                    if (!PipelineCamera.allCamera.Get(Camera.main.gameObject.GetInstanceID(), out pipelineCamPtr))
                    {
                        continue;
                    }
#else
                    continue;
#endif
                }
                else
                {
                    renderingEditor = false;
                }
                pipelineCam = MUnsafeUtility.GetObject <PipelineCamera>(pipelineCamPtr.ToPointer());
                Render(pipelineCam, ref renderContext, cam, propertyCheckedFlags);
                PipelineFunctions.ReleaseRenderTarget(data.buffer, ref pipelineCam.targets);
                data.ExecuteCommandBuffer();
                renderContext.Submit();
            }
            foreach (var i in afterRenderFrame)
            {
                i.func(i.obj);
            }
            afterRenderFrame.Clear();
            if (bufferAfterFrame.Count > 0)
            {
                foreach (var i in bufferAfterFrame)
                {
                    i(data.buffer);
                }
                data.ExecuteCommandBuffer();
                bufferAfterFrame.Clear();
                renderContext.Submit();
            }
        }
Exemplo n.º 3
0
        protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
        {
            bool *propertyCheckedFlags = stackalloc bool[resources.allEvents.Length];

            UnsafeUtility.MemClear(propertyCheckedFlags, resources.allEvents.Length);
            GraphicsSettings.useScriptableRenderPipelineBatching = resources.useSRPBatcher;
            SceneController.SetState();
#if UNITY_EDITOR
            int tempID = Shader.PropertyToID("_TempRT");
            foreach (var pair in bakeList)
            {
                PipelineCamera pipelineCam = pair.pipelineCamera;
                for (int i = 0; i < pair.worldToCamera.Length; ++i)
                {
                    pipelineCam.cam.worldToCameraMatrix = pair.worldToCamera[i];
                    pipelineCam.cam.projectionMatrix    = pair.projection[i];
                    pipelineCam.cameraTarget            = tempID;
                    data.buffer.GetTemporaryRT(tempID, pair.texArray.width, pair.texArray.height, pair.texArray.depth, FilterMode.Point, pair.texArray.format, RenderTextureReadWrite.Linear);
                    Render(pipelineCam, ref renderContext, pipelineCam.cam, propertyCheckedFlags);
                    data.buffer.CopyTexture(tempID, 0, 0, pair.texArray, i, 0);
                    data.buffer.ReleaseTemporaryRT(tempID);
                    data.ExecuteCommandBuffer();
                    renderContext.Submit();
                }
                pair.worldToCamera.Dispose();
                pair.projection.Dispose();
                renderContext.ExecuteCommandBuffer(pair.buffer);
                pair.buffer.Clear();
                renderContext.Submit();
            }
            bakeList.Clear();
#endif

            if (PipelineCamera.allCamera.isCreated)
            {
                foreach (var cam in cameras)
                {
                    PipelineCamera pipelineCam;
                    UIntPtr        pipelineCamPtr;
                    if (!PipelineCamera.allCamera.Get(cam.gameObject.GetInstanceID(), out pipelineCamPtr))
                    {
#if UNITY_EDITOR
                        renderingEditor = true;
                        var pos = cam.transform.eulerAngles;
                        pos.z = 0;
                        cam.transform.eulerAngles = pos;
                        if (!PipelineCamera.allCamera.Get(Camera.main.gameObject.GetInstanceID(), out pipelineCamPtr))
                        {
                            continue;
                        }
#else
                        continue;
#endif
                    }
                    else
                    {
                        renderingEditor = false;
                    }

                    pipelineCam = MUnsafeUtility.GetObject <PipelineCamera>(pipelineCamPtr.ToPointer());
                    Render(pipelineCam, ref renderContext, cam, propertyCheckedFlags);
                    data.ExecuteCommandBuffer();
                    renderContext.Submit();
                }
                if (bufferAfterFrame.Count > 0)
                {
                    foreach (var i in bufferAfterFrame)
                    {
                        i(data.buffer);
                    }
                    data.ExecuteCommandBuffer();
                    bufferAfterFrame.Clear();
                    renderContext.Submit();
                }
            }
            else
            {
                if (bufferAfterFrame.Count > 0)
                {
                    foreach (var i in bufferAfterFrame)
                    {
                        i(data.buffer);
                    }
                    Graphics.ExecuteCommandBuffer(data.buffer);
                    bufferAfterFrame.Clear();
                }
            }
        }
Exemplo n.º 4
0
        protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
        {
            currentFrameCamera.Clear();
            PipelineCamera.InitializeDict();
            foreach (var cam in cameras)
            {
                CameraSetting csg;
                ulong         pipelineCamPtr;
                if (!PipelineCamera.CameraSearchDict.Get(cam.gameObject.GetInstanceID(), out pipelineCamPtr))
                {
                    if (!cam.TryGetComponent(out csg.pipeCam))
                    {
#if UNITY_EDITOR
                        if (cam.cameraType == CameraType.SceneView)
                        {
                            csg.isRenderingEditor = true;
                            var pos = cam.transform.eulerAngles;
                            pos.z = 0;
                            cam.transform.eulerAngles = pos;
                            if (!Camera.main || !(csg.pipeCam = Camera.main.GetComponent <PipelineCamera>()))
                            {
                                continue;
                            }
                        }
                        else if (cam.cameraType == CameraType.Game)
                        {
                            csg.isRenderingEditor = false;
                            csg.pipeCam           = cam.gameObject.AddComponent <PipelineCamera>();
                        }
                        else
                        {
                            continue;
                        }
#else
                        csg.isRenderingEditor = false;
                        csg.pipeCam           = cam.gameObject.AddComponent <PipelineCamera>();
#endif
                    }
                    else
                    {
                        csg.isRenderingEditor = false;
                        csg.pipeCam.AddToDict();
                    }
                }
                else
                {
                    csg.isRenderingEditor = false;
                    csg.pipeCam           = MUnsafeUtility.GetObject <PipelineCamera>((void *)pipelineCamPtr);
                }
                csg.cam         = cam;
                csg.pipeCam.cam = cam;
                csg.pipeCam.BeforeFrameRendering();
                currentFrameCamera.Add(csg);
            }
            bool *propertyCheckedFlags = stackalloc bool[resources.allEvents.Length];
            bool  needSubmit           = false;
            CustomDrawRequest.Initialize();
            UnsafeUtility.MemClear(propertyCheckedFlags, resources.allEvents.Length);
            SceneController.SetState();
            data.context   = renderContext;
            data.resources = resources;
            if (motionVectorMatricesBuffer == null || !motionVectorMatricesBuffer.IsValid())
            {
                motionVectorMatricesBuffer = new ComputeBuffer(MotionVectorDrawer.Capacity, sizeof(float3x4));
            }
            else if (motionVectorMatricesBuffer.count < MotionVectorDrawer.Capacity)
            {
                motionVectorMatricesBuffer.Dispose();
                motionVectorMatricesBuffer = new ComputeBuffer(MotionVectorDrawer.Capacity, sizeof(float3x4));
            }
            MotionVectorDrawer.ExecuteBeforeFrame(motionVectorMatricesBuffer);
            data.buffer.SetGlobalBuffer(ShaderIDs._LastFrameModel, motionVectorMatricesBuffer);

#if UNITY_EDITOR
            int tempID = Shader.PropertyToID("_TempRT");

            foreach (var pair in bakeList)
            {
                PipelineCamera pipelineCam = pair.pipelineCamera;
                for (int i = 0; i < pair.worldToCamera.Length; ++i)
                {
                    pipelineCam.cam.worldToCameraMatrix = pair.worldToCamera[i];
                    pipelineCam.cam.projectionMatrix    = pair.projection[i];
                    pipelineCam.cameraTarget            = tempID;
                    data.buffer.GetTemporaryRT(tempID, pair.texArray.width, pair.texArray.height, pair.texArray.depth, FilterMode.Point, pair.texArray.format, RenderTextureReadWrite.Linear);
                    Render(pipelineCam, ref renderContext, pipelineCam.cam, propertyCheckedFlags);
                    data.buffer.CopyTexture(tempID, 0, 0, pair.texArray, i, 0);
                    data.buffer.ReleaseTemporaryRT(tempID);
                    data.ExecuteCommandBuffer();
                    renderContext.Submit();
                    needSubmit = false;
                }
                pair.worldToCamera.Dispose();
                pair.projection.Dispose();
                renderContext.ExecuteCommandBuffer(pair.buffer);
                pair.buffer.Clear();
                renderContext.Submit();
                needSubmit = false;
            }
            bakeList.Clear();
#endif
            foreach (var cam in preFrameRenderCamera)
            {
                Render(cam, ref renderContext, cam.cam, propertyCheckedFlags);
                data.ExecuteCommandBuffer();
                renderContext.Submit();
                needSubmit = false;
            }
            preFrameRenderCamera.Clear();
            if (CustomDrawRequest.allEvents.Count > 0 || JobProcessEvent.allEvents.Count > 0)
            {
                foreach (var i in CustomDrawRequest.allEvents)
                {
                    i.PrepareJob(resources);
                }
                foreach (var i in JobProcessEvent.allEvents)
                {
                    i.PrepareJob();
                }
                JobHandle.ScheduleBatchedJobs();
                foreach (var i in CustomDrawRequest.allEvents)
                {
                    i.FinishJob();
                }
                foreach (var i in JobProcessEvent.allEvents)
                {
                    i.FinishJob();
                }
            }
            if (Application.isPlaying && resources.clusterResources)
            {
                resources.clusterResources.UpdateData(data.buffer, resources);
            }
            resources.loadingThread.Update();
            if (useBeforeFrameBuffer)
            {
                renderContext.ExecuteCommandBuffer(m_beforeFrameBuffer);
                m_beforeFrameBuffer.Clear();
                needSubmit           = true;
                useBeforeFrameBuffer = false;
            }
            if (iRunnableObjects.isCreated)
            {
                foreach (var i in iRunnableObjects)
                {
                    IPipelineRunnable func = MUnsafeUtility.GetObject <IPipelineRunnable>((void *)i.value);
                    func.PipelineUpdate(ref data);
                }
            }
            if (cameras.Length > 0)
            {
                data.buffer.SetGlobalVector(ShaderIDs._SceneOffset, new float4(sceneOffset, 1));
            }
            foreach (var cam in currentFrameCamera)
            {
                renderingEditor = cam.isRenderingEditor;

                Render(cam.pipeCam, ref renderContext, cam.cam, propertyCheckedFlags);
                data.ExecuteCommandBuffer();
#if UNITY_EDITOR
                if (renderingEditor)
                {
                    renderContext.DrawGizmos(cam.cam, GizmoSubset.PostImageEffects);
                    ScriptableRenderContext.EmitWorldGeometryForSceneView(cam.cam);
                }
#endif
                renderContext.Submit();
                needSubmit = false;
            }

            if (useAfterFrameBuffer)
            {
                renderContext.ExecuteCommandBuffer(m_afterFrameBuffer);
                m_afterFrameBuffer.Clear();
                needSubmit          = true;
                useAfterFrameBuffer = false;
            }
            if (needSubmit)
            {
                renderContext.Submit();
            }
            MotionVectorDrawer.ExecuteAfterFrame();
            sceneOffset = 0;
            foreach (var cam in currentFrameCamera)
            {
                cam.pipeCam.cam = cam.cam;
                cam.pipeCam.AfterFrameRendering();
            }
        }
Exemplo n.º 5
0
        protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
        {
            bool *propertyCheckedFlags = stackalloc bool[resources.allEvents.Length];
            bool  needSubmit           = false;

            UnsafeUtility.MemClear(propertyCheckedFlags, resources.allEvents.Length);
            GraphicsSettings.useScriptableRenderPipelineBatching = resources.useSRPBatcher;
            SceneController.SetState();
            data.context   = renderContext;
            data.resources = resources;
#if UNITY_EDITOR
            int tempID = Shader.PropertyToID("_TempRT");
            foreach (var pair in bakeList)
            {
                PipelineCamera pipelineCam = pair.pipelineCamera;
                for (int i = 0; i < pair.worldToCamera.Length; ++i)
                {
                    pipelineCam.cam.worldToCameraMatrix = pair.worldToCamera[i];
                    pipelineCam.cam.projectionMatrix    = pair.projection[i];
                    pipelineCam.cameraTarget            = tempID;
                    data.buffer.GetTemporaryRT(tempID, pair.texArray.width, pair.texArray.height, pair.texArray.depth, FilterMode.Point, pair.texArray.format, RenderTextureReadWrite.Linear);
                    Render(pipelineCam, ref renderContext, pipelineCam.cam, propertyCheckedFlags);
                    data.buffer.CopyTexture(tempID, 0, 0, pair.texArray, i, 0);
                    data.buffer.ReleaseTemporaryRT(tempID);
                    data.ExecuteCommandBuffer();
                    renderContext.Submit();
                    needSubmit = false;
                }
                pair.worldToCamera.Dispose();
                pair.projection.Dispose();
                renderContext.ExecuteCommandBuffer(pair.buffer);
                pair.buffer.Clear();
                renderContext.Submit();
                needSubmit = false;
            }
            bakeList.Clear();
#endif
            foreach (var cam in preFrameRenderCamera)
            {
                Render(cam, ref renderContext, cam.cam, propertyCheckedFlags);
                data.ExecuteCommandBuffer();
                renderContext.Submit();
                needSubmit = false;
            }
            preFrameRenderCamera.Clear();
            if (CustomDrawRequest.AllEvents.Count > 0 || JobProcessEvent.allEvents.Count > 0)
            {
                foreach (var i in CustomDrawRequest.AllEvents)
                {
                    i.PrepareJob(resources);
                }
                foreach (var i in JobProcessEvent.allEvents)
                {
                    i.PrepareJob();
                }
                JobHandle.ScheduleBatchedJobs();
                foreach (var i in CustomDrawRequest.AllEvents)
                {
                    i.FinishJob();
                }
                foreach (var i in JobProcessEvent.allEvents)
                {
                    i.FinishJob();
                }
            }
            if (useBeforeFrameBuffer)
            {
                renderContext.ExecuteCommandBuffer(m_beforeFrameBuffer);
                m_beforeFrameBuffer.Clear();
                needSubmit           = true;
                useBeforeFrameBuffer = false;
            }
            if (PipelineCamera.allCamera.isCreated)
            {
                foreach (var cam in cameras)
                {
                    PipelineCamera pipelineCam;
                    UIntPtr        pipelineCamPtr;
                    if (!PipelineCamera.allCamera.Get(cam.gameObject.GetInstanceID(), out pipelineCamPtr))
                    {
#if UNITY_EDITOR
                        renderingEditor = true;
                        var pos = cam.transform.eulerAngles;
                        pos.z = 0;
                        cam.transform.eulerAngles = pos;
                        if (!PipelineCamera.allCamera.Get(Camera.main.gameObject.GetInstanceID(), out pipelineCamPtr))
                        {
                            continue;
                        }
#else
                        continue;
#endif
                    }
                    else
                    {
                        renderingEditor = false;
                    }
                    pipelineCam = MUnsafeUtility.GetObject <PipelineCamera>(pipelineCamPtr.ToPointer());
                    Render(pipelineCam, ref renderContext, cam, propertyCheckedFlags);
                    data.ExecuteCommandBuffer();
#if UNITY_EDITOR
                    if (renderingEditor)
                    {
                        renderContext.DrawGizmos(cam, GizmoSubset.PostImageEffects);
                    }
#endif
                    renderContext.Submit();
                    needSubmit = false;
                }
            }
            if (useAfterFrameBuffer)
            {
                renderContext.ExecuteCommandBuffer(m_afterFrameBuffer);
                m_afterFrameBuffer.Clear();
                needSubmit          = true;
                useAfterFrameBuffer = false;
            }
            if (needSubmit)
            {
                renderContext.Submit();
            }
        }
        protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
        {
            bool *propertyCheckedFlags = stackalloc bool[resources.allEvents.Length];
            bool  needSubmit           = false;

            CustomDrawRequest.Initialize();
            UnsafeUtility.MemClear(propertyCheckedFlags, resources.allEvents.Length);
            GraphicsSettings.useScriptableRenderPipelineBatching = resources.useSRPBatcher;
            SceneController.SetState();
            data.context   = renderContext;
            data.resources = resources;
            if (motionVectorMatricesBuffer == null || !motionVectorMatricesBuffer.IsValid())
            {
                motionVectorMatricesBuffer = new ComputeBuffer(MotionVectorDrawer.Capacity, sizeof(float3x4));
            }
            else if (motionVectorMatricesBuffer.count < MotionVectorDrawer.Capacity)
            {
                motionVectorMatricesBuffer.Dispose();
                motionVectorMatricesBuffer = new ComputeBuffer(MotionVectorDrawer.Capacity, sizeof(float3x4));
            }
            MotionVectorDrawer.ExecuteBeforeFrame(motionVectorMatricesBuffer);
            data.buffer.SetGlobalBuffer(ShaderIDs._LastFrameModel, motionVectorMatricesBuffer);

#if UNITY_EDITOR
            int tempID = Shader.PropertyToID("_TempRT");

            foreach (var pair in bakeList)
            {
                PipelineCamera pipelineCam = pair.pipelineCamera;
                for (int i = 0; i < pair.worldToCamera.Length; ++i)
                {
                    pipelineCam.cam.worldToCameraMatrix = pair.worldToCamera[i];
                    pipelineCam.cam.projectionMatrix    = pair.projection[i];
                    pipelineCam.cameraTarget            = tempID;
                    data.buffer.GetTemporaryRT(tempID, pair.texArray.width, pair.texArray.height, pair.texArray.depth, FilterMode.Point, pair.texArray.format, RenderTextureReadWrite.Linear);
                    Render(pipelineCam, ref renderContext, pipelineCam.cam, propertyCheckedFlags);
                    data.buffer.CopyTexture(tempID, 0, 0, pair.texArray, i, 0);
                    data.buffer.ReleaseTemporaryRT(tempID);
                    data.ExecuteCommandBuffer();
                    renderContext.Submit();
                    needSubmit = false;
                }
                pair.worldToCamera.Dispose();
                pair.projection.Dispose();
                renderContext.ExecuteCommandBuffer(pair.buffer);
                pair.buffer.Clear();
                renderContext.Submit();
                needSubmit = false;
            }
            bakeList.Clear();
#endif
            foreach (var cam in preFrameRenderCamera)
            {
                Render(cam, ref renderContext, cam.cam, propertyCheckedFlags);
                data.ExecuteCommandBuffer();
                renderContext.Submit();
                needSubmit = false;
            }
            preFrameRenderCamera.Clear();

            if (CustomDrawRequest.allEvents.Count > 0 || JobProcessEvent.allEvents.Count > 0)
            {
                foreach (var i in CustomDrawRequest.allEvents)
                {
                    i.PrepareJob(resources);
                }
                foreach (var i in JobProcessEvent.allEvents)
                {
                    i.PrepareJob();
                }
                JobHandle.ScheduleBatchedJobs();
                foreach (var i in CustomDrawRequest.allEvents)
                {
                    i.FinishJob();
                }
            }
            if (useBeforeFrameBuffer)
            {
                renderContext.ExecuteCommandBuffer(m_beforeFrameBuffer);
                m_beforeFrameBuffer.Clear();
                needSubmit           = true;
                useBeforeFrameBuffer = false;
            }
            foreach (var cam in cameras)
            {
                PipelineCamera pipelineCam = cam.GetComponent <PipelineCamera>();
                if (!pipelineCam)
                {
#if UNITY_EDITOR
                    if (cam.cameraType == CameraType.SceneView)
                    {
                        renderingEditor = true;
                        var pos = cam.transform.eulerAngles;
                        pos.z = 0;
                        cam.transform.eulerAngles = pos;
                        if (!Camera.main || !(pipelineCam = Camera.main.GetComponent <PipelineCamera>()))
                        {
                            continue;
                        }
                    }
                    else if (cam.cameraType == CameraType.Game)
                    {
                        renderingEditor = false;
                        pipelineCam     = cam.gameObject.AddComponent <PipelineCamera>();
                    }
                    else
                    {
                        continue;
                    }
#else
                    renderingEditor = false;
                    pipelineCam     = cam.gameObject.AddComponent <PipelineCamera>();
#endif
                }
                else
                {
                    renderingEditor = false;
                }
                Render(pipelineCam, ref renderContext, cam, propertyCheckedFlags);
                data.ExecuteCommandBuffer();
#if UNITY_EDITOR
                if (renderingEditor)
                {
                    renderContext.DrawGizmos(cam, GizmoSubset.PostImageEffects);
                }
#endif
                renderContext.Submit();
                needSubmit = false;
            }

            if (useAfterFrameBuffer)
            {
                renderContext.ExecuteCommandBuffer(m_afterFrameBuffer);
                m_afterFrameBuffer.Clear();
                needSubmit          = true;
                useAfterFrameBuffer = false;
            }
            if (needSubmit)
            {
                renderContext.Submit();
            }
            MotionVectorDrawer.ExecuteAfterFrame();
            foreach (var i in JobProcessEvent.allEvents)
            {
                i.FinishJob();
            }
        }
Exemplo n.º 7
0
        protected override void Render(ScriptableRenderContext renderContext, Camera[] cameras)
        {
            bool *propertyCheckedFlags = stackalloc bool[]
            {
                false,
                false,
                false
            };

            foreach (var i in beforeRenderFrame)
            {
                i.func(i.obj);
            }
            beforeRenderFrame.Clear();
            SceneController.SetState();
#if UNITY_EDITOR
            foreach (var pair in bakeList)
            {
                PipelineCamera pipelineCam = pair.pipelineCamera;
                for (int i = 0; i < pair.worldToCamera.Length; ++i)
                {
                    pipelineCam.cam.worldToCameraMatrix = pair.worldToCamera[i];
                    pipelineCam.cam.projectionMatrix    = pair.projection[i];
                    Render(pipelineCam, new RenderTargetIdentifier(pair.tempTex), ref renderContext, pipelineCam.cam, propertyCheckedFlags);
                    PipelineFunctions.ReleaseRenderTarget(data.buffer, ref pipelineCam.targets);
                    data.buffer.CopyTexture(pair.tempTex, 0, pair.texArray, i);
                    data.ExecuteCommandBuffer();
                }
                pair.worldToCamera.Dispose();
                pair.projection.Dispose();
                renderContext.ExecuteCommandBuffer(pair.buffer);
                pair.buffer.Clear();
                renderContext.Submit();
            }
            bakeList.Clear();
#endif
            foreach (var cam in cameras)
            {
                PipelineCamera pipelineCam = cam.GetComponent <PipelineCamera>();
                if (!pipelineCam)
                {
                    pipelineCam = Camera.main.GetComponent <PipelineCamera>();
                    if (!pipelineCam)
                    {
                        continue;
                    }
                }
                Render(pipelineCam, BuiltinRenderTextureType.CameraTarget, ref renderContext, cam, propertyCheckedFlags);
                PipelineFunctions.ReleaseRenderTarget(data.buffer, ref pipelineCam.targets);
                data.ExecuteCommandBuffer();
                renderContext.Submit();
            }
            foreach (var i in afterRenderFrame)
            {
                i.func(i.obj);
            }
            afterRenderFrame.Clear();
#if UNITY_EDITOR
            foreach (var i in bufferAfterFrame)
            {
                renderContext.ExecuteCommandBuffer(i);
                i.Clear();
            }
            bufferAfterFrame.Clear();
            renderContext.Submit();
#endif
        }