interpolate
Call Signature
Section titled “Call Signature”interpolate<
TInterpolation
,TData
>(interpolationType
,data
):Decorate
<TData
,Interpolate
<TInterpolation
>>
Defined in: packages/typegpu/src/data/attributes.ts:243
Specifies how user-defined vertex shader output (fragment shader input) must be interpolated.
Tip: Integer outputs cannot be interpolated.
Type Parameters
Section titled “Type Parameters”• TInterpolation extends "perspective"
| "linear"
| "perspective, center"
| "perspective, centroid"
| "perspective, sample"
| "linear, center"
| "linear, centroid"
| "linear, sample"
• TData extends PerspectiveOrLinearInterpolatableData
Parameters
Section titled “Parameters”interpolationType
Section titled “interpolationType”TInterpolation
How data should be interpolated.
TData
The data-type to wrap.
Returns
Section titled “Returns”Decorate
<TData
, Interpolate
<TInterpolation
>>
Example
Section titled “Example”const VertexOutput = { a: d.f32, // has implicit 'perspective, center' interpolation b: d.interpolate('linear, sample', d.f32),};
Call Signature
Section titled “Call Signature”interpolate<
TInterpolation
,TData
>(interpolationType
,data
):Decorate
<TData
,Interpolate
<TInterpolation
>>
Defined in: packages/typegpu/src/data/attributes.ts:268
Specifies how user-defined vertex shader output (fragment shader input) must be interpolated.
Tip: Default sampling method of flat
is first
. Unless you specifically
need deterministic behavior provided by 'flat, first'
, prefer explicit
'flat, either'
as it could be slightly faster in hardware.
Type Parameters
Section titled “Type Parameters”• TInterpolation extends "flat"
| "flat, first"
| "flat, either"
• TData extends FlatInterpolatableData
Parameters
Section titled “Parameters”interpolationType
Section titled “interpolationType”TInterpolation
How data should be interpolated.
TData
The data-type to wrap.
Returns
Section titled “Returns”Decorate
<TData
, Interpolate
<TInterpolation
>>
Example
Section titled “Example”const VertexOutput = { a: d.f32, // has implicit 'perspective, center' interpolation b: d.interpolate('flat, either', d.u32), // integer outputs cannot interpolate};