warp.Texture3D#
- class warp.Texture3D(*args, **kwargs)[source]#
3D 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 3. Use this for explicit 3D texture creation and as a type hint in kernel parameters.Example:
import warp as wp import numpy as np data = np.random.rand(64, 64, 64).astype(np.float32) tex = wp.Texture3D(data, device="cuda:0") @wp.kernel def sample_kernel(tex: wp.Texture3D, output: wp.array(dtype=float)): tid = wp.tid() output[tid] = wp.texture_sample(tex, wp.vec3f(0.5, 0.5, 0.5), dtype=float)
- Parameters:
data (numpy.ndarray | array | None)
width (int)
height (int)
depth (int)
num_channels (int)
filter_mode (TextureFilterMode)
address_mode (TextureAddressMode | tuple[TextureAddressMode, ...])
address_mode_u (TextureAddressMode | None)
address_mode_v (TextureAddressMode | None)
address_mode_w (TextureAddressMode | None)
normalized_coords (bool)
device (DeviceLike)
surface_access (bool)
cuda_array (int)
- __init__(
- data=None,
- width=0,
- height=0,
- depth=0,
- num_channels=0,
- dtype=None,
- filter_mode=TextureFilterMode.LINEAR,
- address_mode=TextureAddressMode.CLAMP,
- address_mode_u=None,
- address_mode_v=None,
- address_mode_w=None,
- normalized_coords=True,
- device=None,
- surface_access=False,
- cuda_array=0,
- Parameters:
data (numpy.ndarray | array | None)
width (int)
height (int)
depth (int)
num_channels (int)
filter_mode (TextureFilterMode)
address_mode (TextureAddressMode | tuple[TextureAddressMode, ...])
address_mode_u (TextureAddressMode | None)
address_mode_v (TextureAddressMode | None)
address_mode_w (TextureAddressMode | None)
normalized_coords (bool)
device (DeviceLike)
surface_access (bool)
cuda_array (int)
Methods
__init__([data, width, height, depth, ...])copy_from(src)Copy texture data from a source.
copy_from_array(src)Copy from a CUDA Warp array into this texture's CUDA array.
copy_to(dst)Copy texture data to a destination.
copy_to_array(dst)Copy from this texture's CUDA array into a CUDA Warp array.
Attributes
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.