Exemplo n.º 1
0
        /// <summary>
        /// Copy array to GPU memory.
        /// </summary>
        /// <param name="swapbuffer">Which buffer to set data in. [WRITE or READ]</param>
        /// <param name="dataArray">Array with data to copy.</param>
        public void SetData <T>(SWAPBUFFER swapbuffer, T[] dataArray)
        {
            Debug.Assert(dataArray.GetLength(0) == Count, "Error: Array not same length as partition.");
            ComputeBuffer buffer = swapbuffer == SWAPBUFFER.WRITE ? mBlock.mSwapBuffer.WriteBuffer : mBlock.mSwapBuffer.ReadBuffer;

            buffer.SetData(dataArray, 0, Offset, Count);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Copy array from GPU memory.
        /// Returns array with data from GPU.
        /// </summary>
        /// <param name="swapbuffer">Which buffer to get data from. [WRITE or READ]</param>
        public T[] GetData <T>(SWAPBUFFER swapbuffer)
        {
            T[]           dataArray = new T[Count];
            ComputeBuffer buffer    = swapbuffer == SWAPBUFFER.WRITE ? mBlock.mSwapBuffer.WriteBuffer : mBlock.mSwapBuffer.ReadBuffer;

            buffer.GetData(dataArray, 0, Offset, Count);
            return(dataArray);
        }