warp.Texture1D#
- class warp.Texture1D(*args, **kwargs)[source]#
1D texture class.
Experimental
The texture API is experimental and subject to change without a formal deprecation cycle. See
Texturefor details.This is a specialized version of
Texturewith dimensionality fixed to 1. Use this for explicit 1D texture creation and as a type hint in kernel parameters.Example:
import warp as wp import numpy as np data = np.random.rand(256, 4).astype(np.float32) tex = wp.Texture1D(data, device="cuda:0") @wp.kernel def sample_kernel(tex: wp.Texture1D, output: wp.array(dtype=float)): tid = wp.tid() output[tid] = wp.texture_sample(tex, 0.5, dtype=float)
- Parameters:
- __init__(
- data=None,
- width=0,
- num_channels=4,
- dtype=float32,
- filter_mode=1,
- address_mode=None,
- address_mode_u=None,
- normalized_coords=True,
- device=None,
- surface_access=False,
Methods
__init__([data, width, num_channels, dtype, ...])copy_from_array(src)Copy from a CUDA 1D Warp array into this texture's CUDA array.
copy_to_array(dst)Copy from this texture's CUDA array into a CUDA 1D Warp array.
Attributes
ADDRESS_BORDERReturn 0 for coordinates outside [0, 1].
ADDRESS_CLAMPClamp coordinates to [0, 1].
ADDRESS_MIRRORMirror coordinates at boundaries.
ADDRESS_WRAPWrap coordinates (tile the texture).
FILTER_LINEARBilinear/trilinear filtering.
FILTER_POINTNearest-neighbor (point) filtering.
address_mode_uAddress mode for U axis.
address_mode_vAddress mode for V axis.
address_mode_wAddress mode for W axis (3D only).
cuda_arrayCUDA array handle backing this texture.
cuda_surfaceCUDA surface object handle backing this texture.
cuda_textureCUDA texture object handle.
depthTexture depth in pixels (1 for 2D textures).
dtypeData type of the texture.
heightTexture height in pixels.
idDevice-independent texture identifier.
ndimTexture dimensionality (1, 2, or 3).
normalized_coordsWhether texture uses normalized coordinates.
num_channelsNumber of channels.
widthTexture width in pixels.