示例#1
0
        protected override void Dispose(bool disposing)
        {
            eventsGuideBook.Dispose();
            waitReleaseRT.Dispose();
            base.Dispose(disposing);
            if (current == this)
            {
                current = null;
            }
            data.buffer.Dispose();
            var allEvents = resources.allEvents;

            for (int i = 0; i < resources.availiableEvents.Length; ++i)
            {
                resources.availiableEvents[i].DisposeEvent();
            }
            for (int i = 0; i < resources.availiableEvents.Length; ++i)
            {
                resources.availiableEvents[i].DisposeDependEventsList();
            }
            if (PipelineCamera.allCamera.isCreated)
            {
                foreach (var i in PipelineCamera.allCamera)
                {
                    PipelineCamera cam    = MUnsafeUtility.GetObject <PipelineCamera>(i.value.ToPointer());
                    var            values = cam.allDatas.Values;
                    foreach (var j in values)
                    {
                        j.DisposeProperty();
                    }
                    cam.allDatas.Clear();
                }
            }
        }
示例#2
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (current == this)
            {
                current = null;
            }
            iRunnableObjects.Dispose();
            CustomDrawRequest.Dispose();
            if (m_afterFrameBuffer != null)
            {
                m_afterFrameBuffer.Dispose();
                m_afterFrameBuffer = null;
            }
            if (m_beforeFrameBuffer != null)
            {
                m_beforeFrameBuffer.Dispose();
                m_beforeFrameBuffer = null;
            }

            try
            {
                eventsGuideBook.Dispose();
                waitReleaseRT.Dispose();
            }
            catch { }
            SceneController.Dispose(resources);
            resources.loadingThread.Dispose();
            data.buffer.Dispose();
            var allEvents = resources.allEvents;

            for (int i = 0; i < resources.availiableEvents.Length; ++i)
            {
                resources.availiableEvents[i].DisposeEvent();
            }
            for (int i = 0; i < resources.availiableEvents.Length; ++i)
            {
                resources.availiableEvents[i].DisposeDependEventsList();
            }

            foreach (var camPtr in PipelineCamera.CameraSearchDict)
            {
                PipelineCamera cam = MUnsafeUtility.GetObject <PipelineCamera>((void *)camPtr.value);
                if (cam.allDatas.isCreated)
                {
                    foreach (var i in cam.allDatas)
                    {
                        IPerCameraData data = ((IPerCameraData)MUnsafeUtility.GetHookedObject(i.value));
                        data.DisposeProperty();
                        MUnsafeUtility.RemoveHookedObject(i.value);
                    }
                    cam.allDatas.Dispose();
                }
            }
            if (motionVectorMatricesBuffer != null)
            {
                motionVectorMatricesBuffer.Dispose();
            }
            MotionVectorDrawer.Dispose();
        }
 private void OnDisable()
 {
     allCamera.Remove(gameObject.GetInstanceID());
     if (allCamera.Length <= 0)
     {
         allCamera.Dispose();
     }
 }
 public void Dispose()
 {
     rgbaPool.Dispose();
     emissionPool.Dispose();
     heightPool.Dispose();
     vmManager.Dispose();
     referenceCacheDict.Dispose();
     mipIDs.Dispose();
 }
示例#5
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (current == this)
            {
                current = null;
            }
            iRunnableObjects.Dispose();
            CustomDrawRequest.Dispose();
            if (m_afterFrameBuffer != null)
            {
                m_afterFrameBuffer.Dispose();
                m_afterFrameBuffer = null;
            }
            if (m_beforeFrameBuffer != null)
            {
                m_beforeFrameBuffer.Dispose();
                m_beforeFrameBuffer = null;
            }

            try
            {
                eventsGuideBook.Dispose();
                waitReleaseRT.Dispose();
            }
            catch { }
            SceneController.Dispose(resources);
            resources.loadingThread.Dispose();
            data.buffer.Dispose();
            var allEvents = resources.allEvents;

            for (int i = 0; i < resources.availiableEvents.Length; ++i)
            {
                resources.availiableEvents[i].DisposeEvent();
            }
            for (int i = 0; i < resources.availiableEvents.Length; ++i)
            {
                resources.availiableEvents[i].DisposeDependEventsList();
            }

            foreach (var cam in PipelineCamera.allCameras)
            {
                var values = cam.allDatas.Values;
                foreach (var j in values)
                {
                    j.DisposeProperty();
                }
                cam.allDatas.Clear();
            }

            if (motionVectorMatricesBuffer != null)
            {
                motionVectorMatricesBuffer.Dispose();
            }
            MotionVectorDrawer.Dispose();
        }
