---
title: "StructDecl: TypeShade 셰이더 API의 IR 분류 인터페이스 참조 문서"
description: "StructDecl, TypeShade API의 IR 분류에 속하는 인터페이스입니다. ModuleDecl.structs의 항목 하나로, WGSL 구조체 선언입니다."
url: https://typeshade.dev/ko/api/structdecl-interface/
language: ko
---

# `StructDecl`

인터페이스, IR 분류

ModuleDecl.structs의 항목 하나로, WGSL 구조체 선언입니다.

`import type { StructDecl } from 'typeshade'`
`import type { StructDecl } from 'typeshade/core/ir'`

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

## 구문

```ts
interface StructDecl {
  readonly name: string;
  readonly fields: readonly StructField[];
}
```

## 설명

GLSL에서는 일반 구조체가 됩니다. 필드에 `location`이나 `builtin`이 붙어 있으면 `in`/`out` 전역 변수 집합으로 펼쳐진다([`StructField`](https://typeshade.dev/ko/api/structfield/) 참고). 이 형태를 손으로 쓰는 대신 [`uniformStruct`](https://typeshade.dev/ko/api/uniformstruct/) 또는 [`ioStruct`](https://typeshade.dev/ko/api/iostruct/)를 사용합니다. 두 함수는 구조체를 바인딩 및 타입이 지정된 필드 접근과 함께 만들어 줍니다.

## 인스턴스 속성

**`name` 읽기 전용 `string`**

**`fields` 읽기 전용 `readonly StructField[]`**

## 함께 보기

- [`StructField`](https://typeshade.dev/ko/api/structfield/)
- [`uniformStruct`](https://typeshade.dev/ko/api/uniformstruct/)
- [`ioStruct`](https://typeshade.dev/ko/api/iostruct/)

## 소스

[`src/core/ir/nodes/struct-decl.ts`, 63행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/nodes/struct-decl.ts#L63), 커밋 af54ddad5 기준
