static unsafe JobHandle Schedule(void *fullData, NativeArray <byte> prefilterData, int unfilteredLength, int innerloopBatchCount, bool isParallelFor, bool isFiltered, ref JobForEachCache cache, void *deferredCountData, JobHandle dependsOn, ScheduleMode mode) { #if ENABLE_UNITY_COLLECTIONS_CHECKS try { #endif if (isParallelFor) { var scheduleParams = new JobsUtility.JobScheduleParameters(fullData, cache.JobReflectionDataParallelFor, dependsOn, mode); if (isFiltered) { return(JobsUtility.ScheduleParallelForDeferArraySize(ref scheduleParams, innerloopBatchCount, deferredCountData, null)); } else { return(JobsUtility.ScheduleParallelFor(ref scheduleParams, unfilteredLength, innerloopBatchCount)); } } else { var scheduleParams = new JobsUtility.JobScheduleParameters(fullData, cache.JobReflectionData, dependsOn, mode); return(JobsUtility.Schedule(ref scheduleParams)); } #if ENABLE_UNITY_COLLECTIONS_CHECKS } catch (InvalidOperationException e) { prefilterData.Dispose(); throw e; } #endif }
// Schedule() implementation for ITriggerEventsJob when Havok Physics is available public static unsafe JobHandle Schedule <T>(this T jobData, ISimulation simulation, ref PhysicsWorld world, JobHandle inputDeps) where T : struct, ITriggerEventsJob { switch (simulation.Type) { case SimulationType.UnityPhysics: // Call the scheduling method for Unity.Physics return(ITriggerEventJobExtensions.ScheduleUnityPhysicsTriggerEventsJob(jobData, simulation, ref world, inputDeps)); case SimulationType.HavokPhysics: { var data = new TriggerEventJobData <T> { UserJobData = jobData, EventReader = ((Havok.Physics.HavokSimulation)simulation).TriggerEvents }; // Ensure the input dependencies include the end-of-simulation job, so events will have been generated inputDeps = JobHandle.CombineDependencies(inputDeps, simulation.FinalSimulationJobHandle); var parameters = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref data), TriggerEventJobProcess <T> .Initialize(), inputDeps, ScheduleMode.Batched); return(JobsUtility.Schedule(ref parameters)); } default: return(inputDeps); } }
public unsafe static JobHandle ScheduleBatch(NativeArray <ClosestPointCommand> commands, NativeArray <Vector3> results, int minCommandsPerJob, JobHandle dependsOn = new JobHandle()) { var jobData = new BatchQueryJob <ClosestPointCommand, Vector3>(commands, results); var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), BatchQueryJobStruct <BatchQueryJob <ClosestPointCommand, Vector3> > .Initialize(), dependsOn, ScheduleMode.Parallel); return(ScheduleClosestPointCommandBatch(ref scheduleParams, NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(commands), commands.Length, NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(results), results.Length, minCommandsPerJob)); }
static unsafe JobHandle Schedule <T>(ref T jobData, IntPtr arrayLengthPtr, int innerloopBatchCount, JobHandle dependsOn) where T : struct, IJobParallelForDefer { #if UNITY_SINGLETHREADED_JOBS var arrayLength = UnsafeUtility.AsRef <int>(arrayLengthPtr.ToPointer()); for (var i = 0; i < arrayLength; ++i) { jobData.Execute(i); } DoDeallocateOnJobCompletion(jobData); return(new JobHandle()); #else var jobStruct = new JobStructDefer <T>() { JobData = jobData, ArrayLengthPtr = arrayLengthPtr, }; var jobDataPtr = UnsafeUtility.Malloc(UnsafeUtility.SizeOf <JobStructDefer <T> >(), UnsafeUtility.AlignOf <JobStructDefer <T> >(), Allocator.TempJob); UnsafeUtility.CopyStructureToPtr(ref jobStruct, jobDataPtr); var scheduleParams = new JobsUtility.JobScheduleParameters(jobDataPtr, JobStructDefer <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, JobsUtility.JobQueueThreadCount, innerloopBatchCount)); #endif }
/// <summary> Schedule a <see cref="IJobEventReader{T}"/> job. </summary> /// <param name="jobData"> The job. </param> /// <param name="eventSystem"> The event system. </param> /// <param name="dependsOn"> The job handle dependency. </param> /// <typeparam name="TJob"> The type of the job. </typeparam> /// <typeparam name="T"> The type of the key in the hash map. </typeparam> /// <returns> The handle to job. </returns> public static unsafe JobHandle Schedule <TJob, T>( this TJob jobData, EventSystemBase eventSystem, JobHandle dependsOn = default) where TJob : struct, IJobEventReader <T> where T : struct { dependsOn = eventSystem.GetEventReaders <T>(dependsOn, out var events); for (var i = 0; i < events.Count; i++) { var fullData = new EventJobReaderStruct <TJob, T> { Reader = events[i], JobData = jobData, Index = i, }; #if UNITY_2020_2_OR_NEWER const ScheduleMode scheduleMode = ScheduleMode.Parallel; #else const ScheduleMode scheduleMode = ScheduleMode.Batched; #endif var scheduleParams = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref fullData), EventJobReaderStruct <TJob, T> .Initialize(), dependsOn, scheduleMode); dependsOn = JobsUtility.Schedule(ref scheduleParams); } eventSystem.AddJobHandleForConsumer <T>(dependsOn); return(dependsOn); }
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)); }
public static JobHandle ScheduleBatch(NativeArray <RaycastCommand> commands, NativeArray <RaycastHit> results, int minCommandsPerJob, JobHandle dependsOn = default(JobHandle)) { BatchQueryJob <RaycastCommand, RaycastHit> batchQueryJob = new BatchQueryJob <RaycastCommand, RaycastHit>(commands, results); JobsUtility.JobScheduleParameters jobScheduleParameters = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf <BatchQueryJob <RaycastCommand, RaycastHit> >(ref batchQueryJob), BatchQueryJobStruct <BatchQueryJob <RaycastCommand, RaycastHit> > .Initialize(), dependsOn, ScheduleMode.Batched); return(RaycastCommand.ScheduleRaycastBatch(ref jobScheduleParameters, NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks <RaycastCommand>(commands), commands.Length, NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks <RaycastHit>(results), results.Length, minCommandsPerJob)); }
// Schedule() implementation for IContactsJob when Havok Physics is available public static unsafe JobHandle Schedule <T>(this T jobData, ISimulation simulation, ref PhysicsWorld world, JobHandle inputDeps) where T : struct, IContactsJobBase { switch (simulation.Type) { case SimulationType.UnityPhysics: // Call the scheduling method for Unity.Physics return(IContactsJobExtensions.ScheduleUnityPhysicsContactsJob(jobData, simulation, ref world, inputDeps)); case SimulationType.HavokPhysics: { var data = new ContactsJobData <T> { UserJobData = jobData, ManifoldStream = ((Havok.Physics.HavokSimulation)simulation).ManifoldStream, PluginIndexToLocal = ((Havok.Physics.HavokSimulation)simulation).PluginIndexToLocal, Bodies = world.Bodies }; var parameters = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref data), ContactsJobProcess <T> .Initialize(), inputDeps, ScheduleMode.Batched); return(JobsUtility.Schedule(ref parameters)); } default: return(inputDeps); } }
public static unsafe JobHandle ScheduleBatch <T>(this T jobData, int arrayLength, int minIndicesPerJobCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForBatch { #if UNITY_SINGLETHREADED_JOBS jobData.Execute(0, arrayLength); DoDeallocateOnJobCompletion(jobData); return(new JobHandle()); #elif UNITY_DOTSPLAYER var jobStruct = new ParallelForBatchJobStruct <T>() { JobData = jobData, Ranges = new JobRanges() { ArrayLength = arrayLength, IndicesPerPhase = JobsUtility.GetDefaultIndicesPerPhase(arrayLength) }, }; var jobDataPtr = UnsafeUtility.Malloc(UnsafeUtility.SizeOf <ParallelForBatchJobStruct <T> >(), UnsafeUtility.AlignOf <ParallelForBatchJobStruct <T> >(), Allocator.TempJob); UnsafeUtility.CopyStructureToPtr(ref jobStruct, jobDataPtr); var scheduleParams = new JobsUtility.JobScheduleParameters(jobDataPtr, ParallelForBatchJobStruct <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, minIndicesPerJobCount)); #else var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), ParallelForBatchJobStruct <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, minIndicesPerJobCount)); #endif }
private unsafe static JobHandle ScheduleRaycastBatch(ref JobsUtility.JobScheduleParameters parameters, void *commands, int commandLen, void *result, int resultLen, int minCommandsPerJob) { JobHandle result2; RaycastCommand.ScheduleRaycastBatch_Injected(ref parameters, commands, commandLen, result, resultLen, minCommandsPerJob, out result2); return(result2); }
public static unsafe JobHandle ScheduleParallel <T>(this T jobData, int batchSize = 1, JobHandle dependency = default) where T : struct, IJobTimeSlice { var parameters = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), JobTimeSliceStruct <T> .Initialize(), dependency, ScheduleMode.Parallel); var amount = Amount(jobData); return(JobsUtility.ScheduleParallelFor(ref parameters, amount, batchSize)); }
public static unsafe JobHandle Schedule <T>(this T jobData, ref CustomWorld world, JobHandle dependsOn) where T : struct, ICustomJob { var data = new CustomJobData <T> { UserJobData = jobData, abData = world.abData, testArray = new NativeArray <int>(10, Allocator.TempJob) }; var parameters = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref data), CustomJobProcess <T> .Initialize(), dependsOn, ScheduleMode.Batched #if JOBS_CODEGEN_SAMPLE , UnsafeUtility.SizeOf <CustomJobData <T> >() // A size for memory allocation , data.UserJobData.PrepareJobAtScheduleTimeFn_Gen() // The return parameter does nothing except debug checks. // Just a reasonable place to find and insert the // call to PrepareJobAtScheduleTimeFn_Gen #endif ); return(JobsUtility.Schedule(ref parameters)); }
public static unsafe void Run <T>(this T jobData, JobHandle dependency = default) where T : struct, IJobTimeSlice { var parameters = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), JobTimeSliceStruct <T> .Initialize(), dependency, ScheduleMode.Run); var amount = Amount(jobData); JobsUtility.ScheduleParallelFor(ref parameters, amount, amount); }
public static JobHandle Schedule <T>(this T jobData, ParticleSystem ps, JobHandle dependsOn = default(JobHandle)) where T : struct, IJobParticleSystem { JobsUtility.JobScheduleParameters jobScheduleParameters = IParticleSystemJobExtensions.CreateScheduleParams <T>(ref jobData, ps, dependsOn, ParticleSystemJobStruct <T> .Initialize()); JobHandle jobHandle = ParticleSystem.ScheduleManagedJob(ref jobScheduleParameters, ps.GetManagedJobData()); ps.SetManagedJobHandle(jobHandle); return(jobHandle); }
public static JobHandle ScheduleBatch <T>(this T jobData, ParticleSystem ps, int innerLoopBatchCount, JobHandle dependsOn = default(JobHandle)) where T : struct, IJobParticleSystemParallelForBatch { JobsUtility.JobScheduleParameters jobScheduleParameters = IParticleSystemJobExtensions.CreateScheduleParams <T>(ref jobData, ps, dependsOn, ParticleSystemParallelForBatchJobStruct <T> .Initialize()); JobHandle jobHandle = JobsUtility.ScheduleParallelForDeferArraySize(ref jobScheduleParameters, innerLoopBatchCount, ps.GetManagedJobData(), null); ps.SetManagedJobHandle(jobHandle); return(jobHandle); }
/// <summary> /// Schedule the job for execution on worker threads. /// forEachCount is a pointer to the number of iterations, when dependsOn has completed. /// This API is unsafe, it is recommended to use the NativeList based Schedule method instead. /// </summary> /// <param name="jobData"></param> /// <param name="forEachCount"></param> /// <param name="innerloopBatchCount"></param> /// <param name="dependsOn"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> unsafe public static JobHandle Schedule <T>(this T jobData, int *forEachCount, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForDefer { var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), JobStructDefer <T> .Initialize(), dependsOn, ScheduleMode.Batched); var forEachListPtr = (byte *)forEachCount - sizeof(void *); return(JobsUtility.ScheduleParallelForDeferArraySize(ref scheduleParams, innerloopBatchCount, forEachListPtr, null)); }
public static unsafe void RunBatch <T>(this T jobData, int arrayLength) where T : struct, IJobParallelForBatch { var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), JobParallelForBatchProducer <T> .Initialize(), new JobHandle(), ScheduleMode.Run); JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, arrayLength); }
public static unsafe void RunBatch <T>(this T jobData, int arrayLength) where T : struct, IJobParallelForBatch { #if UNITY_DOTSPLAYER ScheduleBatch(jobData, arrayLength, arrayLength).Complete(); #else var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), ParallelForBatchJobStruct <T> .Initialize(), new JobHandle(), ScheduleMode.Run); JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, arrayLength); #endif }
unsafe internal static void Run <T>(this T jobData) where T : struct, IJobBurstSchedulable { var reflectionData = JobStruct <T> .jobReflectionData.Data; CheckReflectionDataCorrect(reflectionData); var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, new JobHandle(), ScheduleMode.Run); JobsUtility.Schedule(ref scheduleParams); }
public unsafe static JobHandle ScheduleWithInt <T>(this T jobData, int value, JobHandle dependsOn = new JobHandle()) where T : struct, IJobWithInt { JobDataWithInt <T> jobDataWithInt = new JobDataWithInt <T> { value = value, jobData = jobData }; var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobDataWithInt), JobWithIntStruct <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.Schedule(ref scheduleParams)); }
unsafe static public JobHandle ScheduleFilter <T>(this T jobData, NativeList <int> indices, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForFilter { JobStructProduce <T> .JobDataWithFiltering fullData; fullData.data = jobData; fullData.outputIndices = indices; fullData.appendCount = -1; var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref fullData), JobStructProduce <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.Schedule(ref scheduleParams)); }
unsafe public static JobHandle Schedule <T>(this T jobData, int arrayLength, JobHandle dependency) where T : struct, IJobFor { // https://unity3d.atlassian.net/browse/DOTSR-1888 // var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), JobProducer<T>.Initialize(), dependency, ScheduleMode.Single); // IJobChunk uses both JobsUtility.ScheduleParallelFor and JobsUtility.Schedule, so that could be implemented. // However, it brings this class (which is rarely used) even more out of sync with the Unity.Runtime version, where // the better fix is to implement ScheduleMode.Single var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), JobProducer <T> .Initialize(), dependency, ScheduleMode.Parallel); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, arrayLength)); }
public static unsafe JobHandle ScheduleBatch <T>(this T jobData, int arrayLength, int minIndicesPerJobCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForBatch { var scheduleParams = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref jobData), JobParallelForBatchProducer <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, minIndicesPerJobCount)); }
public unsafe static void RunWithInt <T>(this T jobData, int value) where T : struct, IJobWithInt { JobDataWithInt <T> jobDataWithInt = new JobDataWithInt <T> { value = value, jobData = jobData }; var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobDataWithInt), JobWithIntStruct <T> .Initialize(), new JobHandle(), ScheduleMode.Run); JobsUtility.Schedule(ref scheduleParams); }
unsafe static public JobHandle ScheduleBatch <T>(this T jobData, int arrayLength, int minIndicesPerJobCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForBatched { #if UNITY_2020_2_OR_NEWER // This was renamed in Unity 2020.2 var scheduleMode = ScheduleMode.Parallel; #else var scheduleMode = ScheduleMode.Batched; #endif var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), ParallelForBatchJobStruct <T> .Initialize(), dependsOn, scheduleMode); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, minIndicesPerJobCount)); }
internal static unsafe JobHandle ScheduleInternal <T>(ref T jobData, EntityQuery query, JobHandle dependsOn, ScheduleMode mode) where T : struct, IJobChunk { ComponentChunkIterator iterator = query.GetComponentChunkIterator(); var unfilteredChunkCount = query.CalculateChunkCountWithoutFiltering(); var prefilterHandle = ComponentChunkIterator.PreparePrefilteredChunkLists(unfilteredChunkCount, iterator.m_MatchingArchetypeList, iterator.m_Filter, dependsOn, mode, out var prefilterData, out var deferredCountData); JobChunkData <T> fullData = new JobChunkData <T> { #if ENABLE_UNITY_COLLECTIONS_CHECKS // All IJobChunk jobs have a EntityManager safety handle 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 = query.SafetyManager->GetEntityManagerSafetyHandle() }, #endif Data = jobData, PrefilterData = prefilterData, }; var scheduleParams = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref fullData), JobChunk_Process <T> .Initialize(), prefilterHandle, mode); #if ENABLE_UNITY_COLLECTIONS_CHECKS try { #endif if (mode == ScheduleMode.Batched) { return(JobsUtility.ScheduleParallelForDeferArraySize(ref scheduleParams, 1, deferredCountData, null)); } else { var count = unfilteredChunkCount; return(JobsUtility.ScheduleParallelFor(ref scheduleParams, count, 1)); } #if ENABLE_UNITY_COLLECTIONS_CHECKS } catch (InvalidOperationException e) { prefilterData.Dispose(); throw e; } #endif }
unsafe internal static JobHandle Schedule <T>(this T jobData, JobHandle dependsOn = new JobHandle()) where T : struct, IJobBurstSchedulable { var reflectionData = JobStruct <T> .jobReflectionData.Data; CheckReflectionDataCorrect(reflectionData); #if UNITY_2020_2_OR_NEWER || UNITY_DOTSRUNTIME var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, dependsOn, ScheduleMode.Parallel); #else var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, dependsOn, ScheduleMode.Batched); #endif return(JobsUtility.Schedule(ref scheduleParams)); }
internal static unsafe JobHandle ScheduleInternal <T>( ref T jobData, EntityQuery query, JobHandle dependsOn, ScheduleMode mode, int batchesPerChunk, bool isParallel = true) where T : struct, IJobEntityBatch { var queryImpl = query._GetImpl(); var queryData = queryImpl->_QueryData; var cachedChunks = queryData->GetMatchingChunkCache(); // Don't schedule the job if there are no chunks to work on var chunkCount = cachedChunks.Length; JobEntityBatchWrapper <T> jobEntityBatchWrapper = new JobEntityBatchWrapper <T> { #if ENABLE_UNITY_COLLECTIONS_CHECKS // All IJobEntityBatch jobs have a EntityManager safety handle 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 = queryImpl->SafetyHandles->GetEntityManagerSafetyHandle() }, #endif MatchingArchetypes = queryData->MatchingArchetypes, CachedChunks = cachedChunks, Filter = queryImpl->_Filter, JobData = jobData, JobsPerChunk = batchesPerChunk, IsParallel = isParallel ? 1 : 0 }; var scheduleParams = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref jobEntityBatchWrapper), isParallel ? JobEntityBatchProducer <T> .InitializeParallel() : JobEntityBatchProducer <T> .InitializeSingle(), dependsOn, mode); if (!isParallel) { return(JobsUtility.Schedule(ref scheduleParams)); } else { return(JobsUtility.ScheduleParallelFor(ref scheduleParams, chunkCount * batchesPerChunk, 1)); } }
unsafe public static JobHandle Schedule <T>(this T jobData, int arrayLength, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForBurstScheduable { var reflectionData = ParallelForJobStructBurstScheduable <T> .jobReflectionData.Data; if (reflectionData == IntPtr.Zero) { throw new InvalidOperationException("Reflection data was not set up by code generation"); } var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, innerloopBatchCount)); }
unsafe public static void Run <T>(this T jobData, int arrayLength) where T : struct, IJobParallelForBurstScheduable { var reflectionData = ParallelForJobStructBurstScheduable <T> .jobReflectionData.Data; if (reflectionData == IntPtr.Zero) { throw new InvalidOperationException("Reflection data was not set up by code generation"); } var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, new JobHandle(), ScheduleMode.Run); JobsUtility.ScheduleParallelFor(ref scheduleParams, arrayLength, arrayLength); }