UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

30 lines (29 loc) 706 B
import { $internal } from "../shared/symbols.js"; import { $gpuRepr, $memIdent, $repr, $validStorageSchema, $validUniformSchema, $validVertexSchema, } from "../shared/symbols.js"; // ---------- // Public API // ---------- /** * Marks a concrete integer scalar type schema (u32 or i32) as a WGSL atomic. * * @example * const atomicU32 = d.atomic(d.u32); * const atomicI32 = d.atomic(d.i32); * * @param data Underlying type schema. */ export function atomic(data) { return new AtomicImpl(data); } // -------------- // Implementation // -------------- class AtomicImpl { [$internal] = {}; type = 'atomic'; inner; // --- constructor(inner) { this.inner = inner; } }