---
title: "TS8051 LAYOUT: an error code of the TypeShade compiler"
description: "TS8051 LAYOUT, an error code of the TypeShade compiler. A buffer binding's store type that breaks one of WGSL's host-shareable rules: a bool…"
url: https://typeshade.dev/reference/errors/ts8051/
language: en
---

# `TS8051`

Front-end code `LAYOUT`

A buffer binding's store type that breaks one of WGSL's host-shareable rules: a `bool`, alone or in a vector, in a `uniform` or `storage` binding; a runtime-sized `array<T>` that is not the last member of its struct; a runtime-sized array in a uniform; or a two-row matrix (`mat2x2`, `mat3x2`, `mat4x2`) in a uniform, which WGSL and std140 lay out at different offsets ([Rule 4.8](https://typeshade.dev/reference/rules/4-8/)).

The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.

The registry text and every compiler message on these pages are the compiler's own English.

## Example

example.shade.ts

```ts
"use typeshade"

class Uniforms {
  on: bool
  gain: f32
}

declare const u: uniform<Uniforms>

@fragment
export function main(uv: location<0, vec2>): vec4 {
  return vec4(uv * u.gain, 0., 1.)
}
```

Compiled at build time against the pinned compiler, this program gets:

**TS8051** error, line 8: "Uniforms.on" is a bool; a uniform struct holds numeric scalars only (WGSL's host-shareable rule). Use `u32`.

## How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts

```ts
"use typeshade"

class Uniforms {
  on: u32
  gain: f32
}

declare const u: uniform<Uniforms>

@fragment
export function main(uv: location<0, vec2>): vec4 {
  return vec4(uv * u.gain, 0., 1.)
}
```

## The rules this enforces

**[Rule 4.8](https://typeshade.dev/reference/rules/4-8/) Test**

Every `matCxR` with `C` and `R` in 2, 3, 4 must be a type, and a square one must also answer to `matN`.

**[Rule 6.8](https://typeshade.dev/reference/rules/6-8/) Test**

The byte layout the emitted module assumes for a resource and the layout `reflect()` reports must agree byte for byte, under WGSL’s uniform and storage layout rules, and so must the layout the manifest carries ([Rule 11.10](https://typeshade.dev/reference/rules/11-10/)); a vertex entry’s vertex buffer is one layout, its `@location` inputs tightly packed in the order written and numbered in that order where no `location<n, T>` states the number ([Rule 6.6](https://typeshade.dev/reference/rules/6-6/)), which `reflect().vertex` and the manifest both report.

## See also

- [Resources](https://typeshade.dev/guide/language/resources/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

Where the compiler raises this code at commit af54ddad5, one line per file:

- [`src/compiler/ts/bindings.ts:643`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/bindings.ts#L643)