示例#6
0
        public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data)
        {
            if (!enabledPost || !cam.postProfile)
            {
                data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget);
                return;
            }
#if UNITY_EDITOR
            if (!enableInEditor && RenderPipeline.renderingEditor)
            {
                data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget);
                return;
            }
#endif
            NativeDictionary <ulong, ulong, PtrEqual> allSettings = new NativeDictionary <ulong, ulong, PtrEqual>(allPostEffects.Count, Unity.Collections.Allocator.Temp, new PtrEqual());
            foreach (var i in cam.postProfile.settings)
            {
                allSettings.Add((ulong)MUnsafeUtility.GetManagedPtr(i.GetType()), (ulong)MUnsafeUtility.GetManagedPtr(i));
            }
            postContext.camera              = cam.cam;
            postContext.command             = data.buffer;
            postContext.sourceFormat        = RenderTextureFormat.ARGBHalf;
            postContext.autoExposureTexture = RuntimeUtilities.whiteTexture;
            postContext.bloomBufferNameID   = -1;
            RenderTargetIdentifier source, dest;
            postContext.source      = cam.targets.renderTargetIdentifier;
            postContext.destination = cam.targets.backupIdentifier;
            postContext.logHistogram.Generate(postContext);
            cyberGlitch.Render(data.buffer, ref cam.targets);
            foreach (var i in allPostEffects)
            {
                ulong settingsPtr;
                if (allSettings.Get((ulong)MUnsafeUtility.GetManagedPtr(i.type), out settingsPtr))
                {
                    PostProcessEffectSettings setting = MUnsafeUtility.GetObject <PostProcessEffectSettings>((void *)settingsPtr);
                    if (i.needBlit && setting.active)
                    {
                        PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest);
                        postContext.source      = source;
                        postContext.destination = dest;
                    }
                    i.renderer.SetSettings(setting);
                    i.renderer.Render(postContext);
                }
            }
            ;
            allSettings.Dispose();
            //   data.buffer.Blit(ShaderIDs._CameraMotionVectorsTexture, cam.cameraTarget);
            //     data.buffer.BlitSRT(cam.cameraTarget, debugMat, 0);
            data.buffer.BlitSRT(cam.targets.renderTargetIdentifier, cam.cameraTarget, postContext.uberSheet.material, 0, postContext.uberSheet.properties);
            if (postContext.bloomBufferNameID > -1)
            {
                data.buffer.ReleaseTemporaryRT(postContext.bloomBufferNameID);
            }
        }
示例#7
0
 public void Dispose()
 {
     Object.DestroyImmediate(indexTex);
     foreach (var i in textures)
     {
         Object.DestroyImmediate(i);
     }
     allFormats.Dispose();
     pool.Dispose();
     setIndexBuffer.Dispose();
     poolDict.Dispose();
 }
示例#8
0
        private void OnDestroy()
        {
            if (allDatas.isCreated)
            {
                foreach (var i in allDatas)
                {
                    IPerCameraData data = ((IPerCameraData)MUnsafeUtility.GetHookedObject(i.value));
                    data.DisposeProperty();
                    MUnsafeUtility.RemoveHookedObject(i.value);
                }
                allDatas.Dispose();
            }
            cam = null;

            /* foreach (var i in commandBuffers.Values)
             * {
             *   i.Dispose();
             * }
             * commandBuffers = null;
             */
        }