pub unsafe extern "C" fn cuMipmappedArrayCreate(
pHandle: *mut CUmipmappedArray,
pMipmappedArrayDesc: *const CUDA_ARRAY3D_DESCRIPTOR,
numMipmapLevels: c_uint,
) -> CUresultExpand description
Creates a CUDA mipmapped array.
Creates a CUDA mipmapped array according to the CUDA_ARRAY3D_DESCRIPTOR structure pMipmappedArrayDesc and returns a handle to the new CUDA mipmapped array in *pHandle. numMipmapLevels 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:
typedef struct {
unsigned int Width;
unsigned int Height;
unsigned int Depth;
CUarray_format Format;
unsigned int NumChannels;
unsigned int Flags;
} CUDA_ARRAY3D_DESCRIPTOR;where:
-
Width,Height, andDepthare 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
HeightandDepthextents are both zero. - A 2D mipmapped array is allocated if only
Depthextent 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
Heightis zero and theCUDA_ARRAY3D_LAYEREDflag 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_LAYEREDflag 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_CUBEMAPflag is set.Widthmust be equal toHeight, andDepthmust 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 inCUarray_cubemap_face. - A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both,
CUDA_ARRAY3D_CUBEMAPandCUDA_ARRAY3D_LAYEREDflags are set.Widthmust be equal toHeight, andDepthmust 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.
- A 1D mipmapped array is allocated if
-
Formatspecifies the format of the elements;CUarray_formatis defined as:
typedef enum CUarray_format_enum {
CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
CU_AD_FORMAT_SIGNED_INT8 = 0x08,
CU_AD_FORMAT_SIGNED_INT16 = 0x09,
CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
CU_AD_FORMAT_HALF = 0x10,
CU_AD_FORMAT_FLOAT = 0x20,
CU_AD_FORMAT_NV12 = 0xb0,
CU_AD_FORMAT_UNORM_INT8X1 = 0xc0,
CU_AD_FORMAT_UNORM_INT8X2 = 0xc1,
CU_AD_FORMAT_UNORM_INT8X4 = 0xc2,
CU_AD_FORMAT_UNORM_INT16X1 = 0xc3,
CU_AD_FORMAT_UNORM_INT16X2 = 0xc4,
CU_AD_FORMAT_UNORM_INT16X4 = 0xc5,
CU_AD_FORMAT_SNORM_INT8X1 = 0xc6,
CU_AD_FORMAT_SNORM_INT8X2 = 0xc7,
CU_AD_FORMAT_SNORM_INT8X4 = 0xc8,
CU_AD_FORMAT_SNORM_INT16X1 = 0xc9,
CU_AD_FORMAT_SNORM_INT16X2 = 0xca,
CU_AD_FORMAT_SNORM_INT16X4 = 0xcb,
CU_AD_FORMAT_BC1_UNORM = 0x91,
CU_AD_FORMAT_BC1_UNORM_SRGB = 0x92,
CU_AD_FORMAT_BC2_UNORM = 0x93,
CU_AD_FORMAT_BC2_UNORM_SRGB = 0x94,
CU_AD_FORMAT_BC3_UNORM = 0x95,
CU_AD_FORMAT_BC3_UNORM_SRGB = 0x96,
CU_AD_FORMAT_BC4_UNORM = 0x97,
CU_AD_FORMAT_BC4_SNORM = 0x98,
CU_AD_FORMAT_BC5_UNORM = 0x99,
CU_AD_FORMAT_BC5_SNORM = 0x9a,
CU_AD_FORMAT_BC6H_UF16 = 0x9b,
CU_AD_FORMAT_BC6H_SF16 = 0x9c,
CU_AD_FORMAT_BC7_UNORM = 0x9d,
CU_AD_FORMAT_BC7_UNORM_SRGB = 0x9e,
CU_AD_FORMAT_P010 = 0x9f,
CU_AD_FORMAT_P016 = 0xa1,
CU_AD_FORMAT_NV16 = 0xa2,
CU_AD_FORMAT_P210 = 0xa3,
CU_AD_FORMAT_P216 = 0xa4,
CU_AD_FORMAT_YUY2 = 0xa5,
CU_AD_FORMAT_Y210 = 0xa6,
CU_AD_FORMAT_Y216 = 0xa7,
CU_AD_FORMAT_AYUV = 0xa8,
CU_AD_FORMAT_Y410 = 0xa9,
CU_AD_FORMAT_Y416 = 0xb1,
CU_AD_FORMAT_Y444_PLANAR8 = 0xb2,
CU_AD_FORMAT_Y444_PLANAR10 = 0xb3,
CU_AD_FORMAT_YUV444_8bit_SemiPlanar = 0xb4,
CU_AD_FORMAT_YUV444_16bit_SemiPlanar = 0xb5,
CU_AD_FORMAT_UNORM_INT_101010_2 = 0x50,
CU_AD_FORMAT_UINT8_PACKED_422 = 0x51,
CU_AD_FORMAT_UINT8_PACKED_444 = 0x52,
CU_AD_FORMAT_UINT8_SEMIPLANAR_420 = 0x53,
CU_AD_FORMAT_UINT16_SEMIPLANAR_420 = 0x54,
CU_AD_FORMAT_UINT8_SEMIPLANAR_422 = 0x55,
CU_AD_FORMAT_UINT16_SEMIPLANAR_422 = 0x56,
CU_AD_FORMAT_UINT8_SEMIPLANAR_444 = 0x57,
CU_AD_FORMAT_UINT16_SEMIPLANAR_444 = 0x58,
CU_AD_FORMAT_UINT8_PLANAR_420 = 0x59,
CU_AD_FORMAT_UINT16_PLANAR_420 = 0x5a,
CU_AD_FORMAT_UINT8_PLANAR_422 = 0x5b,
CU_AD_FORMAT_UINT16_PLANAR_422 = 0x5c,
CU_AD_FORMAT_UINT8_PLANAR_444 = 0x5d,
CU_AD_FORMAT_UINT16_PLANAR_444 = 0x5e,
} CUarray_format;-
NumChannelsspecifies the number of packed components per CUDA array element; it may be 1, 2, or 4; -
Flagsmay be set toCUDA_ARRAY3D_LAYEREDto enable creation of layered CUDA mipmapped arrays. If this flag is set,Depthspecifies the number of layers, not the depth of a 3D array.CUDA_ARRAY3D_SURFACE_LDSTto enable surface references to be bound to individual mipmap levels of the CUDA mipmapped array. If this flag is not set,cuSurfRefSetArraywill fail when attempting to bind a mipmap level of the CUDA mipmapped array to a surface reference.
CUDA_ARRAY3D_CUBEMAPto enable creation of mipmapped cubemaps. If this flag is set,Widthmust be equal toHeight, andDepthmust be six. If theCUDA_ARRAY3D_LAYEREDflag is also set, thenDepthmust be a multiple of six.CUDA_ARRAY3D_TEXTURE_GATHERto 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 CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH.
| CUDA array type | Valid extents that must always be met {(width range in elements), (height range), (depth range)} | Valid extents with CUDA_ARRAY3D_SURFACE_LDST set {(width range in elements), (height range), (depth range)} |
| 1D | { (1,TEXTURE1D_MIPMAPPED_WIDTH), 0, 0 } | { (1,SURFACE1D_WIDTH), 0, 0 } |
| 2D | { (1,TEXTURE2D_MIPMAPPED_WIDTH), (1,TEXTURE2D_MIPMAPPED_HEIGHT), 0 } | { (1,SURFACE2D_WIDTH), (1,SURFACE2D_HEIGHT), 0 } |
| 3D | { (1,TEXTURE3D_WIDTH), (1,TEXTURE3D_HEIGHT), (1,TEXTURE3D_DEPTH) } OR { (1,TEXTURE3D_WIDTH_ALTERNATE), (1,TEXTURE3D_HEIGHT_ALTERNATE), (1,TEXTURE3D_DEPTH_ALTERNATE) } | { (1,SURFACE3D_WIDTH), (1,SURFACE3D_HEIGHT), (1,SURFACE3D_DEPTH) } |
| 1D Layered | { (1,TEXTURE1D_LAYERED_WIDTH), 0, (1,TEXTURE1D_LAYERED_LAYERS) } | { (1,SURFACE1D_LAYERED_WIDTH), 0, (1,SURFACE1D_LAYERED_LAYERS) } |
| 2D Layered | { (1,TEXTURE2D_LAYERED_WIDTH), (1,TEXTURE2D_LAYERED_HEIGHT), (1,TEXTURE2D_LAYERED_LAYERS) } | { (1,SURFACE2D_LAYERED_WIDTH), (1,SURFACE2D_LAYERED_HEIGHT), (1,SURFACE2D_LAYERED_LAYERS) } |
| Cubemap | { (1,TEXTURECUBEMAP_WIDTH), (1,TEXTURECUBEMAP_WIDTH), 6 } | { (1,SURFACECUBEMAP_WIDTH), (1,SURFACECUBEMAP_WIDTH), 6 } |
| Cubemap Layered | { (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_WIDTH), (1,TEXTURECUBEMAP_LAYERED_LAYERS) } | { (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_WIDTH), (1,SURFACECUBEMAP_LAYERED_LAYERS) } |
Note that this function may also return error codes from previous, asynchronous launches.
§Parameters
pHandle: Returned mipmapped array.pMipmappedArrayDesc: mipmapped array descriptor.numMipmapLevels: Number of mipmap levels.
§Return value
CUresult::CUDA_SUCCESSCUresult::CUDA_ERROR_DEINITIALIZEDCUresult::CUDA_ERROR_NOT_INITIALIZEDCUresult::CUDA_ERROR_INVALID_CONTEXTCUresult::CUDA_ERROR_INVALID_VALUECUresult::CUDA_ERROR_OUT_OF_MEMORYCUresult::CUDA_ERROR_UNKNOWN
See also: cuMipmappedArrayDestroy, cuMipmappedArrayGetLevel, cuArrayCreate, cudaMallocMipmappedArray.