location
On this page

location()

Function in Layout

Attribute a field or an entry-point parameter with @location(<n>), a slot the pipeline or the previous stage supplies, with an optional @interpolate(<mode>).

import { location } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

const location: <T extends ShaderType>(
n: number,
type: T,
interpolate?: string,
) => FieldSpec<T>

Parameters

n number

the location slot.

type T extends ShaderType

the field’s type.

interpolateoptional string

the interpolation mode, such as 'flat' for an integer varying.

Return value

FieldSpec<T>

a FieldSpec for an ioStruct field map or an fn parameter record.

Description

The same helper serves an ioStruct field map and an fn parameter record.

Examples

Example

const VsOut = ioStruct('VsOut', { pos: builtin('position', vec4fT), id: location(0, u32T, 'flat') })

In the guide

See also

Source

src/core/sot.ts, line 317, at commit 26de7be8

Edit this page Report a problem