---
title: "TypeShade Playground, 브라우저에서 셰이더 컴파일"
description: "브라우저에서 \"use typeshade\" 파일을 작성해 WGSL과 GLSL ES 3.00으로 컴파일합니다. WebGPU나 WebGL2에서 실행하고 진단과 리플렉션도 확인할 수 있습니다."
url: https://typeshade.dev/ko/playground/
language: ko
---

# Playground

브라우저에서 TypeShade를 사용해 보세요. 예제를 선택하거나 직접 셰이더를 작성한 뒤, 생성된 코드와 렌더링 결과를 확인할 수 있습니다.

[Quick Start](https://typeshade.dev/ko/guide/quick-start/) [작성 가이드](https://typeshade.dev/ko/guide/language/) [갤러리](https://gallery.typeshade.dev/ko/) [문제 보고](https://github.com/typeshade/typeshade/issues/new)

## 예제에서 시작하기

타일 하나가 컴파일러 저장소의 .shade.ts 파일 하나입니다. 예제를 열어 고치고 옆에 파일을 더할 수 있으며, 텍스처에는 직접 고른 이미지를 연결할 수 있습니다.

[빈 파일](https://typeshade.dev/ko/playground/#blank)

`time`, `resolution`, `mouse`를 읽는 프래그먼트 셰이더입니다.

### 학습 경로

- [모듈과 host.ts 첫 번째 색 가장 작은 그리기 프로그램입니다. 프래그먼트 진입점 하나가 모든 픽셀에 색 하나를 돌려줍니다.](https://typeshade.dev/ko/playground/#example=first-color)
- [모듈과 host.ts UV 그라디언트 `position` 빌트인과 크기 유니폼으로 각 픽셀을 0에서 1 사이의 좌표로 바꾸고, 그 좌표를 그라디언트로 그립니다.](https://typeshade.dev/ko/playground/#example=uv-gradient)
- [모듈과 host.ts 움직이는 물결 `time` 유니폼 필드로 물결을 움직이고, `animate(canvas)`가 프레임마다 한 번씩 그립니다.](https://typeshade.dev/ko/playground/#example=moving-wave)
- [모듈과 host.ts SDF 도형 원과 상자까지의 거리를 돌려주는 함수에 `smoothstep`을 더해 부드러운 가장자리를 만듭니다.](https://typeshade.dev/ko/playground/#example=sdf-shapes)
- [모듈과 host.ts 타일 패턴 `for` 루프, `if`, `fract`로 타일이 반복되는 패턴을 그립니다.](https://typeshade.dev/ko/playground/#example=tile-pattern)
- [모듈과 host.ts 만델브로 집합 루프와 `break`로 점이 원점 근처에 머무는 횟수를 세어 만델브로 집합을 칠합니다.](https://typeshade.dev/ko/playground/#example=fractal)
- [모듈과 host.ts 팔레트 색 네 개를 담은 모듈 상수 배열을 `mix`로 섞어 매끄러운 색 띠 하나를 만듭니다.](https://typeshade.dev/ko/playground/#example=palette)
- [모듈과 host.ts 튀는 공 공을 움직이는 메서드와 픽셀을 공에 견주어 재는 메서드를 가진 `class Ball`입니다. 공을 바꾸는 함수는 호출한 쪽의 공을 바꿉니다.](https://typeshade.dev/ko/playground/#example=bouncing-balls)
- [모듈과 host.ts 배열을 두 배로 첫 컴퓨트 커널입니다. `@compute` 진입점이 스토리지 배열의 숫자를 하나씩 두 배로 만듭니다.](https://typeshade.dev/ko/playground/#example=double-array)
- [모듈과 host.ts 이미지 블러 2D `@compute([8, 8])` 진입점이 이미지의 각 픽셀을 이웃한 여덟 픽셀과 평균합니다.](https://typeshade.dev/ko/playground/#example=image-blur)
- [모듈과 host.ts 배열의 합 배열을 받아 숫자 하나를 돌려주는 함수는 커널 함수입니다. `for` 루프가 GPU에서 실행되고 호스트는 합을 기다립니다.](https://typeshade.dev/ko/playground/#example=sum-array)
- [모듈과 host.ts 병렬 합 워크그룹 하나가 배열을 더하며, `workgroup` 메모리에서 `workgroupBarrier()`로 부분합을 절반씩 줄여 갑니다.](https://typeshade.dev/ko/playground/#example=parallel-sum)
- [모듈과 host.ts 히스토그램 여러 호출이 `atomicAdd`로 같은 구간에 동시에 세어 넣으므로 개수를 잃지 않습니다.](https://typeshade.dev/ko/playground/#example=histogram)
- [모듈과 host.ts 레이 트레이서 1~8단계의 요소를 모아 픽셀마다 카메라 광선을 만들고, `class Sphere`와 체커 바닥, 그림자를 그립니다.](https://typeshade.dev/ko/playground/#example=ray-tracer)

### 작품

- [나메크의 캡슐 코퍼레이션 우주선 드래곤볼 Z에 나오는 캡슐 코퍼레이션의 우주선을 TypeShade 클래스로 구성한 장면입니다.](https://typeshade.dev/ko/playground/#example=capsule-corp-namek-class)
- [도메인 워핑 fbm 출력을 다시 fbm에 넣습니다.](https://typeshade.dev/ko/playground/#example=domain-warp-twin)
- [음영 기복도 음영 기복.](https://typeshade.dev/ko/playground/#example=hillshade-twin)
- [줄리아 집합 탈출 시간으로 그리는 줄리아 프랙탈.](https://typeshade.dev/ko/playground/#example=julia-twin)
- [만화경 극좌표로 접는 거울 반사.](https://typeshade.dev/ko/playground/#example=kaleidoscope-twin)
- [만델브로 집합 탈출 시간을 매끄럽게 이어 칠한 만델브로 집합.](https://typeshade.dev/ko/playground/#example=mandelbrot-twin)
- [바다 수평선 원리부터 계산해 그린 바다 풍경.](https://typeshade.dev/ko/playground/#example=ocean-twin)
- [경로 추적기 평범한 TypeScript로 쓴 작은 경로 추적기입니다.](https://typeshade.dev/ko/playground/#example=path-tracer)
- [플라스마 사인파를 여러 개 더해 만든 고전 플라스마에 RGB 팔레트로 색을 입혔습니다.](https://typeshade.dev/ko/playground/#example=plasma-twin)
- [클래스 기반 3D SDF 레이 트레이서 추상 SDF 도형 클래스와 상속으로 만든 3D 레이 트레이서입니다. 구체, 상자, 토러스, 평면을 구면 추적으로 렌더링합니다.](https://typeshade.dev/ko/playground/#example=rt-renderer-class)
- [별밭 텍스처 없이 그린 밤하늘.](https://typeshade.dev/ko/playground/#example=starfield-twin)
- [터널 데모신 시절의 터널.](https://typeshade.dev/ko/playground/#example=tunnel-twin)
- [보로노이 움직이는 보로노이 패턴입니다.](https://typeshade.dev/ko/playground/#example=voronoi-twin)

### 고정밀도

- [fp64 버닝 십 버닝 십 프랙탈입니다. 제곱하기 전에 |Re z|, |Im z|로 접고, 바늘처럼 뾰족한 부분을 확대합니다.](https://typeshade.dev/ko/playground/#example=fp64-burning-ship-twin)
- [fp64 파국적 상쇄 수치해석 교과서의 그 그래프를 GPU로 그립니다.](https://typeshade.dev/ko/playground/#example=fp64-cancellation-twin)
- [fp64 체커 평면 월드 평면 위의 1단위 체커보드.](https://typeshade.dev/ko/playground/#example=fp64-checker-plane-twin)
- [fp64 오래 켜 둔 시계 오래 켜 두면 생기는 애니메이션 버그.](https://typeshade.dev/ko/playground/#example=fp64-clock-twin)
- [fp64 딥 줌 에뮬레이션 배정밀도(f32 두 개로 만든 df64).](https://typeshade.dev/ko/playground/#example=fp64-deep-zoom-twin)
- [fp64 줄리아 집합 같은 배정밀도 기법을 줄리아 집합으로 보인 예제.](https://typeshade.dev/ko/playground/#example=fp64-julia-twin)
- [에뮬레이션 배정밀도 큰 월드 좌표에서 에뮬레이션 `f64`와 `f32` 정밀도를 비교하는 셰이더입니다.](https://typeshade.dev/ko/playground/#example=fp64-lane-stripes)
- [fp64 쌍곡선 항법 LORAN 방식의 해도 격자.](https://typeshade.dev/ko/playground/#example=fp64-loran-twin)
- [fp64 거리 추정 거리 추정(d = ½·|z|·ln|z|/|dz|)으로 만델브로 경계를 그립니다. 정밀도는 식 중간에서 나눕니다.](https://typeshade.dev/ko/playground/#example=fp64-mandelbrot-de-twin)
- [fp64 뉴턴 프랙탈 z³ = 1을 푸는 뉴턴 방법입니다. 색은 그 픽셀이 어느 세제곱근으로 수렴하는지 나타냅니다.](https://typeshade.dev/ko/playground/#example=fp64-newton-twin)
- [fp64 중심 기준 좌표 행성 규모 엔진이 시점 기준으로 렌더링하는 이유.](https://typeshade.dev/ko/playground/#example=fp64-rtc-twin)
- [fp64 사인 스윕 큰 기준값에 화면에서 조금씩 움직이는 값을 더한 x로 sin(x)를 구합니다.](https://typeshade.dev/ko/playground/#example=fp64-sine-sweep-twin)

### 기능별 예제

- [런타임 배열 길이 런타임 크기의 스토리지 배열을 처리하는 커널에 필요한 경계 검사입니다.](https://typeshade.dev/ko/playground/#example=array-length)
- [배열 리터럴 전체 화면 삼각형의 꼭짓점은 `array<f32, 3>` 목록 두 개에서 오고, 색은 `array<i32, 3>`으로 가중한 `array<vec3, 3>` 구간값에서 옵니다.](https://typeshade.dev/ko/playground/#example=array-literal-ramp)
- [배열의 메서드 `array<Light, 3>`의 조명 세 개를 TypeScript 개발자가 흔히 쓰는 배열 메서드로 셰이딩합니다.](https://typeshade.dev/ko/playground/#example=array-methods)
- [원자적 히스토그램 여러 인보케이션이 `atomicAdd(bins[bin], 1)`로 같은 칸에 동시에 값을 더합니다. 한 번의 호출은 쪼갤 수 없는 한 걸음이고, 스토리지 구조체의 필드와 `storage<atomic<u32>>` 선언이 위치를 적는 나머지 두 가지 모양을 보여 주며, 원자 연산이 돌려주는 값은 더하기 전에 들어 있던 값입니다.](https://typeshade.dev/ko/playground/#example=atomic-histogram)
- [위치만 돌려주는 버텍스 가장 작은 렌더 쌍입니다.](https://typeshade.dev/ko/playground/#example=bare-position)
- [내장 함수 한 바퀴 `reflect`, `refract`, `faceForward`가 범프에 빛을 주고, `transpose`와 `determinant`가 호스트 행렬을 읽으며, 비트 내장 함수(`firstLeadingBit`, `reverseBits`, `countOneBits`, `extractBits`, `insertBits`)가 화면에 띠를 만듭니다. 띠가 시작하는 자리는 `fwidthCoarse`가 표시합니다.](https://typeshade.dev/ko/playground/#example=bit-bump)
- [비트 필드 띠 전체 화면 삼각형의 색을 `switch`로 고릅니다. 띠 번호는 `&=`, `|=`, `<<=`, `>>=`, `^=`로 만들고, `let x: f32`는 값을 넣기 전에 먼저 선언하며, varying은 `{ pos, uv }` 축약형으로 돌려줍니다.](https://typeshade.dev/ko/playground/#example=bitfield-bands)
- [블록 스코프 `i`를 도는 반복문 둘이 이어지고, 반복문 본문의 `p` 옆에 `if` 분기의 `p`가 있으며, 안쪽 `p`가 바깥쪽을 가립니다.](https://typeshade.dev/ko/playground/#example=block-scope)
- [불 벡터 벡터 둘을 비교하면 결과는 불 벡터입니다.](https://typeshade.dev/ko/playground/#example=bool-select)
- [빌더 체인, 접근자의 super, 서브클래스가 물려받는 정적 멤버 `return this`를 반환하는 메서드로 같은 객체의 빌더 체인을 이어 가며, `new`로 시작한 체인은 결과를 임시 변수에 담습니다.](https://typeshade.dev/ko/playground/#example=class-builder)
- [객체 안의 객체, 객체를 담은 const, 함수를 담은 필드, 계약으로서의 인터페이스 `ring.advance(dt)`는 자신이 담은 `Mover`의 `step`을 부르며, 변경되는 객체를 참조로 전달합니다.](https://typeshade.dev/ko/playground/#example=class-parts)
- [게터, 세터, 비공개 이름, 매개변수 프로퍼티 TypeScript 클래스를 쓰는 방식 그대로 작성한 `class Ring`입니다.](https://typeshade.dev/ko/playground/#example=class-syntax)
- [사용자 클립 평면 `builtin<"clip_distances", ...>`로 사용자 클립 평면 네 개를 둡니다. 래스터라이저가 래스터화하기 전에 읽는 버텍스 출력입니다.](https://typeshade.dev/ko/playground/#example=clip-planes)
- [주변 변수를 읽고 쓰는 로컬 함수 `ring`은 TypeScript 클로저처럼 프래그먼트 진입점의 `p`와 `width`를 읽고 그 `glow`에 더합니다.](https://typeshade.dev/ko/playground/#example=closures)
- [컴퓨트 리덕션 @workgroup\_size를 지정한 컴퓨트 커널입니다. 입력 스토리지 버퍼의 한 구간을 reduce()로 접어 출력 원소 하나로 만듭니다.](https://typeshade.dev/ko/playground/#example=compute-reduction-twin)
- [비교 후 교환, 유니폼 로드, 텍스처 배리어 비교 후 교환, 워크그룹 균일 로드, 텍스처 배리어를 보여 주는 예제입니다.](https://typeshade.dev/ko/playground/#example=compute-sync)
- [변환하는 생성자 전체 화면 삼각형의 꼭짓점은 `vec2(vec2u(...))`에서 오고, 색은 `f32`에서 `u32`로 갔다가 다시 `f32`로 돌아오는 왕복에서 옵니다.](https://typeshade.dev/ko/playground/#example=convert-grid)
- [WGSL에만 있는 텍스처 색상 램프는 `texture_1d<f32>`, 환경 맵 둘은 레이어로 고르는 `texture_cube_array<f32>`입니다. `textureGatherCompare`로 퍼센티지 클로저 필터를 손으로 짜고, `textureGather`로 텍셀 네 개에서 채널 하나를 모으며, 점광원의 그림자는 `texture_depth_cube_array`입니다.](https://typeshade.dev/ko/playground/#example=cube-array-gather)
- [큐브와 3D 텍스처, 바이어스와 그레이디언트 환경 맵은 방향으로 찾는 `texture_cube<f32>`, 컬러 그레이딩 표는 셰이딩한 색으로 색인하는 `texture_3d<f32>`입니다. `textureSampleBias`와 `textureSampleGrad`를 쓰고, 점광원의 그림자는 광원에서 나가는 방향으로 비교하는 `texture_depth_cube`입니다.](https://typeshade.dev/ko/playground/#example=cube-env)
- [컷아웃 (소스 언어) 프래그먼트 진입점이 부르는 헬퍼 안에서 `discard`를 씁니다. `fwidth`가 테두리를 부드럽게 하고, `saturate`, `exp2`, `**`가 감쇠 곡선을 만듭니다.](https://typeshade.dev/ko/playground/#example=cutout)
- [매개변수 기본값 매개변수에 기본값을 둔 헬퍼 셋입니다. 호출마다 생략하는 인자가 다릅니다.](https://typeshade.dev/ko/playground/#example=default-args)
- [피드백 궤적 궤적을 남기는 점입니다.](https://typeshade.dev/ko/playground/#example=feedback-trail)
- [단형화로 만드는 제네릭 클래스 `class Slot<T>`를 f32와 vec3에 사용합니다. 모듈에는 `Slot_f32`와 `Slot_vec3`가 서로 다른 구조체로 생성되며, 각 구조체에 생성자와 모든 메서드가 따로 생성됩니다.](https://typeshade.dev/ko/playground/#example=generic-class)
- [단형화로 만드는 제네릭 제네릭 헬퍼 셋입니다. 파일이 부를 때 쓴 인자 타입 조합마다 한 번씩 컴파일됩니다.](https://typeshade.dev/ko/playground/#example=generic-helpers)
- [GPU에서 온 콘솔 출력 컴퓨트 커널 안에서 `console.log("i =", gid.x, p)`를 부릅니다. 문자열 리터럴은 라벨이 되고, 크기가 정해진 값은 무엇이든 인자로 넘길 수 있습니다.](https://typeshade.dev/ko/playground/#example=gpu-console)
- [그레이디언트 패스 섞는 비율을 조절할 수 있는 세로 방향 두 색 그러데이션.](https://typeshade.dev/ko/playground/#example=gradient-twin)
- [헬로 삼각형 가장 작은 완전한 TypeShade 프로그램입니다.](https://typeshade.dev/ko/playground/#example=hello)
- [진입점 없음 헬로 카메라 유니폼 `mat4`와 `vec3`를 담은 `Camera` 클래스를 `uniform<Camera>` 뒤에 두고, 평범한 헬퍼 함수가 읽습니다.](https://typeshade.dev/ko/playground/#example=hello-camera)
- [헬로 유니폼 단독으로 선언한 `declare const scale: uniform<f32>`는 두 타깃에서 같은 숫자 호스트 값을 유지합니다.](https://typeshade.dev/ko/playground/#example=hello-uniform)
- [헬로 유니폼 블록 `uniform<T>` 뒤에 `Uniforms` 클래스를 두면 두 타깃 모두에서 여러 값을 std140 블록 하나로 묶습니다.](https://typeshade.dev/ko/playground/#example=hello-uniform-struct)
- [헬로 버텍스 속성 `vertex_index` 대신 버퍼에서 버텍스 입력을 받습니다.](https://typeshade.dev/ko/playground/#example=hello-vsin)
- [헬로 varying 삼각형을 다시 그리되, 이번에는 버텍스 스테이지에서 프래그먼트 스테이지로 `uv` varying을 넘깁니다. 두 스테이지가 `VsOut` 클래스 하나를 함께 씁니다.](https://typeshade.dev/ko/playground/#example=hello-vsout)
- [함수를 받는 함수 `cover`와 `around4`는 거리 필드 함수를 인자로 받고, 호출에서 넘긴 함수마다 별도 코드로 컴파일됩니다.](https://typeshade.dev/ko/playground/#example=higher-order)
- [정수 varying과 고를 수 없는 보간 WGSL 방식의 진입점 입출력입니다.](https://typeshade.dev/ko/playground/#example=id-pick)
- [가져온 노이즈 다른 셰이더 파일의 `fbm`으로 구름을 그립니다.](https://typeshade.dev/ko/playground/#example=imported-noise)
- [본문이 정하는 반환 타입 함수마다 반환 타입을 생략하고, TypeShade가 본문에서 반환하는 값으로 타입을 추론합니다.](https://typeshade.dev/ko/playground/#example=inferred-returns)
- [정수 abs와 dot GLSL ES 3.00에 해당 입력 타입의 오버로드가 없는 정수 `abs`와 `dot`입니다.](https://typeshade.dev/ko/playground/#example=integer-math)
- [모듈과 host.ts 커널 함수 안의 배열 메서드 `sumOfSquares`, `scale`, `firstAbove`는 배열 메서드로 커널 데이터를 줄이고, 쓰고, 검색합니다.](https://typeshade.dev/ko/playground/#example=kernel-array-methods)
- [진입점 없음 이미지를 쓰는 커널 `invert`는 커널 반복문에서 `texture_2d<f32>`를 읽고 결과를 `texture_storage_2d`에 씁니다.](https://typeshade.dev/ko/playground/#example=kernel-image-invert)
- [모듈과 host.ts push로 덧붙이는 커널 `strong`은 `out.push(i)`로 문턱값보다 큰 각 원소의 인덱스를 덧붙입니다.](https://typeshade.dev/ko/playground/#example=kernel-push)
- [모듈과 host.ts Set에 고유한 라벨을 모으는 커널 `labels`는 영이 아닌 픽셀의 라벨을 `Set<u32>`에 모으고, `latest`는 `Map<u32, f32>`에서 키마다 마지막 값을 유지합니다.](https://typeshade.dev/ko/playground/#example=kernel-set-unique)
- [모듈과 host.ts 커널로 도는 루프 런타임 크기의 출력 배열에서 각 원소를 처리하는 지형 커널입니다.](https://typeshade.dev/ko/playground/#example=loop-kernel)
- [진입점 없음 CPU에서 도는 루프 반복이 서로 독립인지 보는 증명이 거부하는 루프를 규칙마다(R1부터 R6까지) 하나씩 둡니다.](https://typeshade.dev/ko/playground/#example=loop-on-cpu)
- [모듈과 host.ts 루프 안의 리덕션 배열을 도는 루프로 합, 평균과 분산, 히스토그램을 구합니다.](https://typeshade.dev/ko/playground/#example=loop-reduction)
- [진입점 없음 구조체 배열을 도는 루프 파티클 한 걸음을 `array<Particle>`을 도는 루프로 씁니다.](https://typeshade.dev/ko/playground/#example=loop-struct-array)
- [데이터를 도는 루프 데이터를 다루는 프로그램이 쓰는 세 가지 루프를 Tint와 실제 WebGL2 컨텍스트로 확인합니다.](https://typeshade.dev/ko/playground/#example=loops-over-data)
- [믹스인 패턴 본문이 `return class extends Base { ... }` 하나뿐인 `function Tinted(Base)`를 서로 다른 도형 클래스 둘에 적용합니다.](https://typeshade.dev/ko/playground/#example=mixin-surface)
- [모듈 상수 컴파일러가 허용하는 모든 스칼라 타입으로 모듈 범위 상수를 하나씩 선언합니다.](https://typeshade.dev/ko/playground/#example=module-const)
- [직접 리졸브하는 멀티샘플 텍스처 MSAA 렌더 타깃을 `texture_multisampled_2d<f32>`로 두고 `textureLoad(t, coords, sampleIndex)`로 샘플을 하나씩 읽어 `textureNumSamples`만큼 평균을 구합니다. 깊이 어태치먼트는 `texture_depth_multisampled_2d`입니다.](https://typeshade.dev/ko/playground/#example=msaa-resolve)
- [mat4 너머의 행렬 법선 행렬에 `mat3`를 쓰고, 행렬 자르기와 전치, 곱셈을 보여 줍니다.](https://typeshade.dev/ko/playground/#example=normal-matrix)
- [null, undefined와 실제 값 Nullable 클래스와 멤버는 optional chaining을 거쳐도 세 상태를 유지합니다. 왼쪽 영역은 객체가 없고(undefined), 가운데는 null 멤버이며, 오른쪽에는 실제 값이 있습니다. 엄격한 비교로 각각 빨강, 초록, 파랑을 표시합니다.](https://typeshade.dev/ko/playground/#example=null-values)
- [없을 수도 있는 필드, 요소, 매개변수 구조체 필드, 배열 요소, 매개변수가 `T | undefined`를 가집니다(§76, 변경 0093).](https://typeshade.dev/ko/playground/#example=optional-fields)
- [없을 수도 있는 값: T | undefined 함수, 지역 변수, 콜백이 `T | undefined`를 가지며, 컴파일러는 값이 있는지를 함께 전달합니다.](https://typeshade.dev/ko/playground/#example=optional-values)
- [자기 객체를 바꾸는 메서드 `class Body`의 `step`, `turn`, `advance`가 `this`에 값을 넣으므로, 각 메서드는 자기 객체를 참조로 받습니다.](https://typeshade.dev/ko/playground/#example=orbit-inout)
- [패킹된 4x8 정수 내장 함수 `u32` 하나를 바이트 네 개로 읽거나 네 개를 다시 써 넣는 내장 함수 여덟 개입니다.](https://typeshade.dev/ko/playground/#example=packed-bytes)
- [패킹, bitcast, 생성자 TypeShade 셰이더에서 쓰는 패킹, 비트캐스트, 생성자 연산 예제입니다.](https://typeshade.dev/ko/playground/#example=packing-bitcast)
- [모듈의 벡터 상수와 배열 상수 전체 화면 삼각형을 모듈 범위의 `array<vec4, 3>` 팔레트와 `array<f32, 3>` 구간값으로 띠 지어 칠하고, 앞서 선언한 스칼라 상수로 만든 `vec3` 상수도 함께 씁니다.](https://typeshade.dev/ko/playground/#example=palette-const)
- [객체를 바꾸는 메서드들 `class Particle`의 `step`, `bounce`, `tick`이 `this`에 값을 넣고, 스토리지 요소 위에서 호출됩니다.](https://typeshade.dev/ko/playground/#example=particle-step)
- [구조체와 배열을 고르는 조건식 분기 둘은 구조체, 다른 둘은 고정 길이 배열이고, 실행 중에 고릅니다.](https://typeshade.dev/ko/playground/#example=pick-composite)
- [인보케이션별 상태 최상위의 평범한 `let seed: u32`는 WGSL의 `var<private>`입니다. 인보케이션마다 복사본이 하나씩 있고, 그 인보케이션의 모든 함수가 함께 씁니다.](https://typeshade.dev/ko/playground/#example=private-state)
- [클래스 메서드 생성자와 메서드 하나, 정적 함수 하나를 둔 `class Ray`, 그리고 `hit(ray)` 메서드가 광선을 따라간 거리를 돌려주는 `class Sphere`입니다.](https://typeshade.dev/ko/playground/#example=ray-class)
- [객체는 JavaScript와 같은 방식으로 전달됩니다 함수가 매개변수의 필드나 원소에 쓰면 호출한 쪽의 객체가 바뀌며, 매개변수에도 호출에도 아무 표시가 붙지 않습니다.](https://typeshade.dev/ko/playground/#example=reference-parameters)
- [자기 객체를 바꾸고 값을 돌려주는 메서드 `next()`가 생성기의 상태를 앞으로 옮기고 뽑은 값을 돌려주는 `class Rng`입니다.](https://typeshade.dev/ko/playground/#example=rng-method)
- [분기 안의 샘플링, 그리고 컴파일러의 재작성 WGSL은 `textureSample`을 균일한 제어 흐름에서만 부르게 합니다.](https://typeshade.dev/ko/playground/#example=sample-branch)
- [두 패스로 나눈 블러 두 패스로 나눈 블러입니다.](https://typeshade.dev/ko/playground/#example=separable-blur)
- [비교로 읽는 그림자 맵 `sampler_comparison`을 거쳐 깊이 텍스처를 `textureSampleCompare`와 `textureSampleCompareLevel`로 읽습니다. 평범한 2D 그림자 맵과 캐스케이드 배열 양쪽에서 씁니다.](https://typeshade.dev/ko/playground/#example=shadow-compare)
- [상속 구체 메서드 하나와 추상 메서드 하나를 둔 `abstract class Shape`, 이를 상속한 클래스 둘, 그리고 그 하위 클래스를 다시 상속해 `super`를 부르는 클래스 하나입니다.](https://typeshade.dev/ko/playground/#example=shape-inheritance)
- [스토리지 텍스처 컴퓨트 진입점이 텍셀 좌표로 직접 쓰는 이미지입니다. 샘플러도 필터링도 없습니다.](https://typeshade.dev/ko/playground/#example=storage-texture)
- [원자 연산 앞의 서브그룹 리덕션 `subgroupAdd`가 서브그룹의 값을 명령 하나로 접고, `subgroupElect`가 고른 레인 하나가 그 합을 `atomicAdd`로 칸에 더합니다.](https://typeshade.dev/ko/playground/#example=subgroup-reduce)
- [텍스처, 샘플러, 오버라이드 전체 화면 삼각형이 `sampler`를 거쳐 `texture_2d<f32>`를 샘플링하고, `override<f32>` 특수화 상수 두 개로 색을 입힙니다.](https://typeshade.dev/ko/playground/#example=textured-quad)
- [튜플과 브랜드 별칭 튜플은 타입이 길이를 정해 둔 목록이고 `array<T, N>`이 바로 그것이므로, `[f32, f32]`는 곧 `array<f32, 2>`입니다.](https://typeshade.dev/ko/playground/#example=tuple-and-brand)
- [같은 IO 구조체 둘 필드가 똑같은 IO 구조체 둘, 곧 버텍스 출력과 프래그먼트 입력입니다. 객체 리터럴이 어느 쪽을 만드는지는 리터럴이 놓인 세 자리가 각각 정합니다.](https://typeshade.dev/ko/playground/#example=twin-structs)
- [목록을 담은 유니폼 `array<f32, 4>`를 담은 `uniform`입니다.](https://typeshade.dev/ko/playground/#example=uniform-array)
- [입력 크기에 맞춘 워크그룹 `override<u32>` 하나가 컴퓨트 진입점의 워크그룹 크기와 공유 스크래치 배열의 바깥쪽 길이를 정합니다.](https://typeshade.dev/ko/playground/#example=workgroup-override)
- [워크그룹 리덕션 인보케이션 64개가 값 64개를 워크그룹 메모리로 하나에 모읍니다. `workgroupBarrier()`가 라운드 순서를 잡습니다.](https://typeshade.dev/ko/playground/#example=workgroup-reduce)
- [워크그룹 스크래치 메모리 `let tile: workgroup<array<f32, 64>>`는 WGSL의 `var<workgroup>`입니다. 워크그룹마다 복사본이 하나씩 있어 그 안의 인보케이션들이 함께 쓰며, 여기서는 인보케이션이 한 칸씩 차지하는 스크래치로 씁니다. 원자적 값의 워크그룹 배열과 인보케이션별 카운터도 함께 둡니다.](https://typeshade.dev/ko/playground/#example=workgroup-scratch)
- [이차원 워크그룹 `@compute([8, 8])`은 WGSL의 `@workgroup_size(8, 8)`입니다.](https://typeshade.dev/ko/playground/#example=workgroup-tile-2d)

### 호스트 예제

- [모듈과 host.ts 캔버스에 그리기 전체 화면 `@fragment` 진입점과 이를 그리는 호스트입니다.](https://typeshade.dev/ko/playground/#example=host-draw)
- [모듈과 host.ts 컴퓨트 진입점 디스패치 `@compute(...)` 진입점과 호스트입니다.](https://typeshade.dev/ko/playground/#example=host-compute)
- [모듈과 host.ts 커널 함수 호출 커널 함수 두 개와 이를 부르는 호스트입니다.](https://typeshade.dev/ko/playground/#example=host-kernel)
- [모듈과 host.ts 데이터를 GPU에 두기 커널 함수 세 개와, 이를 `array()`가 만드는 `Buffer` 위에서 이어 부르는 호스트입니다.](https://typeshade.dev/ko/playground/#example=host-resident)
- [모듈과 host.ts CPU와 GPU가 함께 쓰는 헬퍼 프래그먼트 진입점이 GPU에서 그리고 호스트가 CPU에서 부르는 지형 함수 `height`입니다.](https://typeshade.dev/ko/playground/#example=host-helper)
- [모듈과 host.ts 문자열 키와 Record 정해진 채널 이름의 집합은 `u32` id가 되고, `Record`는 id 순서의 배열이 됩니다.](https://typeshade.dev/ko/playground/#example=string-keys-record)
- [모듈과 host.ts 컴파일된 프로그램 실행 버텍스 진입점과 프래그먼트 진입점, 그리고 엔진처럼 이를 실행하는 호스트입니다.](https://typeshade.dev/ko/playground/#example=host-program)
- [모듈과 host.ts 커널 호출 체인 합치기 커널 함수 다섯 개와, `typeshade/fuse`의 `fuse()` 안에서 이를 부르는 호스트입니다.](https://typeshade.dev/ko/playground/#example=loop-fuse)
- [모듈과 host.ts Set과 Map에 모으기 JavaScript의 `Set`과 `Map`을 받는 커널 함수 네 개와 이를 호출하는 호스트입니다.](https://typeshade.dev/ko/playground/#example=host-set-unique)

**hello.shade.ts**

가장 작은 그리기 프로그램입니다. 프래그먼트 진입점 하나가 모든 픽셀에 색 하나를 돌려줍니다.

`TS`

진단 컴파일 대기 중

프로그램을 불러오는 중…

버텍스 진입점과 프래그먼트 진입점이 있는 모듈을 컴파일하면 그려집니다.
