Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

shame

> 编程语言
Open source

A fully featured DSL for writing shaders/GPU-pipelines in Rust

322 stars0 likes1 views
WebsiteGitHub

About

A fully featured DSL for writing shaders/GPU-pipelines in Rust

shame

Shader metaprogramming in Rust

A lightweight DSL for writing GPU-pipelines in Rust

shame is designed for use in conjunction with the Metal/Vulkan/WebGPU generation of graphics APIs or wgpu/SDL3 style libraries.

This is a beta release. Please open an issue if you encounter a problem. Join our discord and we will help you get started!

shame eliminates the need for a separate shader language and verbose descriptors, without compromising on functionality, by fully embedding all shader/pipeline features into the Rust type system.

By bridging the gap between CPU and GPU without leaving the Rust type system, shame empowers you to build concise graphics programs with a refreshing level of type safety.

Motivation

Modern graphics APIs often require us filling out descriptors, matching up their contents with other descriptors, and restating the same facts in slightly different syntax many times. Doing this should be a compiler's job, but for the Rust compiler to be able to help us here, we first need to teach it how the GPU works. Unfortunately, most of the interesting information about the GPU's work is locked behind the shader language. To unlock it, we need to turn Rust itself into a shader language, but thats not enough. The real plumbing happens at the interface between CPU and GPU, which includes fixed function pipeline stages, memory layouts and binding types. Each of these has intricate interactions that we want Rust to understand, check, and ideally infer. Thankfully, Rust's features such as ownership, traits and associated types allow us to express most of these interactions cleanly (and some not so cleanly). This leaves us with a thin Rust layer that faithfully models the GPU as Vulkan/Metal/WebGPU sees it, and that lets us write graphics pipelines in a more concise and modular way than ever before.

Getting started

  1. set up an application using the graphics API of your choice (we recommend wgpu)
  2. add shame to your Cargo.toml via
cargo add --git https://github.com/raymarch/shame shame
  1. convert shame's output (shader code and pipeline info) to your graphics API

    A wgpu example of this can be found at examples/shame_wgpu/src/conversion.rs, which is used by the example applications. If you intend on targeting wgpu you can also use the examples/shame_wgpu crate directly. If you target a different API, that example can still be a useful reference.

  2. check out the api overview of shame and have fun writing pipelines in Rust!

Code example (more in examples folder)

(or click here for a more comprehensive overview of the api)

…
Feature Status
WGSL out ✅ supported
Spir-V out ✖️ currently unsupported, use naga to convert WGSL output to Spir-V
render pipeline ✅ supported
compute pipeline ✅ supported
mesh pipeline ✖️ currently unsupported
vertex shaders ✅ supported
fragment shaders ✅ supported
compute shaders ✅ supported
geometry shaders ✖️ unsupported, not planned
tesselation shaders ✖️ unsupported, not planned
mutable state ✅ supported
runtime control flow ✅ supported
memory layout validation ✅ supported
push constants ✅ supported
atomics ✅ supported
writable storage ✅ supported
wave/quad intrinsics ✖️ currently unsupported, work in progress
hot reloading ✅ supported

Panic behavior

shame is intended for use in engine projects where panicking is unaccepable, as it makes the runtime unable to respond to invalid pipelines (e.g. by displaying a fallback error texture). Great effort has been put into making shame never panic. Both internal and API usage errors are communicated via Result::Err. Please open an issue if shame ever panics for you.

note: The example executables in the examples folder may have panics originating from wgpu if async validation errors happen.

Community

We have a discord server where you can ask questions, give feedback, contribute or show your creations! https://discord.gg/Xm5Ck7CCJk

you might also like

  • wgpu: recommended graphics library for use with shame
  • naga: if you want to convert shame's WGSL output to SPIR-V etc.
  • other ways to write shaders in Rust:
    • rust-gpu: Rust as a first-class language and ecosystem for GPU graphics & compute shaders
    • posh: OpenGL ES 3.0/WebGL 2.0 focused shader EDSL + graphics library
    • cubecl: multi-platform high-performance compute language extension for Rust
    • rasen: generates SPIR-V bytecode from an operation graph (+ DSL)
    • shades: a different approach of a shader EDSL in Rust
    • rendiation: Rendiation Rendering Framework

license

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in shame by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust3d-graphicscode-generationmetaprogrammingrust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言