ReorderJob.cs 575 B

123456789101112131415161718192021222324252627
  1. using Unity.Burst;
  2. using Unity.Collections;
  3. using Unity.Jobs;
  4. using Unity.Mathematics;
  5. namespace UnityEngine.Rendering.Universal
  6. {
  7. [BurstCompile]
  8. struct ReorderJob<T> : IJobFor
  9. where T : struct
  10. {
  11. [ReadOnly]
  12. public NativeArray<int> indices;
  13. [ReadOnly]
  14. public NativeArray<T> input;
  15. [NativeDisableParallelForRestriction]
  16. public NativeArray<T> output;
  17. public void Execute(int index)
  18. {
  19. var newIndex = indices[index];
  20. output[newIndex] = input[index];
  21. }
  22. }
  23. }