---
title: "GLSL ES 3.00 타입과 그 TypeShade 표기"
description: "GLSL ES 3.00 타입 표면을 TypeShade 표기와 나란히 놓습니다. 스칼라와 벡터, 행렬, 배열, 샘플러, 그리고 GLSL이 거부하는 타입을 다룹니다."
url: https://typeshade.dev/ko/guide/language/from-glsl/types/
language: ko
---

# 타입

스칼라와 벡터 이름은 WGSL의 것입니다. 소스 하나가 두 타깃을 모두 맡아야 하기 때문입니다. GLSL 생성기가 그 이름을 GLSL 표기로 변환하므로, 선언에 `f32`라고 적은 것이 생성된 셰이더에서는 `float`가 됩니다.

## 스칼라

GLSL ES 3.00 TypeShade

```glsl
float
```

```ts
f32
```

```glsl
int
```

```ts
i32
```

```glsl
uint
```

```ts
u32
```

```glsl
bool
```

```ts
bool
```

## 벡터

GLSL ES 3.00 TypeShade

```glsl
vec3
```

```ts
vec3
```

```glsl
ivec3
```

```ts
vec3i
```

```glsl
uvec3
```

```ts
vec3u
```

```glsl
bvec3
```

```ts
vec3b
```

`vec2`와 `vec4`도 같은 방식으로 읽고, 각각의 정수형과 부호 없는 정수형과 불리언 형태도 마찬가지입니다. 배정밀도 벡터는 어느 타깃에도 형태가 없어서 생성기가 돌기 전에 `f32` 레인으로 하향 변환됩니다.

## 행렬과 배열

GLSL ES 3.00 TypeShade

```glsl
mat4
```

```ts
mat4
```

```glsl
mat3
```

```ts
mat3
```

```glsl
mat2x3
```

```ts
mat2x3
```

정사각 행렬은 드라이버 오류 메시지가 쓰는 짧은 이름을 그대로 씁니다. 나머지 여섯 가지 모양은 GLSL 표기와 같은 `matCxR`로, 앞이 열이고 뒤가 행입니다.

GLSL ES 3.00 TypeShade

```glsl
float[4]
```

```ts
array<f32, 4>
```

```glsl
float[2]
```

```ts
[f32, f32]
```

튜플은 타입이 길이를 고정한 목록이므로 `[f32, f32]`와 `array<f32, 2>`는 같은 타입에 닿습니다. 실행해 봐야 길이를 아는 배열은 스토리지 버퍼이고 GLSL에는 그 형태가 없어서, 그런 모듈은 데이터 텍스처에서 읽도록 다시 쓰입니다.

## 샘플러

GLSL은 텍스처와 샘플러를 결합 샘플러 하나로 합치고, WebGPU는 둘을 따로 둡니다. TypeShade 파일은 둘을 WebGPU 방식으로 선언하고 GLSL 생성기가 합치므로, 샘플러 인자는 모든 읽기에서 사라지고 그 자리를 차지하던 바인딩도 호스트가 바인딩하는 레이아웃에서 빠집니다.

GLSL ES 3.00 TypeShade

```glsl
sampler2D
```

```ts
texture_2d<f32>
```

```glsl
usampler2D
```

```ts
texture_2d<u32>
```

```glsl
isampler2D
```

```ts
texture_2d<i32>
```

```glsl
sampler2DArray
```

```ts
texture_2d_array<f32>
```

```glsl
samplerCube
```

```ts
texture_cube<f32>
```

```glsl
sampler3D
```

```ts
texture_3d<f32>
```

```glsl
sampler2DShadow
```

```ts
texture_depth_2d
```

standalone sampler — fused into the combined sampler2D

```ts
sampler
```

standalone comparison sampler — fused into the combined sampler2DShadow

```ts
sampler_comparison
```

깊이 텍스처는 그 합치기의 예외입니다. 결합 타입이 모듈이 그것을 어떻게 읽느냐에 달려 있어서 바인딩 생성 단계가 결정합니다. 이 인터페이스가 허용하는 깊이 텍스처 읽기는 모두 비교이고, 그래서 항상 shadow 형태가 됩니다.

## GLSL 형태가 없는 타입

아래 타입은 모두 생성기가 거부하며, 옆 칸은 생성기의 오류 메시지입니다. 그런 타입을 든 모듈도 WGSL은 생성하므로, 셰이더를 WebGPU 전용으로 만드는 줄이 바로 이것들입니다.

TypeShade 컴파일러 메시지

```ts
texture_1d<f32>
```

`texture_1d`<`f32`> is not supported yet by the GLSL backend ([Rule 10.5](https://typeshade.dev/ko/reference/rules/10-5/)); GLSL ES 3.00 has no 1d or cube-array samplers

```ts
texture_cube_array<f32>
```

`texture_cube_array`<`f32`> is not supported yet by the GLSL backend (Rule 10.5); GLSL ES 3.00 has no 1d or cube-array samplers

```ts
texture_multisampled_2d<f32>
```

multisampled texture load — sampler2DMS is ES 3.10 (msaaTextureLoad fails the module closed first)

```ts
texture_storage_2d<"rgba8unorm", "write">
```

`texture_storage_2d`<rgba8unorm, write> is not supported yet by the GLSL backend (Rule 10.5); GLSL ES 3.00 has no image load/store (it is ES 3.10)

```ts
atomic<u32>
```

`atomic<u32>` is not supported yet in a GLSL ES 3.00 stage (Rule 10.5); a `@compute` entry that reaches no texture runs it on WebGL2 as its pass program ([Rule 11.8](https://typeshade.dev/ko/reference/rules/11-8/))
