示例#1
0
 public static void UpdateBufferForStruct <T>(T UpdatedValue, ComputeBuffer buffer)
 {
     if (buffer != null &&
         buffer.count == 1 &&
         buffer.stride == SizeInBytes <T>())
     {
         var list = new List <T>()
         {
             UpdatedValue
         };
         buffer.SetData(list);
     }
     else
     {
         Logging.Warning <ComputeBuffer>("Unable to update ComputeBuffer with updated value of type {0}", TypeUtil.NameOf <T>());
     }
 }
示例#2
0
 private static void ExceptionIfInvalidArray <T>(T[] values)
 {
     if (values == null)
     {
         throw new ArgumentException(string.Format("Invalid Argument: NULL of type '{0}' Arrary given for ComputeBuffer", TypeUtil.NameOf <T>()));
     }
     if (values.Length == 0)
     {
         throw new ArgumentException(
                   string.Format("Invalid Argument: Type '{0}' Array of 0 length given for ComputeBuffer", TypeUtil.NameOf <T>())
                   );
     }
 }