Пример #1
0
        public JobHandle Dispose(JobHandle inputDeps)
        {
            var jobHandle = new DisposeJob {
                Container = this
            }.Schedule(inputDeps);

            this._blockData = null;
            return(jobHandle);
        }
        public JobHandle Dispose(JobHandle inputDeps)
        {
            var jh = new DisposeJob {
                upbl = this
            }.Schedule(inputDeps);

            m_perThreadBlockLists = null;
            return(jh);
        }
Пример #3
0
        /// <summary>
        /// Safely disposes of this container and deallocates its memory when the jobs that use it have completed.
        /// </summary>
        /// <remarks>You can call this function dispose of the container immediately after scheduling the job. Pass
        /// the [JobHandle](https://docs.unity3d.com/ScriptReference/Unity.Jobs.JobHandle.html) returned by
        /// the [Job.Schedule](https://docs.unity3d.com/ScriptReference/Unity.Jobs.IJobExtensions.Schedule.html)
        /// method using the `jobHandle` parameter so the job scheduler can dispose the container after all jobs
        /// using it have run.</remarks>
        /// <param name="dependency">All jobs spawned will depend on this JobHandle.</param>
        /// <returns>A new job handle containing the prior handles as well as the handle for the job that deletes
        /// the container.</returns>
        public JobHandle Dispose(JobHandle dependency)
        {
            var jobHandle = new DisposeJob {
                Container = this
            }.Schedule(dependency);

            m_Block = null;

            return(jobHandle);
        }
    public JobHandle Dispose(JobHandle inputDeps)
    {
        var jobHandle = new DisposeJob {
            Container = this
        }.Schedule(inputDeps);

        m_Buffer = null;

        return(jobHandle);
    }
Пример #5
0
        /// <summary>
        /// Safely disposes of this container and deallocates its memory when the jobs that use it have completed.
        /// </summary>
        /// <remarks>You can call this function dispose of the container immediately after scheduling the job. Pass
        /// the [JobHandle](https://docs.unity3d.com/ScriptReference/Unity.Jobs.JobHandle.html) returned by
        /// the [Job.Schedule](https://docs.unity3d.com/ScriptReference/Unity.Jobs.IJobExtensions.Schedule.html)
        /// method using the `jobHandle` parameter so the job scheduler can dispose the container after all jobs
        /// using it have run.</remarks>
        /// <param name="jobHandle">The job handle or handles for any scheduled jobs that use this container.</param>
        /// <returns>A new job handle containing the prior handles as well as the handle for the job that deletes
        /// the container.</returns>
        public JobHandle Dispose(JobHandle inputDeps)
        {
            if (Allocator != Allocator.Invalid)
            {
                var jobHandle = new DisposeJob {
                    Ptr = Ptr, Allocator = Allocator
                }.Schedule(inputDeps);

                Ptr       = null;
                Length    = 0;
                Capacity  = 0;
                Allocator = Allocator.Invalid;

                return(jobHandle);
            }

            return(default);
Пример #6
0
        /// <summary>
        /// Safely disposes of this container and deallocates its memory when the jobs that use it have completed.
        /// </summary>
        /// <remarks>You can call this function dispose of the container immediately after scheduling the job. Pass
        /// the [JobHandle](https://docs.unity3d.com/ScriptReference/Unity.Jobs.JobHandle.html) returned by
        /// the [Job.Schedule](https://docs.unity3d.com/ScriptReference/Unity.Jobs.IJobExtensions.Schedule.html)
        /// method using the `jobHandle` parameter so the job scheduler can dispose the container after all jobs
        /// using it have run.</remarks>
        /// <param name="jobHandle">The job handle or handles for any scheduled jobs that use this container.</param>
        /// <returns>A new job handle containing the prior handles as well as the handle for the job that deletes
        /// the container.</returns>
        public JobHandle Dispose(JobHandle inputDeps)
        {
            // [DeallocateOnJobCompletion] is not supported, but we want the deallocation
            // to happen in a thread. DisposeSentinel needs to be cleared on main thread.
            // AtomicSafetyHandle can be destroyed after the job was scheduled (Job scheduling
            // will check that no jobs are writing to the container).
            DisposeSentinel.Clear(ref m_DisposeSentinel);
            var jobHandle = new DisposeJob {
                Container = this
            }.Schedule(inputDeps);

            AtomicSafetyHandle.Release(m_Safety);
            m_Buffer = null;
            m_Length = 0;

            return(jobHandle);
        }
        /// <summary>
        /// Disposes the EntityOperationCommandBuffer after the jobs which use it have finished.
        /// </summary>
        /// <param name="inputDeps">The JobHandle for any jobs previously using this EnableCommandBuffer</param>
        /// <returns></returns>
        public JobHandle Dispose(JobHandle inputDeps)
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            // [DeallocateOnJobCompletion] is not supported, but we want the deallocation
            // to happen in a thread. DisposeSentinel needs to be cleared on main thread.
            // AtomicSafetyHandle can be destroyed after the job was scheduled (Job scheduling
            // will check that no jobs are writing to the container).
            DisposeSentinel.Clear(ref m_DisposeSentinel);
#endif
            var jobHandle = new DisposeJob {
                blockList = m_blockList, state = m_state
            }.Schedule(inputDeps);

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Release(m_Safety);
#endif
            return(jobHandle);
        }
Пример #8
0
        public JobHandle Dispose(JobHandle inputDeps)
        {
            if (m_Buffer == null)
            {
                return(inputDeps);
            }
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            DisposeSentinel.Clear(ref m_DisposeSentinel);
#endif
            var jobHandle = new DisposeJob {
                Container = this
            }.Schedule(inputDeps);

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Release(m_Safety);
#endif
            m_Buffer = null;

            return(jobHandle);
        }
Пример #9
0
        public JobHandle ScheduleDispose(JobHandle inputDeps)
        {
            // [DeallocateOnJobCompletion] is not supported, but we want the deallocation to happen in a thread.
            // DisposeSentinel needs to be cleared on main thread.
            // AtomicSafetyHandle can be destroyed after the job was scheduled
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            DisposeSentinel.Clear(ref m_DisposeSentinel);
#endif
            var jobHandle = new DisposeJob {
                BlockStream = this
            }.Schedule(inputDeps);

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Release(m_Safety);
#endif

            m_Block = null;

            return(jobHandle);
        }
Пример #10
0
        /// <summary>
        /// Schedule a job to release the set's unmanaged memory after the given
        /// dependency jobs. Do not use it after this job executes. Do
        /// not call <see cref="Dispose()"/> on copies of the set either.
        ///
        /// This operation requires write access.
        ///
        /// This complexity of this operation is O(1) plus the allocator's
        /// deallocation complexity.
        /// </summary>
        public JobHandle Dispose(JobHandle inputDeps)
        {
            RequireWriteAccess();

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            // Clear the dispose sentinel, but don't Dispose it
            DisposeSentinel.Clear(ref m_DisposeSentinel);
#endif

            // Schedule the job
            DisposeJob disposeJob = new DisposeJob {
                Set = this
            };
            JobHandle jobHandle = disposeJob.Schedule(inputDeps);

            // Release the atomic safety handle now that the job is scheduled
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            AtomicSafetyHandle.Release(m_Safety);
#endif

            m_State = null;
            return(jobHandle);
        }