How to add float[,] array to kernel?

Help
volkaster
2012-05-29
2012-12-21
  • volkaster
    volkaster
    2012-05-29

    i tried this

    float arrB = new float;
      IntPtr arrayPtr = Marshal.UnsafeAddrOfPinnedArrayElement(arrB, 0);
                    ComputeBuffer<float> b = new ComputeBuffer<float>(context, ComputeMemoryFlags.ReadOnly | ComputeMemoryFlags.CopyHostPointer, count1*count* sizeof(float), arrayPtr);

    but it doesn't work

    it errors at line

    Handle = CL10.CreateBuffer(context.Handle, flags, new IntPtr(Marshal.SizeOf(typeof(T)) * count), dataPtr, out error);

    with AccesViolationException

    I need your help,bro!