CpuValue
On this page

CpuValue

Type in CPU oracle

A value as the CPU backends (compileModule and compileModuleJs) represent it: a plain JavaScript value, never a typed array or a GPU buffer.

import type { CpuValue } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

type CpuValue = number | boolean | number[] | boolean[] | CpuStruct;

Description

A scalar of any kind (f32, f64, i32, u32, bool) is a number or boolean, computed in double precision; CpuPrecision says how the arithmetic rounds. A vector or matrix is a flat number[], mutable and shared by reference: a field write such as p.x = … inside a shader function changes the caller’s array in place. A struct is a CpuStruct. This is the value type the functions of a CpuModule take and return, and the one its setBinding accepts.

See also

Source

src/core/cpu-runtime.ts, line 43, at commit 26de7be8

Edit this page Report a problem