Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
FragmentColor
FragmentColor is a cross-platform GPU programming library that is both easy to use and powerful.
The API encourages a simple shader composition workflow, where you can use WGSL or GLSL shaders as the source of truth for visual consistency across platforms, while avoiding the verbosity of modern GPU APIs.
It has bindings for JavaScript (WASM), Python, and draft support for Swift and Kotlin. It targets each platform's native graphics API: Vulkan, Metal, DirectX, OpenGL, WebGL, and WebGPU. See Platform Support for details.
Check the website for the Getting Started guide and full reference:
- Documentation: https://fragmentcolor.org/welcome
- API Reference: https://fragmentcolor.org/api
[!NOTE]
iOS and Android support is not available yet, but planned for version v0.11.0.
Install
- Rust: add the crate to your Cargo.toml
[]
= "0.10.8"
We also support JavaScript and Python:
- JavaScript users, see: README_JS.md
- Python users, see: README_PY.md
Quick start
Rust
# async
#
Running examples
See the examples project under examples/rust for implementation details.
> ./example
=================================
Documentation & website
- Docs' source of truth lives in
docs/api. The Rust code uses#[lsp_doc]to pull these docs into editor hovers. - The website lives under
docs/websiteand is automatically generated fromdocs/apiat build time. - Method pages include JavaScript and Python examples extracted from the healthcheck scripts.
For contribution guidelines and the release process, see CONTRIBUTING.md.
Platform support
Platform support is aligned with upstream wgpu:
| API | Windows | Linux/Android | macOS/iOS | Web (wasm) |
|---|---|---|---|---|
| Vulkan | ✅ | ✅ | 🌋 | |
| Metal | ✅ | |||
| DX12 | ✅ | |||
| OpenGL | 🆗 (GL 3.3+) | 🆗 (GL ES 3.0+) | 📐 | 🆗 (WebGL2) |
| WebGPU | ✅ |
✅ = First Class Support
🆗 = Downlevel/Best Effort Support
📐 = Requires the ANGLE translation layer (GL ES 3.0 only)
🌋 = Requires the MoltenVK translation layer
Limitations (planned features)
- Swift & Kotlin bindings are not supported yet, but planned for version v0.11.0.
Common workflows
Rust core
# Build
# Test (all)
# Lint & Format
# Healthcheck (all platforms)
# Filtered Healthcheck
Web (WASM)
# Build WASM package (wasm-pack target web) and sync into local JS examples
# Run JS demos (Vite dev server) and open browser
# Manual alternative
Python binding (local dev)
# Quick run helper: build wheel into dist/, create venv, and run an example
# Manual alternative
Docs site (Astro/Starlight)
- Docs source of truth lives in docs/api and is referenced from code via
#[lsp_doc]. - Examples on method pages are sliced from the healthcheck scripts; no filesystem reads in docs.
- Doc examples follow async + pollster patterns.
# or