コード例 #1
0
 /// <summary>
 /// Creates a shared static data for the specified context and sub-context (usable from both C# and HPC#)
 /// </summary>
 /// <param name="contextType">A type class that uniquely identifies the this shared data</param>
 /// <param name="subContextType">A type class that uniquely identifies this shared data within a sub-context of the primary context</param>
 /// <param name="alignment">Optional alignment</param>
 /// <returns>A shared static for the specified context</returns>
 public static SharedStatic <T> GetOrCreate(Type contextType, Type subContextType, uint alignment = 0)
 {
     return(new SharedStatic <T>(SharedStatic.GetOrCreateSharedStaticInternal(
                                     BurstRuntime.GetHashCode64(contextType), BurstRuntime.GetHashCode64(subContextType),
                                     (uint)UnsafeUtility.SizeOf <T>(), alignment == 0 ? (uint)4 : alignment)));
 }
コード例 #2
0
 /// <summary>
 /// Creates a shared static data for the specified context and sub-context (usable from both C# and HPC#)
 /// </summary>
 /// <typeparam name="TContext">A type class that uniquely identifies the this shared data.</typeparam>
 /// <typeparam name="TSubContext">A type class that uniquely identifies this shared data within a sub-context of the primary context</typeparam>
 /// <param name="alignment">Optional alignment</param>
 /// <returns>A shared static for the specified context</returns>
 public static SharedStatic <T> GetOrCreate <TContext, TSubContext>(uint alignment = 0)
 {
     return(new SharedStatic <T>(SharedStatic.GetOrCreateSharedStaticInternal(
                                     BurstRuntime.GetHashCode64 <TContext>(), BurstRuntime.GetHashCode64 <TSubContext>(),
                                     (uint)UnsafeUtility.SizeOf <T>(), alignment == 0 ? 4 : alignment)));
 }