Skip to content

Sign up to be notified when the ShaderHunt platform is available, along with interactive examples teaching TypeGPU from the ground up.

invariant

invariant(data): Decorated<Vec4f, [Builtin<"position">, Invariant]>

Defined in: packages/typegpu/src/data/attributes.ts:305

Marks a position built-in output value as invariant in vertex shaders. If the data and control flow match for two position outputs in different entry points, then the result values are guaranteed to be the same.

Must only be applied to the position built-in value.

Decorated<Vec4f, [Builtin<"position">]>

The position built-in data-type to mark as invariant.

Decorated<Vec4f, [Builtin<"position">, Invariant]>

const VertexOutput = {
pos: d.invariant(d.builtin.position),
};