コード例 #1
0
        public void Float4ToIntFunc()
        {
            using ReadWriteBuffer <int> buffer = Gpu.Default.AllocateReadWriteBuffer <int>(1);

            Gpu.Default.For(1, id => buffer[0] = StaticMethodsContainer.Sum(new Float4(1, 2, 3, 14)));

            int[] result = buffer.GetData();

            Assert.IsTrue(result[0] == 20);
        }
コード例 #2
0
        public void IntToOutIntFunc()
        {
            using ReadWriteBuffer <int> buffer = Gpu.Default.AllocateReadWriteBuffer <int>(1);

            Gpu.Default.For(1, id => StaticMethodsContainer.Assign(7, out buffer[0]));

            int[] result = buffer.GetData();

            Assert.IsTrue(result[0] == 7);
        }
コード例 #3
0
        public void InternalFloatToFloatFunc()
        {
            using ReadWriteBuffer <float> buffer = Gpu.Default.AllocateReadWriteBuffer <float>(1);

            Gpu.Default.For(1, id => buffer[0] = StaticMethodsContainer.InternalSquare(3));

            float[] result = buffer.GetData();

            Assert.IsTrue(MathF.Abs(result[0] - 9) < 0.0001f);
        }
コード例 #4
0
        public void IntToRefIntFunc()
        {
            int[] data = { 3 };
            using ReadWriteBuffer <int> buffer = Gpu.Default.AllocateReadWriteBuffer(data);

            Gpu.Default.For(1, id => StaticMethodsContainer.ReadAndSquare(ref buffer[0]));

            buffer.GetData(data);

            Assert.IsTrue(data[0] == 9);
        }
コード例 #5
0
        public void FloatToFloat4Func()
        {
            using ReadWriteBuffer <Float4> buffer = Gpu.Default.AllocateReadWriteBuffer <Float4>(1);

            Gpu.Default.For(1, id => buffer[0] = StaticMethodsContainer.Range(3));

            Float4[] result = buffer.GetData();

            Assert.IsTrue(MathF.Abs(result[0].X - 3) < 0.0001f);
            Assert.IsTrue(MathF.Abs(result[0].Y - 4) < 0.0001f);
            Assert.IsTrue(MathF.Abs(result[0].Z - 5) < 0.0001f);
            Assert.IsTrue(MathF.Abs(result[0].W - 6) < 0.0001f);
        }
コード例 #6
0
 public void Execute(ThreadIds ids)
 {
     B[0] = StaticMethodsContainer.SquareWithAttributes(4);
 }
コード例 #7
0
 public void Execute(ThreadIds ids)
 {
     B[0] = StaticMethodsContainer.Square(4);
 }
コード例 #8
0
 public void Execute(ThreadIds ids)
 {
     B[0] = StaticMethodsContainer.Range(3);
 }
コード例 #9
0
 public void Execute(ThreadIds ids)
 {
     B[0] = StaticMethodsContainer.InternalSquare(3);
 }
コード例 #10
0
 public void Execute(ThreadIds ids)
 {
     StaticMethodsContainer.ReadAndSquare(ref B[0]);
 }
コード例 #11
0
 public void Execute(ThreadIds ids)
 {
     StaticMethodsContainer.Assign(7, out B[0]);
 }
コード例 #12
0
 public void Execute(ThreadIds ids)
 {
     B[0] = StaticMethodsContainer.Sum(new Float4(1, 2, 3, 14));
 }