cuda.core.textures.TextureObject#

class cuda.core.textures.TextureObject(*args, **kwargs)#

A bindless texture handle for kernel-side sampled reads.

Wraps cuTexObjectCreate. The underlying memory resource (e.g. the CUDAArray referenced by the descriptor) is kept alive for the lifetime of this object to prevent dangling handles.

Construct via from_descriptor(). Passes to kernels as a 64-bit handle (via the handle property).

Methods

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

Release this object’s reference to the underlying CUtexObject.

Destruction (cuTexObjectDestroy) and release of the backing resource happen via the handle’s deleter when the last reference is dropped. Idempotent.

classmethod from_descriptor(cls, *, resource, texture_descriptor)#

Create a texture object from a resource + sampling descriptor.

Parameters:

Attributes

device#
handle#

The underlying CUtexObject as an integer (64-bit kernel arg).

resource#

The ResourceDescriptor this texture was built from.

texture_descriptor#

The TextureDescriptor this texture was built from.