public static CudaArray Allocate(int width, int height, CudaArrayFormat format, int numChannels) { CudaArray result = new CudaArray(); Descriptor desc = new Descriptor(); desc.Width = (UInt32)width; desc.Height = (UInt32)height; desc.Format = format; desc.NumChannels = (UInt32)numChannels; CudaUtil.Call(cuArrayCreate(out result.handle, ref desc)); return(result); }
public static int GetByteSize(CudaArrayFormat format) { switch (format) { case CudaArrayFormat.Int8: case CudaArrayFormat.UInt8: return(1); case CudaArrayFormat.Int16: case CudaArrayFormat.UInt16: case CudaArrayFormat.F16: return(2); case CudaArrayFormat.Int32: case CudaArrayFormat.UInt32: case CudaArrayFormat.F32: return(4); default: throw new NotSupportedException("Not supported Cuda-array format"); } }
public void SetFormat(CudaArrayFormat componentFormat, int numPackedComponents) { CudaUtil.Call(cuTexRefSetFormat(handle, (UInt32)componentFormat, (Int32)numPackedComponents)); }