# software-mansion/typegpu

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/software-mansion-typegpu).**

2,564 stars · 71 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/software-mansion/TypeGPU
- Homepage: http://typegpu.com
- awesome-repositories: https://awesome-repositories.com/repository/software-mansion-typegpu.md

## Topics

`gpgpu` `gpu` `gpu-computing` `gpu-programming` `graphics` `javascript` `typesafe` `typescript` `webgpu` `webgpu-api` `wgsl` `wgsl-shader`

## Description

TypeGPU is a tool for type-safe WebGPU development that enables writing shaders in TypeScript. It translates high-level TypeScript function definitions and structures into WebGPU Shading Language source code to automate shader generation and validate logic using a type system.

The project provides a mechanism for cross-library GPU interoperability by sharing typed buffers without copying data to system memory. It also integrates the Model Context Protocol to allow AI agents to inspect generated shader code and diagnose runtime errors.

The system manages WebGPU resource mapping through typed layouts for bind groups and uses schema-based binary encoding to handle memory alignment and buffer sizes. It further supports the definition of GPU data types to ensure consistent data transfer between the processor and the graphics unit.

## Tags

### Graphics & Multimedia

- [Type-Safe Shader Generation](https://awesome-repositories.com/f/graphics-multimedia/type-safe-shader-generation.md) — Translates high-level TypeScript function definitions into WebGPU Shading Language source code to automate shader generation.
- [GPU Bind Group Mappings](https://awesome-repositories.com/f/graphics-multimedia/gpu-bind-group-mappings.md) — Provides automatic mapping of resource keys to GPU binding indices and validates resource types during pipeline setup.
- [GPU Resource Management](https://awesome-repositories.com/f/graphics-multimedia/gpu-resource-management.md) — Manages the mapping of buffers and bind groups between TypeScript and the GPU to ensure data alignment and consistency.
- [Function-to-Shader Transpilers](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/graphics-apis-bindings/shader-transpilation-tools/function-to-shader-transpilers.md) — Translates typed TypeScript functions into valid WGSL strings to execute logic on the GPU. ([source](https://cdn.jsdelivr.net/gh/software-mansion/typegpu@main/README.md))
- [Type-Safe Shader Generation](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/graphics-apis-bindings/shader-transpilation-tools/function-to-shader-transpilers/type-safe-shader-generation.md) — Transforms typed functions into shader code to validate logic using a high-level type system. ([source](https://cdn.jsdelivr.net/gh/software-mansion/typegpu@main/README.md))
- [Shader Resource Binders](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/shaders/shader-resource-binders.md) — Produces shader code from typed structures to keep resource definitions consistent via defined layouts. ([source](https://docs.swmansion.com/TypeGPU/integration/webgpu-interoperability/))
- [Typed Bind Group Management](https://awesome-repositories.com/f/graphics-multimedia/typed-bind-group-management.md) — Maps hardware resources to named keys to handle binding indices and validate resource types automatically. ([source](https://docs.swmansion.com/TypeGPU/integration/webgpu-interoperability/))

### Programming Languages & Runtimes

- [TypeScript-to-WGSL Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/typescript-to-wgsl-compilers.md) — Translates high-level TypeScript function definitions into WebGPU Shading Language source code.

### Data & Databases

- [GPU Memory Alignment Encoders](https://awesome-repositories.com/f/data-databases/complex-data-types/composite-type-encoders/custom-binary-type-encoders/gpu-memory-alignment-encoders.md) — Translates complex data structures into typed binary formats to ensure correct memory alignment during CPU-to-GPU transfer.
- [GPU Buffer Allocators](https://awesome-repositories.com/f/data-databases/data-buffering/gpu-buffer-allocators.md) — Enforces typed read/write operations by calculating memory sizes and binary padding for GPU buffers. ([source](https://docs.swmansion.com/TypeGPU/integration/webgpu-interoperability/))
- [User-Defined Types](https://awesome-repositories.com/f/data-databases/data-structure-definitions/user-defined-types.md) — Defines custom GPU data structures and arrays to ensure data matches the expected schema. ([source](https://docs.swmansion.com/TypeGPU))
- [Schema-Based Binary Formats](https://awesome-repositories.com/f/data-databases/schema-based-binary-formats.md) — Converts complex data structures into typed binary formats using defined layouts to ensure correct GPU memory alignment.
- [Zero-Copy GPU Buffer Interop](https://awesome-repositories.com/f/data-databases/shared-memory-buffers/zero-copy-gpu-buffer-interop.md) — Shares typed GPU buffers between libraries without copying data to system memory for high performance.
- [Native Type Mappings](https://awesome-repositories.com/f/data-databases/type-mapping-frameworks/script-to-native-type-mappings/native-type-mappings.md) — Links raw hardware resources to typed interfaces to retrieve and manage underlying native handles. ([source](https://docs.swmansion.com/TypeGPU/integration/webgpu-interoperability/))

### Networking & Communication

- [GPU Buffer Sharing Allocations](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/inter-process-communication/shared-memory-ipc/gpu-buffer-sharing-allocations.md) — Passes typed GPU buffers between libraries without copying data to system memory for interoperability. ([source](https://cdn.jsdelivr.net/gh/software-mansion/typegpu@main/README.md))

### Operating Systems & Systems Programming

- [GPU Memory Layout Definitions](https://awesome-repositories.com/f/operating-systems-systems-programming/gpu-memory-layout-definitions.md) — Calculates buffer sizes and applies binary padding based on TypeScript definitions to meet strict GPU memory requirements.
- [Resource Handle Mapping](https://awesome-repositories.com/f/operating-systems-systems-programming/resource-handle-mapping.md) — Links native GPU resource handles to typed API wrappers to maintain type safety during resource management.

### Software Engineering & Architecture

- [Data Encoders and Decoders](https://awesome-repositories.com/f/software-engineering-architecture/data-encoders-and-decoders.md) — Translates complex TypeScript data structures into typed binary formats for efficient CPU-to-GPU transfer. ([source](https://docs.swmansion.com/TypeGPU))

### Artificial Intelligence & ML

- [Model Context Protocol Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-assistant-integrations/model-context-protocol-integrations.md) — Implements the Model Context Protocol to expose generated shader code and diagnostics to AI agents.
- [AI-Powered Shader Debugging](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-debugging-assistants/ai-powered-shader-debugging.md) — Uses the Model Context Protocol to let AI agents inspect generated shader code and diagnose GPU runtime errors.

### Development Tools & Productivity

- [AI Assistant Integrations](https://awesome-repositories.com/f/development-tools-productivity/ai-assistant-integrations.md) — Connects AI coding assistants to the development environment to inspect generated shader code. ([source](https://docs.swmansion.com/TypeGPU/getting-started/))

### DevOps & Infrastructure

- [Zero-Copy Buffer Interoperability](https://awesome-repositories.com/f/devops-infrastructure/gpu-acceleration-libraries/zero-copy-buffer-interoperability.md) — Provides a mechanism for sharing typed GPU buffers between libraries without copying data to system memory.
