---
title: "all: WGSL and GLSL examples, uses and input limits"
description: "All is true when every component of a boolean or a boolean vector is true. Use it for checking whether every value is valid."
url: https://typeshade.dev/reference/functions/all/
language: en
---

# `all`

Function

All is true when every component of a boolean or a boolean vector is true.

## Compare examples

The result is true only when every component is true. One false component makes it false.

**Example 1`all(vec2b(false, false))`**

`false` `false`

Components in this example

**Result**

`false`

**Example 2`all(vec2b(false, true))`**

`false` `true`

Components in this example

**Result**

`false`

**Example 3`all(vec2b(true, true))`**

`true` `true`

Components in this example

**Result**

`true`

The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

## When to use it

Use it for checking whether every value is valid.

## Inputs and limits

A per-component comparison creates a boolean vector; all reduces it to a single boolean.

For shader input rules and precision, consult [WGSL](https://www.w3.org/TR/WGSL/) and [GLSL ES 3.00](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf).

## Related functions

- [`any`](https://typeshade.dev/reference/functions/any/)
- [`select`](https://typeshade.dev/reference/functions/select/)

**WGSL**

`all(a)`

**GLSL ES 3.00**

`all(a)`

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

Whether every component of a vector of bools is true: `all(a === b)`.

## Syntax

```ts
declare function all(a0: bool): bool
declare function all<V extends vec2b | vec3b | vec4b>(a0: V): (bool)
declare function all(v: bool | BoolVec): bool
```

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

**`BoolVec`**

`type BoolVec = vec2b | vec3b | vec4b`

## Parameters

- `v` `bool``V``bool | BoolVec`

## Return value

`bool``(bool)`

## Description

A scalar bool passes through. Over an array, write `xs.every((x) => ...)`.

## Targets

**WGSL**

`all(a)`

**GLSL ES 3.00**

`all(a)`

## Examples

- [`gallery/bool-select/bool-select.shade.ts`](https://typeshade.dev/guide/examples/bool-select/)
- [`gallery/packing-bitcast/packing-bitcast.shade.ts`](https://typeshade.dev/guide/examples/packing-bitcast/)

## See also

- [Functions](https://typeshade.dev/reference/functions/)
- [Builtin table](https://typeshade.dev/guide/language/builtins/#maths)
