예제 #1
0
        internal static unsafe JobHandle ScheduleInternal <T>(ref T jobData, ComponentGroup group, JobHandle dependsOn, ScheduleMode mode)
            where T : struct, IJobChunk
        {
            ComponentChunkIterator iterator = group.GetComponentChunkIterator();

            JobDataLiveFilter <T> fullData = new JobDataLiveFilter <T>
            {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
                // All IJobChunk jobs have a safety handle for the Entity type to ensure that BeforeStructuralChange throws an error if
                // jobs without any other safety handles are still running (haven't been synced).
                safety = new EntitySafetyHandle {
                    m_Safety = group.SafetyManager.GetSafetyHandle(TypeManager.GetTypeIndex <Entity>(), true)
                },
#endif
                data     = jobData,
                iterator = iterator,
            };
            var totalChunks = group.CalculateNumberOfChunksWithoutFiltering();

            var scheduleParams = new JobsUtility.JobScheduleParameters(
                UnsafeUtility.AddressOf(ref fullData),
                JobChunkLiveFilter_Process <T> .Initialize(),
                dependsOn,
                mode);

            return(JobsUtility.ScheduleParallelFor(ref scheduleParams, totalChunks, 1));
        }
예제 #2
0
        internal static unsafe JobHandle ScheduleInternal <T>(ref T jobData, ComponentGroup group, JobHandle dependsOn, ScheduleMode mode) where T : struct, IJobChunk
        {
            ComponentChunkIterator iterator;

            group.GetComponentChunkIterator(out iterator);
            JobDataLiveFilter <T> output = new JobDataLiveFilter <T> {
                data     = jobData,
                iterator = iterator
            };

            JobsUtility.JobScheduleParameters parameters = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf <JobDataLiveFilter <T> >(ref output), JobChunkLiveFilter_Process <T> .Initialize(), dependsOn, mode);
            return(JobsUtility.ScheduleParallelFor(ref parameters, group.CalculateNumberOfChunksWithoutFiltering(), 1));
        }
            internal unsafe static void ExecuteInternal(ref JobDataLiveFilter <T> jobData, ref JobRanges ranges, int jobIndex)
            {
                int chunkIndex, end;

                while (JobsUtility.GetWorkStealingRange(ref ranges, jobIndex, out chunkIndex, out end))
                {
                    jobData.iterator.MoveToChunkWithoutFiltering(chunkIndex);
                    if (!jobData.iterator.MatchesFilter())
                    {
                        continue;
                    }

                    var chunk = jobData.iterator.GetCurrentChunk();
                    jobData.data.Execute(chunk, chunkIndex);
                }
            }
예제 #4
0
        internal static unsafe JobHandle ScheduleInternal <T>(ref T jobData, ComponentGroup group, JobHandle dependsOn, ScheduleMode mode)
            where T : struct, IJobChunk
        {
            ComponentChunkIterator iterator = group.GetComponentChunkIterator();

            JobDataLiveFilter <T> fullData = new JobDataLiveFilter <T>
            {
                data     = jobData,
                iterator = iterator,
            };
            var totalChunks = group.CalculateNumberOfChunksWithoutFiltering();

            var scheduleParams = new JobsUtility.JobScheduleParameters(
                UnsafeUtility.AddressOf(ref fullData),
                JobChunkLiveFilter_Process <T> .Initialize(),
                dependsOn,
                mode);

            return(JobsUtility.ScheduleParallelFor(ref scheduleParams, totalChunks, 1));
        }
예제 #5
0
 public unsafe static void Execute(ref JobDataLiveFilter <T> jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref JobRanges ranges, int jobIndex)
 {
     ExecuteInternal(ref jobData, ref ranges, jobIndex);
 }