
Cloo: ComputeImage3D
Posted Tuesday, 22 June, 2010 - 12:56 by LikeKT inint width=32 int height=32 int depth=32 byte[] volumeData = new byte[width*height*depth]; // IntPtr pVolumeData = Marshal.AllocHGlobal( width*height*depth); Marshal.Copy(volumeData , 0, pVolumeData, width*height*depth); ComputeImageFormat volume_format = new ComputeImageFormat( ComputeImageChannelOrder.R, ComputeImageChannelType.UnsignedInt8); ComputeImage3D volumeArray = new ComputeImage3D(cxGPUContext, ComputeMemoryFlags.ReadOnly | ComputeMemoryFlags.CopyHostPointer, volume_format, width, height, depth, (long)(image_row_pitch), (long)(image_slice_pitch), pVolumeData);
Questions:
a) how do I set the value for
image_row_pitch = width*size of element in bytes
image_slice_pitch = width*height*size of element in bytes
b) what should be the "size of element in bytes" in this case.
c) is this "size of element in bytes" depends on the " ComputeImageChannelType.UnsignedInt8"
d) If the above code work, can I set the argument this way?
kernel.SetMemoryArgument(0, volumeArray );


Comments
Re: Cloo: ComputeImage3D (solved)
I checked with the developers and it seems that modify the cloo source code and now it works.
Re: Cloo: ComputeImage3D
a) Leave them zero. OpenCL will compute "the pitches" by itself.
b & c) The size of element in bytes is the number of channels * the size of the channel. In your case one channel (ComputeImageChannelOrder.R) * size of UnsignedInt8 = 1 byte.
d) Yes.
Thanks a lot for catching this! Fix committed to git repository.