arrayLength
On this page

arrayLength

Function

Returns the number of elements of a runtime-sized storage array as a u32, read from the buffer the host bound; xs.length on such an array reads the same thing.

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

Syntax

declare function arrayLength<T>(xs: array<T>): u32

Parameters

Return value

u32

Description

The argument must be the storage binding itself or a trailing array field of one. Compiles to arrayLength(&xs) on WGSL; GLSL ES 3.00 has no storage buffers, so a module using it emits WGSL alone.

Targets

WGSL
arrayLength(&a)
GLSL ES 3.00
arrayLength has no GLSL ES 3.00 spelling (no storage buffers, no runtime-sized arrays)

Examples

See also

Edit this page Report a problem