---
title: "Layout, a category in the TypeShade API reference"
description: "Layout in the TypeShade API reference. The declarators that state a struct or a bound resource once, for the host and both targets."
url: https://typeshade.dev/api/layout/
language: en
---

# Layout

24 members

The declarators that state a struct or a bound resource once, for the host and both targets.

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

**[`arrayOf`](https://typeshade.dev/api/arrayof/) Function**

Declare a fixed-length array field inside a uniformStruct field map.

**[`builtin`](https://typeshade.dev/api/builtin/) Function**

Attribute a field or an entry-point parameter with a `@builtin(<name>)`, the value the pipeline supplies to the shader.

**[`constDecl`](https://typeshade.dev/api/constdecl/) Function**

Declare a module-level scalar constant together with its typed reference in one call.

**[`ConstHandle`](https://typeshade.dev/api/consthandle/) Interface**

The handle constDecl returns: a module-level constant and its typed reference, declared together so the name is written once.

**[`FieldSpec`](https://typeshade.dev/api/fieldspec/) Interface**

One struct field or entry-point parameter carrying a stage attribute.

**[`FixedTypeBuiltinName`](https://typeshade.dev/api/fixedtypebuiltinname/) Type**

The WgslBuiltinName ids whose type WGSL fixes, every id except `clip_distances`, whose `array<f32, N>` length the author picks.

**[`HandleArray`](https://typeshade.dev/api/handlearray/) Interface**

A fixed-size `array<Element, N>` uniform field whose element is a struct handle: patterns: arrayOf.

**[`hostBlock`](https://typeshade.dev/api/hostblock/) Function**

Declare a host-owned uniform block: a whole struct of values the host supplies, from one declaration that works on both targets.

**[`hostUniform`](https://typeshade.dev/api/hostuniform/) Function**

Declare a host-owned uniform: one scalar, vector or matrix value the host supplies, spelled the way the host's target spells it.

**[`ioStruct`](https://typeshade.dev/api/iostruct/) Function**

Declare a struct that crosses a stage boundary, a vertex output, a fragment input, a compute IO record, from one field map.

**[`IoStruct`](https://typeshade.dev/api/iostruct-interface/) Interface**

The handle ioStruct returns: a struct that crosses a stage boundary, whose fields carry `@builtin` or `@location` attributes.

**[`location`](https://typeshade.dev/api/location/) Function**

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>)`.

**[`PlainStruct`](https://typeshade.dev/api/plainstruct/) Interface**

The handle structDecl returns: a struct declared for something other than a stage's IO boundary, such as a storage-buffer element type (paired with storageBuffer) or a struct nested inside another struct.

**[`resource`](https://typeshade.dev/api/resource/) Function**

Declare a bound resource that is not a struct: a texture or a sampler.

**[`Resource`](https://typeshade.dev/api/resource-interface/) Interface**

A single-binding handle: a BindingDecl for module plus a typed access node.

**[`storageBuffer`](https://typeshade.dev/api/storagebuffer/) Function**

Declare a bound `array<Element>` storage buffer from its element alone.

**[`StorageBuffer`](https://typeshade.dev/api/storagebuffer-interface/) Interface**

The handle storageBuffer returns: a bound runtime-length `array<Element>` storage buffer.

**[`structDecl`](https://typeshade.dev/api/structdecl/) Function**

Declare a plain struct: one that never crosses a stage boundary.

**[`TypeArray`](https://typeshade.dev/api/typearray/) Interface**

A fixed-size array uniform field with a plain element type: dash\_array: arrayOf(vec4fT, 2).

**[`uniformStruct`](https://typeshade.dev/api/uniformstruct/) Function**

Declare a uniform-buffer struct together with its binding, from one field map.

**[`UniformStruct`](https://typeshade.dev/api/uniformstruct-interface/) Interface**

The handle uniformStruct returns: a struct and its binding declared together.

**[`WGSL_BUILTIN_NAMES`](https://typeshade.dev/api/wgslbuiltinnames/) Constant**

Every WgslBuiltinName value as a runtime array.

**[`WGSL_BUILTIN_TYPES`](https://typeshade.dev/api/wgslbuiltintypes/) Constant**

The type each `@builtin(<name>)` supplies, for every id WGSL gives one fixed type.

**[`WgslBuiltinName`](https://typeshade.dev/api/wgslbuiltinname/) Type**

Every `@builtin(<name>)` id WGSL defines.
