Library/ManagedCuda/CudaSurface.cs
/// <summary>
/// Create a new CudaArray3D and bind it to a surface reference.
/// </summary>
/// <param name="kernel"></param>
/// <param name="surfName"></param>
/// <param name="flags"></param>
/// <param name="format"></param>
/// <param name="width">In elements</param>
/// <param name="height">In elements</param>
/// <param name="depth">In elements</param>
/// <param name="numChannels"></param>
/// <param name="arrayFlags"></param>
Create a new CudaArray3D and bind it to a surface reference.
Create a new CudaArray3D and bind it to a surface reference .
public static CudaArray3D BindArray(CudaKernel kernel, string surfName, CUSurfRefSetFlags flags, CUArrayFormat format, SizeT width, SizeT height, SizeT depth, CudaArray3DNumChannels numChannels, CUDAArray3DFlags arrayFlags)
		{
			CUsurfref surfref = new CUsurfref();
			CUResult res = DriverAPINativeMethods.ModuleManagement.cuModuleGetSurfRef(ref surfref, kernel.CUModule, surfName);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Surface name: {3}", DateTime.Now, "cuModuleGetSurfRef", res, surfName));
			if (res != CUResult.Success) throw new CudaException(res);
			CudaArray3D array = new CudaArray3D(format, width, height, depth, numChannels, arrayFlags);
			res = DriverAPINativeMethods.SurfaceReferenceManagement.cuSurfRefSetArray(surfref, array.CUArray, flags);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuSurfRefSetArray", res));
			if (res != CUResult.Success) throw new CudaException(res);
			return array;
		}
public static CudaArray3D BindArray ( CudaKernel kernel , string surfName , CUSurfRefSetFlags flags , CUArrayFormat format , SizeT width , SizeT height , SizeT depth , CudaArray3DNumChannels numChannels , CUDAArray3DFlags arrayFlags ) { CUsurfref surfref = new CUsurfref ( ) ; CUResult res = DriverAPINativeMethods . ModuleManagement . cuModuleGetSurfRef ( ref surfref , kernel . CUModule , surfName ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res , surfName ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; CudaArray3D array = new CudaArray3D ( format , width , height , depth , numChannels , arrayFlags ) ; res = DriverAPINativeMethods . SurfaceReferenceManagement . cuSurfRefSetArray ( surfref , array . CUArray , flags ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; return array ; }
Create a new CudaArray3D and bind it to a surface reference.
Create a new CudaArray3D and bind it to a surface reference .
kernel
CudaKernel
None
surfName
string
None
flags
CUSurfRefSetFlags
None
format
CUArrayFormat
None
width
SizeT
None
height
SizeT
None
depth
SizeT
None
numChannels
CudaArray3DNumChannels
None
arrayFlags
CUDAArray3DFlags
None