public static unsafe IntPtr CreateJobReflectionData(Type type, Delegate executeDelegate, Delegate cleanupDelegate = null, ManagedJobForEachDelegate codegenExecuteDelegate = null, ManagedJobDelegate codegenCleanupDelegate = null, int codegenUnmanagedJobSize = -1, ManagedJobMarshalDelegate codegenMarshalToBurstDelegate = null) { return(CreateJobReflectionData(type, type, executeDelegate, cleanupDelegate, codegenExecuteDelegate, codegenCleanupDelegate, codegenUnmanagedJobSize, codegenMarshalToBurstDelegate)); }
public static unsafe IntPtr CreateJobReflectionData(Type type, Type _, Delegate executeDelegate, Delegate cleanupDelegate = null, ManagedJobForEachDelegate codegenExecuteDelegate = null, ManagedJobDelegate codegenCleanupDelegate = null, int codegenUnmanagedJobSize = -1, ManagedJobMarshalDelegate codegenMarshalToBurstDelegate = null) { // Tiny doesn't use this on any codepath currently; may need future support for custom jobs. Assert.IsTrue(cleanupDelegate == null, "Runtime needs support for cleanup delegates in jobs."); Assert.IsTrue(codegenExecuteDelegate != null, "Code gen should have supplied an execute wrapper."); #if ENABLE_UNITY_COLLECTIONS_CHECKS && !UNITY_DOTSRUNTIME_IL2CPP Assert.IsTrue((codegenUnmanagedJobSize != -1 && codegenMarshalToBurstDelegate != null) || (codegenUnmanagedJobSize == -1 && codegenMarshalToBurstDelegate == null), "Code gen should have supplied a marshal wrapper."); #endif ReflectionDataProxy *reflectionDataPtr = (ReflectionDataProxy *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <ReflectionDataProxy>(), UnsafeUtility.AlignOf <ReflectionDataProxy>(), Allocator.Persistent); var reflectionData = new ReflectionDataProxy(); // Protect against garbage collector relocating delegate ReflectionDataStore store = new ReflectionDataStore(executeDelegate, codegenCleanupDelegate, codegenExecuteDelegate, codegenMarshalToBurstDelegate); store.next = Managed.reflectionDataStoreRoot; Managed.reflectionDataStoreRoot = store; reflectionData.ExecuteFunctionPtr = store.CodeGenExecuteFunctionPtr; if (codegenCleanupDelegate != null) { reflectionData.CleanupFunctionPtr = store.CodeGenCleanupFunctionPtr; } #if ENABLE_UNITY_COLLECTIONS_CHECKS && !UNITY_DOTSRUNTIME_IL2CPP reflectionData.UnmanagedSize = codegenUnmanagedJobSize; if (codegenUnmanagedJobSize != -1) { reflectionData.MarshalToBurstFunctionPtr = store.CodeGenMarshalToBurstFunctionPtr; } #endif UnsafeUtility.CopyStructureToPtr(ref reflectionData, reflectionDataPtr); return((IntPtr)reflectionDataPtr); }