/// <summary> /// Creates a surface object. <c>ResDesc</c> describes /// the data to perform surface load/stores on. <c>ResDesc.resType</c> must be /// <see cref="CUResourceType.Array"/> and <c>ResDesc.hArray</c> /// must be set to a valid CUDA array handle. /// </summary> /// <param name="array">CudaArray2D</param> public CudaSurfObject(CudaArray2D array) { _resDesc = new CudaResourceDesc(array); _surfObject = new CUsurfObject(); res = DriverAPINativeMethods.SurfaceObjects.cuSurfObjectCreate(ref _surfObject, ref _resDesc); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuSurfObjectCreate", res)); if (res != CUResult.Success) throw new CudaException(res); }
/// <summary> /// Creates a texture object and returns it in pTexObject. pResDesc describes the data to texture from. pTexDesc /// describes how the data should be sampled. /// </summary> /// <param name="resDesc">CudaResourceDesc</param> /// <param name="texDesc">CudaTextureDescriptor</param> public CudaTexObject(CudaResourceDesc resDesc, CudaTextureDescriptor texDesc) { _resDesc = resDesc; _texDesc = texDesc; _texObject = new CUtexObject(); res = DriverAPINativeMethods.TextureObjects.cuTexObjectCreate(ref _texObject, ref _resDesc, ref _texDesc, IntPtr.Zero); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexObjectCreate", res)); if (res != CUResult.Success) throw new CudaException(res); }
public static extern CUResult cuSurfObjectGetResourceDesc(ref CudaResourceDesc pResDesc, CUsurfObject surfObject);
public static extern CUResult cuSurfObjectCreate(ref CUsurfObject pSurfObject, ref CudaResourceDesc pResDesc);
public static extern CUResult cuTexObjectGetResourceDesc(ref CudaResourceDesc pResDesc, CUtexObject texObject);
public static extern CUResult cuTexObjectCreate(ref CUtexObject pTexObject, ref CudaResourceDesc pResDesc, ref CudaTextureDescriptor pTexDesc, IntPtr pResViewDesc);