cuda.bindings._v2.driver.mipmapped_array_create#

cuda.bindings._v2.driver.mipmapped_array_create(
p_mipmapped_array_desc,
unsigned int num_mipmap_levels,
) → intptr_t#

Creates a CUDA mipmapped array.

Creates a CUDA mipmapped array according to the CUDA_ARRAY3D_DESCRIPTOR structure p_mipmapped_array_desc and returns a handle to the new CUDA mipmapped array in *p_handle. num_mipmap_levels specifies the number of mipmap levels to be allocated. This value is clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]. The CUDA_ARRAY3D_DESCRIPTOR is defined as:. **View CUDA Toolkit Documentation for a C++ code example**. where:.

  • 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:.

  • A 1D mipmapped array is allocated if Height and Depth extents are both zero.

  • A 2D mipmapped array is allocated if only Depth extent is zero.

  • A 3D mipmapped array is allocated if all three extents are non-zero.

  • A 1D layered CUDA mipmapped array is allocated if only Height is zero and the CUDA_ARRAY3D_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 CUDA_ARRAY3D_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 CUDA_ARRAY3D_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, CUDA_ARRAY3D_CUBEMAP and CUDA_ARRAY3D_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.

  • Format specifies the format of the elements; CUarray_format is defined as:.

  • **View CUDA Toolkit Documentation for a C++ code example**.

  • NumChannels specifies the number of packed components per CUDA array element; it may be 1, 2, or 4;.

  • Flags may be set to.

  • CUDA_ARRAY3D_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.

  • CUDA_ARRAY3D_SURFACE_LDST to enable surface references to be bound to individual mipmap levels of the CUDA mipmapped array. If this flag is not set, cuSurfRefSetArray will fail when attempting to bind a mipmap level of the CUDA mipmapped array to a surface reference.

  • CUDA_ARRAY3D_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.

  • CUDA_ARRAY3D_TEXTURE_GATHER to indicate that the CUDA mipmapped array will be used for texture gather. Texture gather can only be performed on 2D CUDA mipmapped arrays.

Width, Height and Depth must meet certain size requirements as listed in the following table. All values are specified in elements. Note that for brevity’s sake, the full name of the device attribute is not specified. For ex., TEXTURE1D_MIPMAPPED_WIDTH refers to the device attribute CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH. **View CUDA Toolkit Documentation for a table example**.

Parameters:
  • p_mipmapped_array_desc (intptr_t) – mipmapped array descriptor.

  • num_mipmap_levels (unsigned int) – Number of mipmap levels.

Returns:

Returned mipmapped array.

Return type:

intptr_t

See also

cuMipmappedArrayCreate