---
title: "LayoutKind: type in Reflection, TypeShade API reference"
description: "LayoutKind, a type in Reflection. The byte-layout rule a struct's fields are placed under."
url: https://typeshade.dev/api/layoutkind/
language: en
---

# `LayoutKind`

Type in Reflection

The byte-layout rule a struct's fields are placed under.

`import type { LayoutKind } from 'typeshade'`

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

## Syntax

```ts
type LayoutKind = 'std140' | 'std430';
```

## Description

`'std140'` is the rule WGSL applies to the `uniform` address space, and the rule of a GLSL ES 3.00 `layout(std140) uniform` block: a struct or array base alignment rounds up to 16 bytes, so a `vec3` field costs 16 and an array of `f32` uses 16 bytes per element. `'std430'` is the rule WGSL applies to the `storage` address space: natural alignment with no 16-byte round-up. Vertex attributes use a separate, tightly packed layout (see [`VertexLayout`](https://typeshade.dev/api/vertexlayout/)).

Pick the rule from the binding’s address space, on either backend: `uniform` is std140 and `storage` is std430. GLSL ES 3.00 has no storage buffer, so a `storage` binding is emitted as a data texture there, but [`reflect`](https://typeshade.dev/api/reflect/) describes the module as authored and reports its fields under std430 in `Reflection.storage`.

A two-row field — `mat2x2`, `mat3x2`, `mat4x2` — under `'std140'` throws: WGSL’s uniform rule gives a two-row matrix a column stride of 8 bytes while GLSL std140 rounds every column to 16, and this engine reports one number for both backends. The other six shapes agree byte for byte (measured on Tint and ANGLE). Carry such a field as the `matCx4` of the same column count, where both targets stride 16, or as `C` separate `vec2` fields.

## See also

- [`VertexLayout`](https://typeshade.dev/api/vertexlayout/)
- [`reflect`](https://typeshade.dev/api/reflect/)

## Source

[`src/core/reflect/layout.ts`, line 27](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/reflect/layout.ts#L27), at commit af54ddad5
