#Turn NativeList<T> into a NativeSlice<U> without sync points

1 messages · Page 1 of 1 (latest)

oblique charm
#

Let's say JobA is writing to a NativeList<T> and then JobB takes a NativeSlice<U> which is being read from the NativeList<T>. So far my best attempt has been to use new JobB { theSlice = list.AsDeferredJobArray().Slice().SliceWithStride<Something>() }.Schedule(); However this doesn't work because the array returned by AsDeferredJobArray has a length of 0, in my case it's important to keep the SliceWithStride part. Is there a way to do this without first creating a sync point for JobA?

wide moat
#

Do you need to use NativeSlice with striding? Would a [Readonly] NativeArray be good enough for JobB in your use case?

oblique charm
#

As you said I could change JobB and then maybe create the NativeSlice within JobB, but I just wanted to know if there was a solution that didn't involve changing JobB

wide moat
#

Yeah, the problem you have is you're slicing the array before the "deferred" part is resolved. There isn't a deferred NativeSlice since you can make a slice from a NativeArray, but when you don't own the Job using a slice I can see the issue