Skip to content

Data Schema Cheatsheet

Numeric data types

SchemaJavaScriptWGSL
import { f32 } from 'typegpu/data';
numberf32
import { i32 } from 'typegpu/data';
numberi32
import { u32 } from 'typegpu/data';
numberu32
import { bool } from 'typegpu/data';
booleanbool

Vector and matrix types

SchemaValue constructorsWGSL equivalents
vec2u
  • vec2u(x: number, y: number)
  • vec2u(xy: number)
  • vec2u()
vec2u, vec2<u32>
vec2f
  • vec2f(x: number, y: number)
  • vec2f(xy: number)
  • vec2f()
vec2f, vec2<f32>
vec2i
  • vec2i(x: number, y: number)
  • vec2i(xy: number)
  • vec2i()
vec2i, vec2<i32>
vec3u
  • vec3u(x: number, y: number, z: number)
  • vec3u(xyz: number)
  • vec3u()
vec3u, vec3<u32>
vec3f
  • vec3f(x: number, y: number, z: number)
  • vec3f(xyz: number)
  • vec3f()
vec3f, vec3<f32>
vec3i
  • vec3i(x: number, y: number, z: number)
  • vec3i(xyz: number)
  • vec3i()
vec3i, vec3<i32>
vec4u
  • vec4u(x: number, y: number, z: number, w: number)
  • vec4u(xyzw: number)
  • vec4u()
vec4u, vec4<u32>
vec4f
  • vec4f(x: number, y: number, z: number, w: number)
  • vec4f(xyzw: number)
  • vec4f()
vec4f, vec4<f32>
vec4i
  • vec4i(x: number, y: number, z: number, w: number)
  • vec4i(xyzw: number)
  • vec4i()
vec4i, vec4<i32>
mat2x2f
  • mat2x2f(...elements: number[])
  • mat2x2f(...columns: vec2f[])
  • mat2x2f()
mat2x2f, mat2x2<f32>
mat3x3f
  • mat3x3f(...elements: number[])
  • mat3x3f(...columns: vec3f[])
  • mat3x3f()
mat3x3f, mat3x3<f32>
mat4x4f
  • mat4x4f(...elements: number[])
  • mat4x4f(...columns: vec4f[])
  • mat4x4f()
mat4x4f, mat4x4<f32>