94 releases (13 breaking)

new 0.15.1 Apr 11, 2024
0.15.0-alpha.5 Mar 29, 2024
0.12.0-alpha.2 Dec 26, 2023
0.11.0 Nov 28, 2023
0.4.0 Mar 28, 2023

#138 in Graphics APIs

Download history 465/week @ 2023-12-21 149/week @ 2023-12-28 1122/week @ 2024-01-04 597/week @ 2024-01-11 419/week @ 2024-01-18 922/week @ 2024-01-25 872/week @ 2024-02-01 795/week @ 2024-02-08 630/week @ 2024-02-15 1078/week @ 2024-02-22 2443/week @ 2024-02-29 838/week @ 2024-03-07 903/week @ 2024-03-14 596/week @ 2024-03-21 909/week @ 2024-03-28 693/week @ 2024-04-04

3,216 downloads per month
Used in 18 crates (13 directly)

MIT/Apache

770KB
14K SLoC

Rust 12K SLoC // 0.1% comments WebGPU Shader Language 1.5K SLoC // 0.2% comments

The Rerun renderer

Part of the rerun family of crates.

Latest version Documentation MIT Apache

A custom wgpu based renderer tailored towards re_viewer's needs. Nevertheless, it can be used standalone and comes with its own examples!

Some key features:

  • Key primitives for visualization like lines and points are first class citizens
  • Built with multiple independent views/cameras in mind
  • WebGL compatible quality tier allows use in the browser without WebGPU support
  • Hot shader reloading
  • … and more to come!

Goals & philosophy:

  • Handle fully dynamic data
    • assumes that most data may change every frame!
  • Automatic resource re-use & caching
  • Lazy loading whenever possible for best startup performance
  • Run great both on the desktop and web
  • No dependencies on re_viewer or rerun data store libraries

Debugging

Shader

Iterating

In debug mode shaders are live-reloaded. If a failure occurs during live-reload, an error is logged and the previous shader is kept.

Inspecting final source

If RERUN_WGSL_SHADER_DUMP_PATH is set, all readily stitched (import resolve) and patched wgsl shaders will be written to the specified directory.

Often you're also interested in the Naga translated shader. This can be done easily from command line using

cargo install naga-cli --all-features

Example for translating a wgsl fragment shader to GL as used on WebGL:

naga ./wgsl_dump/rectangle_fs.wgsl ./wgsl_dump/rectangle_fs.frag --entry-point fs_main --profile es300

Example for translating a wgsl vertex shader to GL as used on WebGL:

naga ./wgsl_dump/rectangle_vs.wgsl ./wgsl_dump/rectangle_vs.vert --entry-point vs_main --profile es300

Note that a single shader entry point from wgsl maps to a single frag/vert file!

Example for translating a wgsl to MSL as used on MacOS. Note that a single metal file maps to a single wgsl file.

naga ./wgsl_dump/rectangle_fs.wgsl ./wgsl_dump/rectangle_fs.metal

Dependencies

~17–55MB
~897K SLoC