private static IntPtr GetReflectionData <T>() where T : struct, IJobParallelFor { ParallelForJobStruct <T> .Initialize(); var reflectionData = ParallelForJobStruct <T> .jobReflectionData.Data; CheckReflectionDataCorrect(reflectionData); return(reflectionData); }
/// <summary> /// Run a job synchronously /// </summary> /// /// <param name="jobData"> /// Job to run /// </param> /// /// <param name="valuesLength"> /// Length of the values to execute on. /// </param> /// /// <typeparam name="T"> /// Type of job to run /// </typeparam> public static unsafe void RunRanged <T>( this T jobData, int valuesLength) where T : struct, IJobParallelForRanged { var scheduleParams = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref jobData), ParallelForJobStruct <T> .Initialize(), new JobHandle(), ScheduleMode.Run); JobsUtility.ScheduleParallelFor( ref scheduleParams, valuesLength, valuesLength); }
/// <summary> /// Run a job asynchronously /// </summary> /// /// <param name="jobData"> /// Job to run /// </param> /// /// <param name="valuesLength"> /// Length of the values to execute on. /// </param> /// /// <param name="innerloopBatchCount"> /// Number of job executions per batch /// </param> /// /// <param name="dependsOn"> /// Handle of the job that must be run before this job /// </param> /// /// <returns> /// A handle to the created job /// </returns> /// /// <typeparam name="T"> /// Type of job to run /// </typeparam> unsafe public static JobHandle ScheduleRanged <T>( this T jobData, int valuesLength, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForRanged { var scheduleParams = new JobsUtility.JobScheduleParameters( UnsafeUtility.AddressOf(ref jobData), ParallelForJobStruct <T> .Initialize(), dependsOn, ScheduleMode.Batched); return(JobsUtility.ScheduleParallelFor( ref scheduleParams, valuesLength, innerloopBatchCount)); }
unsafe public static JobHandle Schedule <T, U>(this T jobData, NativeList <U> list, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelFor where U : struct { var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), ParallelForJobStruct <T> .Initialize(), dependsOn, ScheduleMode.Batched); void *atomicSafetyHandlePtr = null; #if ENABLE_UNITY_COLLECTIONS_CHECKS var safety = NativeListUnsafeUtility.GetAtomicSafetyHandle(ref list); atomicSafetyHandlePtr = UnsafeUtility.AddressOf(ref safety); #endif return(JobsUtility.ScheduleParallelForDeferArraySize(ref scheduleParams, innerloopBatchCount, NativeListUnsafeUtility.GetInternalListDataPtrUnchecked(ref list), atomicSafetyHandlePtr)); }
public static void EarlyJobInit <T>() where T : struct, IJobParallelFor { ParallelForJobStruct <T> .Initialize(); }