kernelkit.kernel.copy_to_texture

kernelkit.kernel.copy_to_texture#

kernelkit.kernel.copy_to_texture(array: ndarray, texture_type: str = 'array', layered: bool = False) TextureObject#

Creates a single-channel 2D/3D texture object of type float from a CuPy array.

Parameters:
arraycupy.ndarray

Array to be used in the texture. Must be pitched when type is ‘pitch2d’.

texture_typestr, optional

Type of texture to be created. Can be ‘array’, ‘array2d’, or ‘pitch2d’. Defaults to ‘array’. An ‘array’ texture may be faster, but requires the array to be copied to a CUDA array first, which increases memory usage.

layeredbool, optional

Whether to create a layered texture. Defaults to False. Only valid for 3D texture.

Returns:
cupy.cuda.texture.TextureObject

Texture object.