Exemple #1
0
 public void Init()
 {
     rng = new Random(1);
     u   = (uint2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <uint2>() * iterations, UnsafeUtility.AlignOf <uint2>(), Allocator.Persistent);
     for (int i = 0; i < iterations; ++i)
     {
         u[i] = 0;
     }
 }
Exemple #2
0
                public void Init()
                {
                    v = (float2x2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <float2x2>() * 100000, UnsafeUtility.AlignOf <float2x2>(), Allocator.Persistent);
                    for (int i = 0; i < 100000; ++i)
                    {
                        v[i] = new float2x2(1.0f);
                    }

                    hash = (uint2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <uint2>() * 100000, UnsafeUtility.AlignOf <uint2>(), Allocator.Persistent);
                    for (int i = 0; i < 100000; ++i)
                    {
                        hash[i] = 0;
                    }
                }
                public void Init()
                {
                    rng = (Random *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <Random>() * 10000, UnsafeUtility.AlignOf <Random>(), Allocator.Persistent);
                    for (int i = 0; i < 10000; ++i)
                    {
                        rng[i] = new Unity.Mathematics.Random(1);
                    }

                    u = (uint2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <uint2>() * 10000, UnsafeUtility.AlignOf <uint2>(), Allocator.Persistent);
                    for (int i = 0; i < 10000; ++i)
                    {
                        u[i] = 0;
                    }
                }
                public void Init()
                {
                    rng = new Random(1);
                    v   = (float2x2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <float2x2>() * iterations, UnsafeUtility.AlignOf <float2x2>(), Allocator.Persistent);
                    for (int i = 0; i < iterations; ++i)
                    {
                        v[i] = new float2x2(1.0f);
                    }

                    hash = (uint2 *)UnsafeUtility.Malloc(UnsafeUtility.SizeOf <uint2>() * iterations, UnsafeUtility.AlignOf <uint2>(), Allocator.Persistent);
                    for (int i = 0; i < iterations; ++i)
                    {
                        hash[i] = 0;
                    }
                }
		/// <summary>
		/// Creates a new CudaRegisteredHostMemory_uint2 from an existing IntPtr. IntPtr must be page size aligned (4KBytes)!
		/// </summary>
		/// <param name="hostPointer">must be page size aligned (4KBytes)</param>
		/// <param name="size">In elements</param>
		public CudaRegisteredHostMemory_uint2(IntPtr hostPointer, SizeT size)
		{
			_intPtr = hostPointer;
			_size = size;
			_typeSize = (SizeT)Marshal.SizeOf(typeof(uint2));
			_ptr = (uint2*)_intPtr;
		}