---
title: "TS8051 LAYOUT: TypeShade 컴파일러가 진단에 붙이는 오류 코드와 그 뜻, 고치는 법"
description: "TS8051 LAYOUT, TypeShade 컴파일러의 오류 코드입니다. 버퍼 바인딩의 저장 타입이 WGSL의 호스트 공유 규칙 하나를 어깁니다."
url: https://typeshade.dev/ko/reference/errors/ts8051/
language: ko
---

# `TS8051`

프런트엔드 코드 `LAYOUT`

버퍼 바인딩의 저장 타입이 WGSL의 호스트 공유 규칙 하나를 어깁니다. `uniform`이나 `storage` 바인딩 안의 `bool`(단독이든 벡터든), 구조체의 마지막 멤버가 아닌 런타임 크기 `array<T>`, uniform 안의 런타임 크기 배열, uniform 안의 두 행 행렬(`mat2x2`, `mat3x2`, `mat4x2`)이 그렇습니다. 마지막은 WGSL과 std140이 서로 다른 오프셋에 배치합니다([규칙 4.8](https://typeshade.dev/ko/reference/rules/4-8/)).

레지스트리에는 이 상수에 대한 문서 주석이 없습니다. 그래서 위 설명은 컴파일러가 이 코드와 함께 내는 메시지를 보고 이 사이트가 쓴 것입니다.

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

## 예제

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

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

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

## 고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

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

## 이 코드가 적용하는 규칙

**[규칙 4.8](https://typeshade.dev/ko/reference/rules/4-8/) 테스트**

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

**[규칙 6.8](https://typeshade.dev/ko/reference/rules/6-8/) 테스트**

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/ko/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/ko/reference/rules/6-6/)), which `reflect().vertex` and the manifest both report.

## 함께 보기

- [리소스](https://typeshade.dev/ko/guide/language/resources/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

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