Class IJobFilterExtensions
Extension class for the IJobFilter job type providing custom overloads for scheduling and running.
Namespace: Unity.Jobs
Assembly: Unity.Collections.dll
Syntax
public static class IJobFilterExtensions
Methods
EarlyJobInit<T>()
Gathers and caches reflection data for the internal job system's managed bindings. Unity is responsible for calling this method - don't call it yourself.
Declaration
public static void EarlyJobInit<T>() where T : struct, IJobFilter
Type Parameters
Name | Description |
---|---|
T | Job type |
Remarks
When the Collections package is included in the project, Unity generates code to call EarlyJobInit at startup. This allows Burst compiled code to schedule jobs because the reflection part of initialization, which is not compatible with burst compiler constraints, has already happened in EarlyJobInit.
Note: While the Jobs package code generator handles this automatically for all closed job types, you must register those with generic arguments (like IJobFilter<MyJobType<T>>) manually for each specialization with [[Unity.Jobs.RegisterGenericJobTypeAttribute]].
RunAppendByRef<T>(ref T, NativeList<int>, int)
Executes the appending filter job, on the main thread. See IJobFilterExtensions.ScheduleAppend for more information on how appending is performed.
Declaration
public static void RunAppendByRef<T>(this ref T jobData, NativeList<int> indices, int arrayLength) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be appended to this list. |
int | arrayLength | Number of indices to filter starting from index 0. |
Type Parameters
Name | Description |
---|---|
T | Job type |
RunAppend<T>(T, NativeList<int>, int)
Executes the appending filter job, on the main thread. See IJobFilterExtensions.ScheduleAppend for more information on how appending is performed.
Declaration
public static void RunAppend<T>(this T jobData, NativeList<int> indices, int arrayLength) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. |
NativeList<int> | indices | List of indices to be filtered and appended to. |
int | arrayLength | Length of array the filter job will append to. |
Type Parameters
Name | Description |
---|---|
T | Job type |
RunFilterByRef<T>(ref T, NativeList<int>)
Executes the filter job, on the main thread. See IJobFilterExtensions.Schedule for more information on how appending is performed.
Declaration
public static void RunFilterByRef<T>(this ref T jobData, NativeList<int> indices) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. In this variant, the jobData is passed by reference, which may be necessary for unusually large job structs. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be stored in this list. |
Type Parameters
Name | Description |
---|---|
T | Job type |
RunFilter<T>(T, NativeList<int>)
Executes the filter job, on the main thread. See IJobFilterExtensions.Schedule for more information on how appending is performed.
Declaration
public static void RunFilter<T>(this T jobData, NativeList<int> indices) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be stored in this list. |
Type Parameters
Name | Description |
---|---|
T | Job type |
ScheduleAppendByRef<T>(ref T, NativeList<int>, int, JobHandle)
Schedules a job that will execute the filter job for all integers in indices from index 0 until arrayLength. Each integer which passes the filter (i.e. true is returned from Execute()) will be appended to the indices list.
Declaration
public static JobHandle ScheduleAppendByRef<T>(this ref T jobData, NativeList<int> indices, int arrayLength, JobHandle dependsOn = default) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. In this variant, the jobData is passed by reference, which may be necessary for unusually large job structs. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be appended to this list. |
int | arrayLength | Number of indices to filter starting from index 0. |
JobHandle | dependsOn | Dependencies are used to ensure that a job executes on workerthreads after the dependency has completed execution. Making sure that two jobs reading or writing to same data do not run in parallel. |
Returns
Type | Description |
---|---|
JobHandle | JobHandle The handle identifying the scheduled job. Can be used as a dependency for a later job or ensure completion on the main thread. |
Type Parameters
Name | Description |
---|---|
T | Job type |
ScheduleAppend<T>(T, NativeList<int>, int, JobHandle)
Schedules a job that will execute the filter job for all integers in indices from index 0 until arrayLength. Each integer which passes the filter (i.e. true is returned from Execute()) will be appended to the indices list.
Declaration
public static JobHandle ScheduleAppend<T>(this T jobData, NativeList<int> indices, int arrayLength, JobHandle dependsOn = default) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be appended to this list. |
int | arrayLength | Number of indices to filter starting from index 0. |
JobHandle | dependsOn | Dependencies are used to ensure that a job executes on workerthreads after the dependency has completed execution. Making sure that two jobs reading or writing to same data do not run in parallel. |
Returns
Type | Description |
---|---|
JobHandle | JobHandle The handle identifying the scheduled job. Can be used as a dependency for a later job or ensure completion on the main thread. |
Type Parameters
Name | Description |
---|---|
T | Job type |
ScheduleFilterByRef<T>(ref T, NativeList<int>, JobHandle)
Schedules a job that will execute the filter job for all integers in indices from index 0 until arrayLength. Each integer which passes the filter (i.e. true is returned from Execute()) will be used to repopulate the indices list. This has the effect of excluding all integer values that do not pass the filter.
Declaration
public static JobHandle ScheduleFilterByRef<T>(this ref T jobData, NativeList<int> indices, JobHandle dependsOn = default) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. In this variant, the jobData is passed by reference, which may be necessary for unusually large job structs. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be stored in this list. |
JobHandle | dependsOn | Dependencies are used to ensure that a job executes on workerthreads after the dependency has completed execution. Making sure that two jobs reading or writing to same data do not run in parallel. |
Returns
Type | Description |
---|---|
JobHandle | JobHandle The handle identifying the scheduled job. Can be used as a dependency for a later job or ensure completion on the main thread. |
Type Parameters
Name | Description |
---|---|
T | Job type |
ScheduleFilter<T>(T, NativeList<int>, JobHandle)
Schedules a job that will execute the filter job for all integers in indices from index 0 until arrayLength. Each integer which passes the filter (i.e. true is returned from Execute()) will be used to repopulate the indices list. This has the effect of excluding all integer values that do not pass the filter.
Declaration
public static JobHandle ScheduleFilter<T>(this T jobData, NativeList<int> indices, JobHandle dependsOn = default) where T : struct, IJobFilter
Parameters
Type | Name | Description |
---|---|---|
T | jobData | The job and data to schedule. |
NativeList<int> | indices | List of indices to be filtered. Filtered results will be stored in this list. |
JobHandle | dependsOn | Dependencies are used to ensure that a job executes on workerthreads after the dependency has completed execution. Making sure that two jobs reading or writing to same data do not run in parallel. |
Returns
Type | Description |
---|---|
JobHandle | JobHandle The handle identifying the scheduled job. Can be used as a dependency for a later job or ensure completion on the main thread. |
Type Parameters
Name | Description |
---|---|
T | Job type |