---
title: "workgroupUniformLoad: GPU shader function examples"
description: "A uniform workgroup load surrounds a shared-memory read with barriers so the workgroup receives the same value."
url: https://typeshade.dev/reference/functions/workgroupUniformLoad/
language: en
---

# `workgroupUniformLoad`

Function

A uniform workgroup load surrounds a shared-memory read with barriers so the workgroup receives the same value.

## Compare examples

Compare a write followed by the collective read with separate workgroups. The latter do not share the location.

**Model assumptions**`A, B ∈ workgroup W; C ∈ workgroup V; W ≠ V`

**Example 1`W: write(value = 7) → workgroupUniformLoad(value)`**

**Result**

`W: [7, 7]`

**Example 2`W: write(value = 0) → workgroupUniformLoad(value)`**

**Result**

`W: [0, 0]`

**Example 3`W: value = 7; V: value = 3`**

**Result**

`W: [7, 7]; V: [3, 3]`

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 to distribute a value written cooperatively in workgroup memory.

## Inputs and limits

The argument must be workgroup memory. All invocations must participate in uniform control flow. Storage memory is not accepted; this compiler emits WebGPU only.

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

- [`workgroupBarrier`](https://typeshade.dev/reference/functions/workgroupBarrier/)
- [`storageBarrier`](https://typeshade.dev/reference/functions/storageBarrier/)
- [`textureBarrier`](https://typeshade.dev/reference/functions/textureBarrier/)

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

Reads one value out of workgroup memory with a barrier on each side, so every invocation of the workgroup gets the same one.

## Syntax

```ts
declare function workgroupUniformLoad<T>(w: T): T
```

## Parameters

- `w` `T`

## Return value

`T`

## Description

Takes a place in `workgroup<T>` memory, not storage, and returns its type. It cuts a phase on WebGL2 as a barrier does ([Rule 8.24](https://typeshade.dev/reference/rules/8-24/)), and it carries a barrier's placement rules: a compute entry or a function it calls, in uniform control flow.

## Targets

**WGSL**

`workgroupUniformLoad(&a)`

**GLSL ES 3.00**

`workgroupUniformLoad` is not supported yet in a GLSL ES 3.00 stage (Rule 10.5)

## Examples

- [`gallery/compute-sync/compute-sync.shade.ts`](https://typeshade.dev/guide/examples/compute-sync/)

## See also

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