Sursface
Sursface is a small cross-platform rendering library designed to simplify the development of WebGPU applications, without compromising developer control.
It builds upon well-established APIs (wgpu and winit) to wrap over the core lifecycle operations of a graphical app, while re-exposing the full capabilities of these APIs unchanged. Sursface's goal is to enable writing plain WebGPU code with less hassle.
Supported Platforms
- Cross-Platform Desktop: Compile and run on Linux or Windows.
- WASM: Automatically generate JavaScript bindings for the
wasm32-unknownNix target, making your apps trivially embeddable into webpages.
Features
- Ready-made WebGPU Surface: Sursface provides the entrypoint to your graphical app by supplying a platform window configured to be used as a surface by
wgpu. - Event Loop: Sursface abstracts away the specifics of the event loop, whether it's running on desktop or in the browser. You simply need to provide the function pointer to your frame-by-frame logic, and Sursface will regularly call it for you.
- No New Tech: Once the setup is done, keep using
wgpuas ifsursfacewasn't there. - Default Logic (WIP): Sursface will offer opt-in shortcuts for some elementary operations through simple functions, further reducing graphical boilerplate.
Building Sursface
Prerequisites
To compile Sursface, ensure you have the following tools installed: Rust, Cargo, and optionally Nix (recommended).
Installation
Clone the repository:
Building with Cargo
You can compile Sursface on your native platform using Cargo:
Building with Nix
To build a binary inside the Nix store, ready to run locally:
Cross-Compiling with Nix
Sursface supports cross-compilation to various targets. Here are some examples:
Releases
Releases consist of executable binaries of the examples. These are automatically built for each new release, and can be directly downloaded, unzipped, and ran, without any installation process.
Running Examples
Examples can also be run directly with cargo:
For instance: