Skip to content

GPUTextureSwizzle

data class GPUTextureSwizzle(
    val red: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Red, 
    val green: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Green, 
    val blue: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Blue, 
    val alpha: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Alpha
)
Maps each output channel to a component of the texture view. The properties correspond to the red, green, blue, and alpha output channels, in that order. Each channel can select red, green, blue, alpha, constant zero, or constant one; selections may repeat. The default value is the identity mapping `rgba`. A non-identity mapping requires the WebGPU `texture-component-swizzle` feature on the device used to create the view. WebGPU requires the identity mapping when a view is used as a storage texture or as a render attachment. Use [`toWebGpuString`](index.md#towebgpustring) to convert this value to the four-character `DOMString` expected by the Web binding. For example, the mapping `b01r` selects blue, zero, one, and red for the output channels.

Constructors

GPUTextureSwizzle

constructor(
    red: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Red, 
    green: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Green, 
    blue: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Blue, 
    alpha: GPUTextureSwizzleSource = GPUTextureSwizzleSource.Alpha
)

Properties

alpha

blue

green

red

Functions

toWebGpuString

Returns the four-character `DOMString` expected by WebGPU.