Cross-platform compute shader engine

Overview

wgpu-compute-toy

This is the compute shader engine for https://compute.toys

As well as running on the web via WebAssembly and WebGPU, it can run natively using standard desktop graphics APIs like Vulkan and DirectX.

Native

cargo run examples/davidar/buddhabrot.wgsl

screenshot

Web

Install wasm-pack and run wasm-pack build.

The following command can be used to quickly recompile while the compute.toys server is running:

wasm-pack build --dev && cp -rv pkg/. ../compute.toys/lib/wgputoy/
You might also like...
Cross-platform (including wasm) persistent key value store plugin for rust games/apps

bevy_pkv bevy_pkv is a cross-platform persistent key value store for rust apps. Use it for storing things like settings, save games etc. Currently, it

Cross platform rendering in Rust
Cross platform rendering in Rust

Miniquad Miniquad is a manifestation of a dream in a world where we do not need a deep dependencies tree and thousands lines of code to draw things wi

A cross platform classic RPG game creator written in Rust.
A cross platform classic RPG game creator written in Rust.

Eldiron - Classic RPG Creation Create RPGs for every platform with Eldiron. Eldiron v1 will be able to create games similar to the classic Ultima seri

A safe, fast and cross-platform 2D component-based game framework written in rust

shura shura is a safe, fast and cross-platform 2D component-based game framework written in rust. shura helps you to manage big games with a component

Cross-platform GPU-accelerated viewer for the Mandelbrot set and similar (escape-time) fractals

fractal_viewer A cross-platform, GPU-accelerated viewer for the Mandelbrot Set and related fractals. Try it online! Usage Scroll wheel to zoom, click

A cross-platform image (texture) viewer
A cross-platform image (texture) viewer

img_maniac A cross-platform image (texture) viewer Features Drag and drop images: Users can easily add as many images as they want to the main window

A networked (p2p), cross-platform physics simulation example using rollback netcode

bevy_gaff (work in progress) bevy_gaff is an attempt at making a networked (p2p), cross-platform physics simulation using rollback netcode. It synchro

Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.
Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.

vx_bevy A voxel engine prototype made using the Bevy game engine. Goals and features Very basic worldgen Animated chunk loading (ala cube world) Optim

An interactive, low-boilerplate creative coding platform
An interactive, low-boilerplate creative coding platform

nightgraph A creative coding platform in Rust. Provides drawing APIs, a CLI, Native and WASM GUIs, and low-boilerplate artwork creation. Designed init

Comments
  • Handle updated framebuffer

    Handle updated framebuffer

    I wasn't able to run compute.toy on linux. Linux calls resizing immediately at the start of the program and invalidates current surface.

    With this PR I'm adding support for surface resizing. Out of GPU memory case is not handled. In native I'll just stop the main loop, but I don't know what to do in web (perhaps nothing, because it wasn't handled before either).

    [2023-05-07T17:54:16Z ERROR wgputoy] Unable to get framebuffer: The underlying surface has changed, and therefore the swap chain must be updated
    

    I also changed a bit about how to choose the surface format. I give priority to Rgba8Unorm and Bgra8Unorm formats and store surface config instead of just surface format.

    opened by pudnax 1
  • Update dependencies and run clippy

    Update dependencies and run clippy

    It also removes most of the warnings. From notable things, I changed device and instance creation. Instead of calling Default::default() each field is explicitly assigned to its value.

    Bring this up, because it might be a non-trivial code transformation.

    -                let workgroup_size = cap[1]
    -                    .split(',')
    -                    .map(|s| s.trim().parse().unwrap_or(1))
    -                    .collect::<Vec<u32>>();
    -                let workgroup_size = [
    -                    workgroup_size.get(0).cloned().unwrap_or(1),
    -                    workgroup_size.get(1).cloned().unwrap_or(1),
    -                    workgroup_size.get(2).cloned().unwrap_or(1),
    -                ];
    +                // TODO: Handle error if failed to parse the capture
    +                let mut sizes = cap[1].split(',').map(|s| s.trim().parse().unwrap_or(1));
    +                let workgroup_size: [u32; 3] = std::array::from_fn(|_| sizes.next().unwrap_or(1));
    
    opened by pudnax 0
  • Add matrix type aliases to prelude

    Add matrix type aliases to prelude

    Adds the following type aliases to the prelude.

    alias bool2 = vec2<bool>;
    alias bool3 = vec3<bool>;
    alias bool4 = vec4<bool>;
    alias float2x2 = mat2x2<f32>;
    alias float2x3 = mat2x3<f32>;
    alias float2x4 = mat2x4<f32>;
    alias float3x2 = mat3x2<f32>;
    alias float3x3 = mat3x3<f32>;
    alias float3x4 = mat3x4<f32>;
    alias float4x2 = mat4x2<f32>;
    alias float4x3 = mat4x3<f32>;
    alias float4x4 = mat4x4<f32>;
    

    Since vecN<T> requires T to be a concrete scalar, and matNxM<T> requires T to be a float, this new set of type aliases covers all possible use cases (with the exception of f16).

    The downside is that some shaders already contain a subset of these aliases, meaning some shaders will break and need to be fixed manually. Though this should be a 5-second fix in most cases, and the impact of such a change would be a lot greater further down the line.

    opened by slerpyyy 4
🪄 Shader art using webgpu

✨ Shader art using webgpu ✨ This is the implementation of An introduction to Shader Art Coding in Rust using webgpu. ?? Setup You need: Rust compiler

BADR 7 Aug 29, 2023
A nine slice/patch plugin for bevy ui nodes as single component using a fragment shader.

Bevy nine slice/patch Material Plugin Quick and easy auto-scaling nine slice/patch material for bevy ui nodes implemented as Fragment Shader. Features

Lorenz 13 Dec 14, 2023
Cross-platform game engine in Rust.

Cross-platform game engine in Rust.

Fedor Logachev 1.9k Jan 3, 2023
3d Cellular Automata using WGPU in Rust (for the web and using compute shaders)

3D-Cellular-Automata-WGPU 3d Cellular Automata using WGPU in Rust (for the web and using compute shaders) The branches are very messy... I recommend y

null 18 Dec 18, 2022
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

webview 10.8k Jan 9, 2023
IDE for cross-platform software development

Diversity Space IDE for cross-platform software development | 日本語 | English | Русский | READMEの英語版とロシア語版はDeepl翻訳を使用して翻訳されています Английская и русская вер

latteS 0 Feb 23, 2022
A cross platform (wasm included) networking library!

bootleg_networking A cross platform (wasm included) networking library! A networking plugin for the Bevy game engine that wraps around bevy_networking

William Batista 51 Jan 1, 2023
This is a cross-platform tool to historicize different branches/depots/manifests and generating pseudocode for it to compare different game updates

CSHP This is a cross-platform tool to historicize different branches/depots/manifests and generating pseudocode for it to compare different game updat

raizo 6 Jan 28, 2022
Neutral cross-platform Rust game template

Rust Game Template Neutral cross-platform Rust game template. Build tool This project uses cargo-make task runner. It's required to build the project.

null 0 Feb 5, 2022
A lightweight, cross-platform epub reader.

Pend Pend is a program for reading EPUB files. Check out the web demo! Preview Image(s) Installation Building Pend is simple & easy. You should be abl

bx100 11 Oct 17, 2022