| | | 1 | | // Copyright (c) 2020-2024 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | using Unity.Burst; |
| | | 6 | | using Unity.Collections; |
| | | 7 | | using Unity.Jobs; |
| | | 8 | | |
| | | 9 | | namespace GDX.Jobs.ParallelFor |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Copy one <see cref="Unity.Collections.NativeArray{T}" /> typed as <see cref="System.Int32" /> to another in |
| | | 13 | | /// parallel. |
| | | 14 | | /// </summary> |
| | | 15 | | [BurstCompile] |
| | | 16 | | public struct IntegerBufferCopyJob : IJobParallelFor |
| | | 17 | | { |
| | | 18 | | /// <summary> |
| | | 19 | | /// <para>The destination <see cref="Unity.Collections.NativeArray{T}" /> typed as <see cref="System.Int32" |
| | | 20 | | /// </summary> |
| | | 21 | | /// <remarks>Write-only.</remarks> |
| | | 22 | | [WriteOnly] public NativeArray<int> Destination; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// <para>The source <see cref="Unity.Collections.NativeArray{T}" /> typed as <see cref="System.Int32" />.</ |
| | | 26 | | /// </summary> |
| | | 27 | | /// <remarks>Read-only.</remarks> |
| | | 28 | | [ReadOnly] public NativeArray<int> Source; |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Executable work for the provided index. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <param name="index">The index of the Parallel for loop at which to perform work.</param> |
| | | 34 | | public void Execute(int index) |
| | 0 | 35 | | { |
| | 0 | 36 | | Destination[index] = Source[index]; |
| | 0 | 37 | | } |
| | | 38 | | } |
| | | 39 | | } |