Ejemplo n.º 1
0
    public static unsafe JobHandle Schedule <TJob>(this TJob jobData, NativeMultiHashMap <int, int> hashMap, int minIndicesPerJobCount, JobHandle dependsOn = new JobHandle())
        where TJob : struct, IJobNativeMultiHashMapMergedSharedKeyIndices
    {
        var jobProducer = new JobNativeMultiHashMapMergedSharedKeyIndicesProducer <TJob>
        {
            HashMap = hashMap,
            JobData = jobData
        };

        var scheduleParams = new JobsUtility.JobScheduleParameters(
            UnsafeUtility.AddressOf(ref jobProducer)
            , JobNativeMultiHashMapMergedSharedKeyIndicesProducer <TJob> .Initialize()
            , dependsOn
            , ScheduleMode.Parallel
            );

        return(JobsUtility.ScheduleParallelFor(ref scheduleParams, hashMap.GetUnsafeBucketData().bucketCapacityMask + 1, minIndicesPerJobCount));
    }
Ejemplo n.º 2
0
        public static unsafe JobHandle Schedule <TJob, TKey, TValue>
            (this TJob jobData, NativeMultiHashMap <TKey, TValue> hashMap, int minIndicesPerJobCount, JobHandle dependsOn = new JobHandle())
            where TJob : struct, IJobNativeMultiHashMapVisitKeyMutableValue <TKey, TValue>
            where TKey : struct, IEquatable <TKey>
            where TValue : struct
        {
            var jobProducer = new JobNativeMultiHashMapVisitKeyMutableValueProducer <TJob, TKey, TValue>
            {
                HashMap = hashMap,
                JobData = jobData
            };

            var scheduleParams = new JobsUtility.JobScheduleParameters(
                UnsafeUtility.AddressOf(ref jobProducer)
                , JobNativeMultiHashMapVisitKeyMutableValueProducer <TJob, TKey, TValue> .Initialize()
                , dependsOn
                , ScheduleMode.Batched
                );

            return(JobsUtility.ScheduleParallelFor(ref scheduleParams, hashMap.GetUnsafeBucketData().bucketCapacityMask + 1, minIndicesPerJobCount));
        }