Skip to content

Uniforms

Use Uniform for small values that configure a kernel.

import { Uniform } from '@volten/core';
const multiplier = new Uniform(10, 'f32');
const direction = new Uniform([1, 0, 0], 'vec3f');

Good examples are scalars, vectors, matrices, and small structs.

Use set() to update the value:

multiplier.set(20);
direction.set([0, 1, 0]);

Most users can ignore uniform layout mode.

import { volten } from '@volten/core';
const v = await volten({
uniformLayoutMode: 'auto'
});
const params = new Uniform([1, 2, 3, 4], 'vec4f', {
label: 'simulation params'
});