Skip to content

TextureDescriptor

data class TextureDescriptor(
    val size: GPUExtent3D, 
    val format: GPUTextureFormat, 
    val usage: GPUTextureUsage, 
    val mipLevelCount: GPUIntegerCoordinate, 
    val sampleCount: GPUSize32, 
    val dimension: GPUTextureDimension = GPUTextureDimension.TwoD, 
    val viewFormats: List<GPUTextureFormat> = emptyList(), 
    val textureBindingViewDimension: GPUTextureViewDimension? = null, 
    val label: String = ""
) : GPUTextureDescriptor
Describes a GPUTexture's size, format, usage, and optional view formats.

Constructors

TextureDescriptor

constructor(
    size: GPUExtent3D, 
    format: GPUTextureFormat, 
    usage: GPUTextureUsage, 
    mipLevelCount: GPUIntegerCoordinate, 
    sampleCount: GPUSize32, 
    dimension: GPUTextureDimension = GPUTextureDimension.TwoD, 
    viewFormats: List<GPUTextureFormat> = emptyList(), 
    textureBindingViewDimension: GPUTextureViewDimension? = null, 
    label: String = ""
)

Properties

dimension

open override val dimension: GPUTextureDimension
Whether the texture is one-dimensional, an array of two-dimensional layers, or three-dimensional.

format

open override val format: GPUTextureFormat
The format of the texture. See [GPUTextureDescriptor.format in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-format).

label

open override val label: String

mipLevelCount

open override val mipLevelCount: GPUIntegerCoordinate
The number of mip levels the texture will contain. See [GPUTextureDescriptor.mipLevelCount in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-miplevelcount).

sampleCount

open override val sampleCount: GPUSize32
The sample count of the texture. A sampleCount > 1 indicates a multisampled texture.

size

open override val size: GPUExtent3D
The width, height, and depth or layer count of the texture.

textureBindingViewDimension

open override val textureBindingViewDimension: GPUTextureViewDimension?
On devices with "core-features-and-limits", this is ignored, and there is no such restriction.

usage

open override val usage: GPUTextureUsage
The allowed usages for the texture. See [GPUTextureDescriptor.usage in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-usage).

viewFormats

open override val viewFormats: List<GPUTextureFormat>
Specifies what view format values will be allowed when calling createView() on this texture (in addition to the texture’s actual format). Formats in this list must be texture view format compatible with the texture format.