---
title: "StorageBuffer: TypeShade 셰이더 API의 레이아웃 분류 인터페이스 참조 문서"
description: "StorageBuffer, TypeShade API의 레이아웃 분류에 속하는 인터페이스입니다. storageBuffer가 돌려주는 핸들입니다. 바인딩된 런타임 길이 array<Element> 스토리지 버퍼를 나타냅니다."
url: https://typeshade.dev/ko/api/storagebuffer-interface/
language: ko
---

# `StorageBuffer`

인터페이스, 레이아웃 분류

storageBuffer가 돌려주는 핸들입니다. 바인딩된 런타임 길이 `array<Element>` 스토리지 버퍼를 나타냅니다.

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

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

## 구문

```ts
interface StorageBuffer<A> {
  readonly binding: BindingDecl;
  readonly node: Node;
  readonly elementDecl?: StructDecl;
  at(i: ReadonlyNode<ScalarKey> | number): A;
}
```

## 설명

`.at(i)`는 요소 접근자입니다. 구조체 요소([`structDecl`](https://typeshade.dev/ko/api/structdecl/) 또는 [`ioStruct`](https://typeshade.dev/ko/api/iostruct/) 핸들)이면 타입이 지정된 필드 프록시 `buf.at(i).p0`를 반환합니다. 이때 `.of()`나 요소 타입 인자는 필요하지 않습니다. 스칼라 요소(`f32T`)이면 요소 노드를 반환합니다.

## 인스턴스 속성

**`binding` 읽기 전용 `BindingDecl`**

`module({ bindings })`에 쓰는 바인딩 선언입니다.

**`node` 읽기 전용 `Node`**

배열 전체의 원시 바인딩 접근 노드입니다.

**`elementDecl` 선택 사항 읽기 전용 `StructDecl`**

요소가 구조체 핸들이었을 때 요소 구조체의 선언입니다. 이 선언 덕분에 `module({ uses: [buf] })`가 요소 구조체도 함께 등록합니다.

## 인스턴스 메서드

**`at` `(i: ReadonlyNode<ScalarKey> | number): A`**

요소 `i`를 읽습니다. 구조체 요소이면 타입이 지정된 필드 프록시를, 스칼라 또는 벡터 요소이면 요소 노드를 반환합니다.

## 함께 보기

- [`storageBuffer`](https://typeshade.dev/ko/api/storagebuffer/)
- [`structDecl`](https://typeshade.dev/ko/api/structdecl/)
- [`ioStruct`](https://typeshade.dev/ko/api/iostruct/)

## 소스

[`src/core/sot.ts`, 1012행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/sot.ts#L1012), 커밋 af54ddad5 기준
