ArgumentException: ComputeBuffer.SetData() : Data size (136 bytes) is not integer multiple of Compute Buffer stride (48 bytes).
VecMatPair[] input = new VecMatPair[17];
for (int i = 0; i < input.Length; i++)
{
VecMatPair a = new VecMatPair();
a.point = 0.5f;
a.matrix = 1.6f;
input[i] = a;
}
int kernel = shader.FindKernel("Multiply");//寻找内核multi并输出它的编号
VecMatPair[] output = new VecMatPair[6];
问题在于可以输入17组数据和需要输出6组数组,17不是6的倍数。改成18或者其他6的倍数即可。
创建一个结构体,两个float变量,8个字节。17*8=136。