Exemplo n.º 1
0
        public void CreateBuffer()
        {
            CLAPI.Reinitialize();
            DebugHelper.ThrowOnAllExceptions = true;
            byte[] b = new byte[255];
            for (int i = 0; i < b.Length; i++)
            {
                b[i] = (byte)i;
            }

            MemoryBuffer buffer = CLAPI.CreateBuffer(b, MemoryFlag.CopyHostPointer | MemoryFlag.ReadWrite);

            Assert.True(buffer != null);
            Assert.True(buffer.Size == 255);
        }
Exemplo n.º 2
0
        public void ReadBuffer()
        {
            CLAPI.Reinitialize();
            DebugHelper.ThrowOnAllExceptions = true;
            float[] b = new float[255];
            for (int i = 0; i < b.Length; i++)
            {
                b[i] = i;
            }

            MemoryBuffer buffer = CLAPI.CreateBuffer(b, MemoryFlag.CopyHostPointer | MemoryFlag.ReadWrite);

            float[] c = CLAPI.ReadBuffer <float>(buffer, b.Length);


            Assert.True(CheckValues(c, b));
        }