Outputs
Kernel outputs tell Volten which bindings should be returned when you read a node.
const kernel = new Kernel( ` fn main(gid: vec3u) { result[gid.x] = input[gid.x] * 2.0; } `, { outputs: ['result'] });Then read the node:
const node = v.pass(kernel, { input, result });v.run(node);
const output = await v.read(node);// { result: Float32Array [...] }Output Names
Section titled “Output Names”The simplest form is an array of binding names.
const kernel = new Kernel(`...`, { outputs: ['result', 'debug']});Those names must match buffer-like bindings passed to v.pass().
const node = v.pass(kernel, { input, result, debug});In-Place Kernels
Section titled “In-Place Kernels”You do not need declared outputs for in-place work.
const kernel = new Kernel(` fn main(gid: vec3u) { data[gid.x] = data[gid.x] * 2.0; }`);
const node = v.pass(kernel, { data });v.run(node);
const result = await v.read(data);If a kernel has no declared outputs, read the concrete buffer or handle directly.