Example #1
0
 public void SetData(Vertex[] vertices, int offset, int start, int length)
 {
     if (length <= device.BatchSize)
     {
         // If we are able to use a buffer without allocation, post a message to avoid blocking.
         var buffer = device.GetVertices(length);
         Array.Copy(vertices, offset, buffer, 0, length);
         device.Post(setData2, (buffer, 0, start, length));
     }
     else
     {
         // If the length is too large for a buffer, send a message and block to avoid allocations.
         device.Send(setData3, (vertices, offset, start, length));
     }
 }
 public byte[] GetData()
 {
     return(device.Send(getData));
 }
 public void SetData(IntPtr data, int start, int length)
 {
     // We can't return until we are finished with the data, so we must Send here.
     device.Send(setData2, Tuple.Create(data, start, length));
 }