public JobHandle Count(JobHandle dependsOn, out NativeRef <int> count, Allocator allocator) { count = new NativeRef <int>(allocator, 0); return(new CountJob() { count = count, data = mBuffer }.Schedule(dependsOn)); }
public static void DisposeRefTarget <T>(this NativeRef <T> nativeRef, bool DisposeSelf = true) where T : unmanaged, IDisposable { nativeRef.AsRef.Dispose(); nativeRef.AsRef = default; if (DisposeSelf) { nativeRef.Dispose(); } }
public static JobHandle DisposeRefTarget <T>(this NativeRef <T> nativeRef, JobHandle dependsOn, bool DisposeSelf = true) where T : unmanaged, IDisposable { var targetJob = new DisposeInJob <T>(nativeRef.AsRef).Schedule(dependsOn); nativeRef.AsRef = default; if (DisposeSelf) { dependsOn = nativeRef.Dispose(dependsOn); } return(JobHandle.CombineDependencies(targetJob, dependsOn)); }
public JobHandle Evaluate(JobHandle dependsOn) { var hashCap = new NativeRef <int>(Allocator.TempJob, 0); dependsOn = new GetHashCapJob() { HashCap = hashCap, data = mBuffer }.Schedule(dependsOn); return(new EvaluateJob() { data = mBuffer }.Schedule(hashCap, 8, dependsOn)); }
void MakeWrittable() { // If the bitmap only has one reference, that reference is the one held by this instance, so // no other image is referencing this one. In that case, the bitmap can be safely modified. // On the other hand, if the bitmap is being referenced by another image, an local copy // has to be made if (NativeRef.ReferenceCount > 1) { Backend = ToolkitEngine.ImageBackendHandler.CopyBitmap(Backend); NativeRef.ReleaseReference(true); NativeRef = new NativeImageRef(Backend, ToolkitEngine); } }
public DrawingImage() { Backend = Toolkit.CurrentEngine.ImageBackendHandler.CreateCustomDrawn(Draw); Init(); NativeRef.SetCustomDrawSource(Draw); }
unsafe public static JobHandle Schedule <T>(this T jobData, NativeRef <int> forEachCount, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) where T : struct, IJobParallelForDefer { return(IJobParallelForDeferExtensions.Schedule(jobData, forEachCount.Ptr, innerloopBatchCount, dependsOn)); }