Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Freshen' up "tgpu-gen" guide (#820) #825

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions apps/typegpu-docs/src/content/docs/tooling/tgpu-gen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ description: A guide on how to use the TypeGPU Generator CLI
import { FileTree } from '@astrojs/starlight/components';
import FileDiff from '../../../components/FileDiff.astro';

TypeGPU Generator (tgpu-gen) is a command-line interface for the TypeGPU code generator.
It provides a way for a highly automated migration process and is a great tool
for existing WebGPU projects that want to start taking advantage of type-safe TypeGPU features.
TypeGPU Generator (tgpu-gen) is a CLI companion tool that transforms WGSL code files into
matching TypeGPU definitions. It can be used for integrating TypeGPU into established WebGPU projects, or automating the migration process.

## Installation
- ✨ Generate TypeGPU definitions from WGSL shaders
- 👀 Continuously watch for changes in WGSL files and update the generated definitions
- 🌲 Specify input and output using glob patterns
- 🎯 Choose the output extension and CJS or ESM format

Using npm:
## Installation

You can use it directly through `npx`:
```bash
npx tgpu-gen path/to/shader.wgsl
```
Or install it globally:
```bash
npm install -g tgpu-gen
tgpu-gen path/to/shader.wgsl
```

## Feature overview

- Generate TypeGPU definitions from WGSL shaders
- Continuously watch for changes in WGSL files and update the generated definitions
- Specify input and output using glob patterns
- Choose the output extension and CommonJS or ES module format

## Example

Let's assume the following directory structure:
Expand Down