Layered textures are known in the graphics world as texture arrays, because they enable 1D or 2D textures to be arranged as arrays accessed by an integer index. The main advantage of layered textures over vanilla 2D or 3D textures is that they support larger extents within the slices. There is no performance advantage to using layered textures.
Layered textures are laid out in memory differently than 2D or 3D
textures, in such a way that 2D or 3D textures will not perform as well
if they use the layout optimized for layered textures. As a result, when
creating the CUDA array, you must specify cudaArrayLayered
to cudaMalloc3DArray() or specify CUDA_ARRAY3D_LAYERED to
cuArray3DCreate().
The simpleLayeredTexture sample in the SDK illustrates
how to use layered textures.
The 1D layered texture size limits may be queried by calling
cuDeviceGetAttribute() with
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH and
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS; or by
calling cudaGetDeviceProperties() and examining
cudaDeviceProp.maxTexture1DLayered.
The 2D layered texture size limits may be queried by calling
cuDeviceGetAttribute() with
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH, and
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT, or
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS`; or by calling
cudaGetDeviceProperties() and examining
cudaDeviceProp.maxTexture2DLayered.
The layered texture size limits may be queried by calling
cudaGetDeviceProperties() and examining
cudaDeviceProp.maxTexture2DLayered.