Texture
Methods
assignFromHandle
Wrap a GPUTexture this object does not own.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device the texture belongs to. | |
handle | Yes | The texture to wrap. | |
options | IWebGPUTextureCreateOptions | Yes | The extent and format of the given texture. |
create
Allocate the GPUTexture.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device to allocate on. | |
options | IWebGPUTextureCreateOptions | Yes | The extent, format and usage. |
createView
Create a view of this texture. A missing view dimension is derived from the texture dimension and depth.
| Argument | Type | Required | Description |
|---|---|---|---|
label | Yes | The WGSL name of the view. | |
options | GPUTextureViewDescriptor | No | (default: {}) |
destroy
Destroy the GPU texture, clear its handle and mark it as not ready.
extend
Method used to decorate a given object (publicAPI+model) with vtkWebGPUTexture characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IWebGPUTextureInitialValues | No | (default: {}) |
generateMipmaps
Regenerate the mipmaps of a texture with more than one mip level.
getDevice
Get the device the texture belongs to.
getDimension
Get the dimension the texture was allocated with.
getDimensionality
The number of extents larger than one texel.
getFormat
Get the format the texture was allocated with.
getHandle
Get the GPUTexture.
getLabel
Get the debug label of the texture.
getMipLevel
Get the highest allocated mip level.
getNumberOfComponents
The number of components a texel of this texture's format holds.
getReady
Whether image data has been uploaded into the texture.
getSampleCount
Get the number of samples per texel.
getScale
The factor a value read back from this texture must be multiplied by to recover the original source value. 1.0 for the half float formats and 255.0 for normalized byte formats, 65535.0 for 16 bit unorm formats, and 32767.0 for 16 bit snorm formats.
getUsage
Get the usage flags the texture was allocated with.
newInstance
Method used to create a new instance of vtkWebGPUTexture.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IWebGPUTextureInitialValues | No | for pre-setting some of its content |
resize
Reallocate the texture when the given extent differs from the current one.
| Argument | Type | Required | Description |
|---|---|---|---|
width | Yes | ||
height | Yes | ||
depth | Number | No | (default: 1) |
resizeToMatch
Reallocate the texture when its extent differs from the given texture's.
| Argument | Type | Required | Description |
|---|---|---|---|
tex | Yes | The texture to match. |
setDevice
Set the device the texture belongs to.
setLabel
Set the debug label of the texture.
writeImageData
Upload a full image into the texture, repacking and half float converting the data as the format requires, and regenerating the mipmaps of a 2d texture that has them.
| Argument | Type | Required | Description |
|---|---|---|---|
req | IWebGPUTextureImageRequest | Yes | The upload. |
writeSubImageData
Upload into a sub region of the texture.
| Argument | Type | Required | Description |
|---|---|---|---|
req | IWebGPUTextureSubImageRequest | Yes | The upload. |