textureNumLayers
On this page

textureNumLayers

Function

Returns the number of layers of a texture_2d_array or a texture_cube_array as a u32.

The signature and the sentence under each name are the compiler's own text at commit 26de7be8.

Syntax

declare function textureNumLayers<E extends TextureElem = f32>(tex: texture_cube_array<E>): u32
declare function textureNumLayers(tex: texture_depth_cube_array): u32
declare function textureNumLayers(tex: texture_depth_2d_array): u32
declare function textureNumLayers<E extends TextureElem = f32>(tex: texture_2d_array<E>): u32
declare function textureNumLayers<F extends StorageFormat, A extends StorageAccess>(
tex: texture_storage_2d_array<F, A>,
): u32

A signature may name a type the ambient file declares for its own use. These are those declarations.

TextureElem
type TextureElem = f32 | i32 | u32
StorageFormat
type StorageFormat = 'rgba8unorm' | 'rgba8snorm' | 'rgba8uint' | 'rgba8sint' | 'rgba16uint' | 'rgba16sint' | 'rgba16float' | 'r32uint' | 'r32sint' | 'r32float' | 'rg32uint' | 'rg32sint' | 'rg32float' | 'rgba32uint' | 'rgba32sint' | 'rgba32float' | 'bgra8unorm'
StorageAccess
type StorageAccess = 'write' | 'read' | 'read_write'

Parameters

Return value

u32

Description

A texture with no layers is refused.

Targets

WGSL
textureNumLayers(a)
GLSL ES 3.00
uint(textureSize(a, 0).z)

Examples

See also

Edit this page Report a problem