---
title: "Types, the TypeShade language reference for shaders"
description: "The 67 types a `\"use typeshade\"` file declares a value with: the scalars, the vectors, every matrix, the textures and samplers, and the memory the GPU holds."
url: https://typeshade.dev/reference/types/
language: en
---

# Types

67 names

The scalar, vector, matrix and memory types a declaration names.

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

**[`f32`](https://typeshade.dev/reference/types/f32/)**

32-bit floating-point value.

**[`f64`](https://typeshade.dev/reference/types/f64/)**

64-bit floating-point value, emulated in software on both GPU targets.

**[`i32`](https://typeshade.dev/reference/types/i32/)**

32-bit signed integer value.

**[`u32`](https://typeshade.dev/reference/types/u32/)**

32-bit unsigned integer value.

**[`bool`](https://typeshade.dev/reference/types/bool/)**

Boolean value.

**[`workgroup`](https://typeshade.dev/reference/types/workgroup/)**

A module variable one workgroup shares, `let tile: workgroup<array<f32, 64>>`: zero at the start of each workgroup, read and written by every invocation of the workgroup, and a compute entry's alone.

**[`atomic`](https://typeshade.dev/reference/types/atomic/)**

An `atomic<u32>` or `atomic<i32>`: an integer location in a read-write storage binding that many invocations update at once through `atomicAdd`, `atomicLoad` and the other atomic builtins.

**[`vec2`](https://typeshade.dev/reference/types/vec2/)**

A two-component vector of `f32`.

**[`vec3`](https://typeshade.dev/reference/types/vec3/)**

A three-component vector of `f32`.

**[`vec4`](https://typeshade.dev/reference/types/vec4/)**

A four-component vector of `f32`.

**[`vec2f`](https://typeshade.dev/reference/types/vec2f/)**

A two-component vector of `f32`, same type as `vec2`.

**[`vec3f`](https://typeshade.dev/reference/types/vec3f/)**

A three-component vector of `f32`, same type as `vec3`.

**[`vec4f`](https://typeshade.dev/reference/types/vec4f/)**

A four-component vector of `f32`, same type as `vec4`.

**[`vec2i`](https://typeshade.dev/reference/types/vec2i/)**

A two-component vector of `i32`.

**[`vec3i`](https://typeshade.dev/reference/types/vec3i/)**

A three-component vector of `i32`.

**[`vec4i`](https://typeshade.dev/reference/types/vec4i/)**

A four-component vector of `i32`.

**[`vec2u`](https://typeshade.dev/reference/types/vec2u/)**

A two-component vector of `u32`.

**[`vec3u`](https://typeshade.dev/reference/types/vec3u/)**

A three-component vector of `u32`.

**[`vec4u`](https://typeshade.dev/reference/types/vec4u/)**

A four-component vector of `u32`.

**[`vec2b`](https://typeshade.dev/reference/types/vec2b/)**

A two-component vector of `bool`: what comparing two `vec2` values yields, componentwise.

**[`vec3b`](https://typeshade.dev/reference/types/vec3b/)**

A three-component vector of `bool`: what comparing two `vec3` values yields, componentwise.

**[`vec4b`](https://typeshade.dev/reference/types/vec4b/)**

A four-component vector of `bool`: what comparing two `vec4` values yields, componentwise.

**[`vec2d`](https://typeshade.dev/reference/types/vec2d/)**

A two-component vector of `f64`, same type as `vec2f64`.

**[`vec3d`](https://typeshade.dev/reference/types/vec3d/)**

A three-component vector of `f64`, same type as `vec3f64`.

**[`vec4d`](https://typeshade.dev/reference/types/vec4d/)**

A four-component vector of `f64`, same type as `vec4f64`.

**[`vec2f64`](https://typeshade.dev/reference/types/vec2f64/)**

A two-component vector of `f64`.

**[`vec3f64`](https://typeshade.dev/reference/types/vec3f64/)**

A three-component vector of `f64`.

**[`vec4f64`](https://typeshade.dev/reference/types/vec4f64/)**

A four-component vector of `f64`.

**[`mat2x2`](https://typeshade.dev/reference/types/mat2x2/)**

2x2 matrix of `f32` (or `f64` as `mat2x2<f64>`), column-major.

**[`mat2`](https://typeshade.dev/reference/types/mat2/)**

2x2 matrix of `f32`, column-major, same type as `mat2x2`.

**[`mat2x3`](https://typeshade.dev/reference/types/mat2x3/)**

2x3 matrix of `f32`, column-major: 2 columns of `vec3`.

**[`mat2x4`](https://typeshade.dev/reference/types/mat2x4/)**

2x4 matrix of `f32`, column-major: 2 columns of `vec4`.

**[`mat3x2`](https://typeshade.dev/reference/types/mat3x2/)**

3x2 matrix of `f32`, column-major: 3 columns of `vec2`.

**[`mat3x3`](https://typeshade.dev/reference/types/mat3x3/)**

3x3 matrix of `f32` (or `f64` as `mat3x3<f64>`), column-major.

**[`mat3`](https://typeshade.dev/reference/types/mat3/)**

3x3 matrix of `f32`, column-major, same type as `mat3x3`.

**[`mat3x4`](https://typeshade.dev/reference/types/mat3x4/)**

3x4 matrix of `f32`, column-major: 3 columns of `vec4`.

**[`mat4x2`](https://typeshade.dev/reference/types/mat4x2/)**

4x2 matrix of `f32`, column-major: 4 columns of `vec2`.

**[`mat4x3`](https://typeshade.dev/reference/types/mat4x3/)**

4x3 matrix of `f32`, column-major: 4 columns of `vec3`.

**[`mat4x4`](https://typeshade.dev/reference/types/mat4x4/)**

4x4 matrix of `f32` (or `f64` as `mat4x4<f64>`), column-major.

**[`mat4`](https://typeshade.dev/reference/types/mat4/)**

4x4 matrix of `f32`, column-major, same type as `mat4x4`.

**[`mat2x2f`](https://typeshade.dev/reference/types/mat2x2f/)**

2x2 matrix of `f32`, column-major, same type as `mat2x2`: WGSL's predeclared alias.

**[`mat2x3f`](https://typeshade.dev/reference/types/mat2x3f/)**

2x3 matrix of `f32`, column-major, same type as `mat2x3`: WGSL's predeclared alias.

**[`mat2x4f`](https://typeshade.dev/reference/types/mat2x4f/)**

2x4 matrix of `f32`, column-major, same type as `mat2x4`: WGSL's predeclared alias.

**[`mat3x2f`](https://typeshade.dev/reference/types/mat3x2f/)**

3x2 matrix of `f32`, column-major, same type as `mat3x2`: WGSL's predeclared alias.

**[`mat3x3f`](https://typeshade.dev/reference/types/mat3x3f/)**

3x3 matrix of `f32`, column-major, same type as `mat3x3`: WGSL's predeclared alias.

**[`mat3x4f`](https://typeshade.dev/reference/types/mat3x4f/)**

3x4 matrix of `f32`, column-major, same type as `mat3x4`: WGSL's predeclared alias.

**[`mat4x2f`](https://typeshade.dev/reference/types/mat4x2f/)**

4x2 matrix of `f32`, column-major, same type as `mat4x2`: WGSL's predeclared alias.

**[`mat4x3f`](https://typeshade.dev/reference/types/mat4x3f/)**

4x3 matrix of `f32`, column-major, same type as `mat4x3`: WGSL's predeclared alias.

**[`mat4x4f`](https://typeshade.dev/reference/types/mat4x4f/)**

4x4 matrix of `f32`, column-major, same type as `mat4x4`: WGSL's predeclared alias.

**[`sampler`](https://typeshade.dev/reference/types/sampler/)**

A sampler: how a sampled texture is filtered and addressed when `textureSample` reads it.

**[`sampler_comparison`](https://typeshade.dev/reference/types/sampler_comparison/)**

A comparison sampler: compares a reference depth against a depth texture in `textureSampleCompare`, the read a shadow map takes.

**[`texture_2d`](https://typeshade.dev/reference/types/texture_2d/)**

A sampled 2D texture of `f32`, `i32` or `u32` texels, read with `textureLoad`, or filtered with `textureSample` when its texels are `f32`.

**[`texture_2d_array`](https://typeshade.dev/reference/types/texture_2d_array/)**

An array of sampled 2D textures in one binding, picked by an integer layer after the coordinate.

**[`texture_cube`](https://typeshade.dev/reference/types/texture_cube/)**

A sampled cube texture, looked up by a `vec3` direction, as an environment map is.

**[`texture_3d`](https://typeshade.dev/reference/types/texture_3d/)**

A sampled 3D texture, looked up by a `vec3` coordinate, as a volume is.

**[`texture_1d`](https://typeshade.dev/reference/types/texture_1d/)**

A sampled 1D texture, looked up by one `f32` coordinate, as a colour ramp is.

**[`texture_cube_array`](https://typeshade.dev/reference/types/texture_cube_array/)**

An array of sampled cube textures in one binding, looked up by a direction and a layer.

**[`texture_multisampled_2d`](https://typeshade.dev/reference/types/texture_multisampled_2d/)**

A multisampled 2D texture, read one sample at a time with `textureLoad(t, coords, sampleIndex)` and never filtered.

**[`texture_depth_2d`](https://typeshade.dev/reference/types/texture_depth_2d/)**

A 2D depth texture, single-channel float, read with `textureSampleCompare` through a `sampler_comparison` or with `textureLoad`.

**[`texture_depth_2d_array`](https://typeshade.dev/reference/types/texture_depth_2d_array/)**

An array of 2D depth textures in one binding, picked by an integer layer, as shadow cascades are.

**[`texture_depth_cube`](https://typeshade.dev/reference/types/texture_depth_cube/)**

A cube depth texture, looked up by a `vec3` direction, the shadow map of a point light.

**[`texture_depth_cube_array`](https://typeshade.dev/reference/types/texture_depth_cube_array/)**

An array of cube depth textures in one binding, looked up by a direction and a layer.

**[`texture_depth_multisampled_2d`](https://typeshade.dev/reference/types/texture_depth_multisampled_2d/)**

The depth attachment of a multisampled target, read one sample at a time with `textureLoad`.

**[`texture_storage_2d`](https://typeshade.dev/reference/types/texture_storage_2d/)**

A 2D storage texture, read and written by texel coordinate with `textureLoad` and `textureStore`, with no sampler.

**[`texture_storage_2d_array`](https://typeshade.dev/reference/types/texture_storage_2d_array/)**

An array of 2D storage textures in one binding, read and written by texel coordinate and an integer layer.

**[`builtin`](https://typeshade.dev/reference/types/builtin/)**

A WebGPU builtin value, of the type WGSL gives it: `i: builtin<"vertex_index">` on an entry parameter is a `u32`, `pos: builtin<"position">` on an entry IO field a `vec4`.

**[`location`](https://typeshade.dev/reference/types/location/)**

A shader IO location of type `T`, at the number written: `uv: location<0, vec2>`.

Names, declarations and descriptions come from the compiler language-service tables at the pinned commit. Builtin output spellings and stage rules are read from compiler code. The site supplies the groupings and explanations around these entries.
