cuda.core.texture.MipmappedArray#

class cuda.core.texture.MipmappedArray(*args, **kwargs)#

A mipmapped CUDA array for texture/surface access across levels.

Wraps CUmipmappedArray. Each mip level is a distinct, hardware-laid-out allocation accessible only via a TextureObject (or by retrieving the level’s OpaqueArray and binding it as a SurfaceObject). Destroying the MipmappedArray destroys all level arrays implicitly, so the OpaqueArray instances returned by get_level() are non-owning and hold a strong reference back to their parent.

Construct via cuda.core.Device.create_mipmapped_array().

Methods

__init__(*args, **kwargs)#
close(self)#

Release this object’s reference to the underlying CUmipmappedArray.

Destruction (cuMipmappedArrayDestroy) happens via the handle’s deleter when the last reference is dropped. A level OpaqueArray from get_level() holds its own reference to this mipmap’s storage, so it stays valid until both it and this object are released. Idempotent.

get_level(self, level)#

Return a non-owning OpaqueArray view of the given mip level.

Parameters:

level (int) – Mip level index in [0, num_levels).

Returns:

A non-owning OpaqueArray wrapping the level’s CUarray. The MipmappedArray is kept alive for the lifetime of the returned OpaqueArray; the underlying storage is released only when this MipmappedArray is destroyed.

Return type:

OpaqueArray

Attributes

device#

The Device this mipmap was allocated on.

format#

The element ArrayFormatType.

handle#

The underlying CUmipmappedArray as an integer.

is_surface_load_store#

True if this mipmap (and each of its levels) was created with CUDA_ARRAY3D_SURFACE_LDST and can back a SurfaceObject.

num_channels#

Channels per element (1, 2, or 4).

num_levels#

Number of mip levels.

shape#

Base-level (level 0) allocation shape, in elements.