Exemple #1
0
			public static extern CUResult cuTexRefGetMipmappedArray(ref CUmipmappedArray phMipmappedArray, CUtexref hTexRef);
Exemple #2
0
			public static extern CUResult cuGraphicsResourceGetMappedMipmappedArray(ref CUmipmappedArray pMipmappedArray, CUgraphicsResource resource);
Exemple #3
0
			public static extern CUResult cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray);
Exemple #4
0
			public static extern CUResult cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, CUTexRefSetArrayFlags Flags);
Exemple #5
0
			public static extern CUResult cuMipmappedArrayGetLevel(ref CUarray pLevelArray, CUmipmappedArray hMipmappedArray, uint level);
Exemple #6
0
			public static extern CUResult cuMipmappedArrayCreate(ref CUmipmappedArray pHandle, ref CUDAArray3DDescriptor pMipmappedArrayDesc, uint numMipmapLevels);
		/// <summary>
		/// Creates a CUDA mipmapped array according to <c>descriptor</c>. <para/>
		/// Width, Height, and Depth are the width, height, and depth of the CUDA array (in elements); the following
		/// types of CUDA arrays can be allocated:<para/>
		/// – A 1D mipmapped array is allocated if Height and Depth extents are both zero.<para/>
		/// – A 2D mipmapped array is allocated if only Depth extent is zero.<para/>
		/// – A 3D mipmapped array is allocated if all three extents are non-zero.<para/>
		/// – A 1D layered CUDA mipmapped array is allocated if only Height is zero and the <see cref="CUDAArray3DFlags.Layered"/> 
		///   flag is set. Each layer is a 1D array. The number of layers is determined by the depth extent.<para/>
		/// – A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and the <see cref="CUDAArray3DFlags.Layered"/> 
		///   flag is set. Each layer is a 2D array. The number of layers is determined by the depth extent.<para/>
		/// – A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the <see cref="CUDAArray3DFlags.Cubemap"/>
		///   flag is set. Width must be equal to Height, and Depth must be six. A
		///   cubemap is a special type of 2D layered CUDA array, where the six layers represent the six faces of a
		///   cube. The order of the six layers in memory is the same as that listed in CUarray_cubemap_face.<para/>
		/// – A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both,
		///   <see cref="CUDAArray3DFlags.Cubemap"/> and <see cref="CUDAArray3DFlags.Layered"/> flags are set. Width must be equal
		///   to Height, and Depth must be a multiple of six. A cubemap layered CUDA array is a special type of
		///   2D layered CUDA array that consists of a collection of cubemaps. The first six layers represent the first
		///   cubemap, the next six layers form the second cubemap, and so on.<para/>
		/// Flags may be set to:<para/>
		/// – <see cref="CUDAArray3DFlags.Layered"/> to enable creation of layered CUDA mipmapped arrays. If this flag is set,
		///   Depth specifies the number of layers, not the depth of a 3D array.<para/>
		/// – <see cref="CUDAArray3DFlags.Cubemap"/> to enable creation of mipmapped cubemaps. If this flag is set, Width
		///   must be equal to Height, and Depth must be six. If the CUDA_ARRAY3D_LAYERED flag is also set,
		///   then Depth must be a multiple of six.<para/>
		/// – <see cref="CUDAArray3DFlags.TextureGather"/> to indicate that the CUDA mipmapped array will be used for
		///   texture gather. Texture gather can only be performed on 2D CUDA mipmapped arrays.
		/// </summary>
		/// <param name="descriptor">mipmapped array descriptor</param>
		/// <param name="numMipmapLevels">Number of mipmap levels. This value is clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]</param>
		public CudaMipmappedArray(CUDAArray3DDescriptor descriptor, uint numMipmapLevels)
		{
			_mipmappedArray = new CUmipmappedArray();
			_arrayDescriptor = descriptor;

			res = DriverAPINativeMethods.ArrayManagement.cuMipmappedArrayCreate(ref _mipmappedArray, ref _arrayDescriptor, numMipmapLevels);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMipmappedArrayCreate", res));
            if (res != CUResult.Success) throw new CudaException(res);
            _isOwner = true;        
		}
		/// <summary>
		/// Creates a CUDA mipmapped array from an existing mipmap array handle.
		/// </summary>
		/// <param name="handle">handle to wrap</param>
		/// <param name="format">Array format of the wrapped array. Cannot be gathered through CUDA API.</param>
		/// <param name="numChannels">Number of channels of wrapped array.</param>
		public CudaMipmappedArray(CUmipmappedArray handle, CUArrayFormat format, CudaMipmappedArrayNumChannels numChannels)
		{
			_mipmappedArray = handle;
			_arrayDescriptor = new CUDAArray3DDescriptor();
			_arrayDescriptor.Format = format;
			_arrayDescriptor.NumChannels = (uint)numChannels;
			_isOwner = false;
		}
		/// <summary>
		/// Creates a CUDA mipmapped array according to <c>descriptor</c>. <para/>
		/// Width, Height, and Depth are the width, height, and depth of the CUDA array (in elements); the following
		/// types of CUDA arrays can be allocated:<para/>
		/// – A 1D mipmapped array is allocated if Height and Depth extents are both zero.<para/>
		/// – A 2D mipmapped array is allocated if only Depth extent is zero.<para/>
		/// – A 3D mipmapped array is allocated if all three extents are non-zero.<para/>
		/// – A 1D layered CUDA mipmapped array is allocated if only Height is zero and the <see cref="CUDAArray3DFlags.Layered"/> 
		///   flag is set. Each layer is a 1D array. The number of layers is determined by the depth extent.
		/// – A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and the <see cref="CUDAArray3DFlags.Layered"/> 
		///   flag is set. Each layer is a 2D array. The number of layers is determined by the depth extent.
		/// – A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the <see cref="CUDAArray3DFlags.Cubemap"/>
		///   flag is set. Width must be equal to Height, and Depth must be six. A
		///   cubemap is a special type of 2D layered CUDA array, where the six layers represent the six faces of a
		///   cube. The order of the six layers in memory is the same as that listed in CUarray_cubemap_face.
		/// – A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both,
		///   <see cref="CUDAArray3DFlags.Cubemap"/> and <see cref="CUDAArray3DFlags.Layered"/> flags are set. Width must be equal
		///   to Height, and Depth must be a multiple of six. A cubemap layered CUDA array is a special type of
		///   2D layered CUDA array that consists of a collection of cubemaps. The first six layers represent the first
		///   cubemap, the next six layers form the second cubemap, and so on.
		/// </summary>
		/// <param name="format">Array format</param>
		/// <param name="width">Array width. See general description.</param>
		/// <param name="height">Array height. See general description.</param>
		/// <param name="depth">Array depth or layer count. See general description.</param>
		/// <param name="numChannels">number of channels</param>
		/// <param name="flags">Flags may be set to:<para/>
		/// – <see cref="CUDAArray3DFlags.Layered"/> to enable creation of layered CUDA mipmapped arrays. If this flag is set,
		///   Depth specifies the number of layers, not the depth of a 3D array.<para/>
		/// – <see cref="CUDAArray3DFlags.Cubemap"/> to enable creation of mipmapped cubemaps. If this flag is set, Width
		///   must be equal to Height, and Depth must be six. If the CUDA_ARRAY3D_LAYERED flag is also set,
		///   then Depth must be a multiple of six.<para/>
		/// – <see cref="CUDAArray3DFlags.TextureGather"/> to indicate that the CUDA mipmapped array will be used for
		///   texture gather. Texture gather can only be performed on 2D CUDA mipmapped arrays.</param>
		/// <param name="numMipmapLevels">Number of mipmap levels. This value is clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]</param>
		public CudaMipmappedArray(CUArrayFormat format, SizeT width, SizeT height, SizeT depth, CudaMipmappedArrayNumChannels numChannels, CUDAArray3DFlags flags, uint numMipmapLevels)
		{
			_mipmappedArray = new CUmipmappedArray();
			_arrayDescriptor = new CUDAArray3DDescriptor();
			_arrayDescriptor.Width = width;
			_arrayDescriptor.Height = height;
			_arrayDescriptor.Depth = depth;
			_arrayDescriptor.NumChannels = (uint)numChannels;
			_arrayDescriptor.Flags = flags;
			_arrayDescriptor.Format = format;


			res = DriverAPINativeMethods.ArrayManagement.cuMipmappedArrayCreate(ref _mipmappedArray, ref _arrayDescriptor, numMipmapLevels);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMipmappedArrayCreate", res));
			if (res != CUResult.Success) throw new CudaException(res);
			_isOwner = true;
		}