Skip to content

Shader Logs

Debug logs are written from WGSL with typed helper functions after the current invocation has debugging enabled.

debugF32("weight", weight);

The message is optional.

debugF32(weight);
debugF32("weight", weight);
HelperValue
debugF32()f32
debugU32()u32
debugI32()i32
debugVec2() / debugVec2f()vec2f
debugVec3() / debugVec3f()vec3f
debugVec4() / debugVec4f()vec4f
debugMat4() / debugMat4x4f()mat4x4f

Volten uses typed helpers so the log format is known before the shader runs.

Messages must be string literals.

debugF32("current value", value);

This keeps debug metadata static while the GPU records only numeric values.

Use enableDebug() close to the value you care about.

if (gid.x == index) {
enableDebug();
}
// Only the enabled invocation emits these logs.
debugU32("gid.x", gid.x);
debugF32("value", data[gid.x]);

Without enableDebug(), debug helpers do nothing for that invocation. After enableDebug(), later debug helpers in that invocation emit logs.