public unsafe static JobHandle ScheduleBatch(NativeArray <RaycastCommand> commands, NativeArray <RaycastHit> results, int minCommandsPerJob, int maxHits, JobHandle dependsOn = new JobHandle()) { if (maxHits < 1) { Debug.LogWarning("maxHits should be greater than 0."); return(new JobHandle()); } else if (results.Length < maxHits * commands.Length) { Debug.LogWarning("The supplied results buffer is too small, there should be at least maxHits space per each command in the batch."); return(new JobHandle()); } var jobData = new BatchQueryJob <RaycastCommand, RaycastHit>(commands, results); var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), BatchQueryJobStruct <BatchQueryJob <RaycastCommand, RaycastHit> > .Initialize(), dependsOn, ScheduleMode.Parallel); return(ScheduleRaycastBatch(ref scheduleParams, NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(commands), commands.Length, NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(results), results.Length, minCommandsPerJob, maxHits)); }
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)); }
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)); }