Skip to content

Commit 2604018

Browse files
authored
Merge pull request #3 from googlefonts/piet
Very basic compute shader wired up
2 parents dd524b5 + 85fcf94 commit 2604018

File tree

14 files changed

+1377
-3
lines changed

14 files changed

+1377
-3
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
target
2-
Cargo.lock
2+
.ninja_deps
3+
.ninja_log
4+

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ The second subdirectory is a simple GUI application that runs a compute shader a
1818

1919
Recommended activity: find an existing shadertoy that implements some interesting algorithm or visual effect, and port it to run in a compute shader. Is there some limitation of the original that could be improved by compute capabilities?
2020

21+
A great place to find shaders to adapt is [The Book of Shaders].
22+
2123
## A note on the choice of runtime
2224

2325
Your compute shader code cannot run on its own, but rather needs a *runtime* to connect to the GPU, set up resources such as buffers and compiled shader code, and manage the submission of that work to the GPU. There is, as of this writing, no standard runtime for such things, but I hope that will change in time.
@@ -66,3 +68,4 @@ Licensed under either of
6668
[Cg]: https://www.khronos.org/opengl/wiki/Cg
6769
[rust-gpu]: https://github.com/EmbarkStudios/rust-gpu
6870
[IREE]: https://google.github.io/iree/
71+
[The Book of Shaders]: https://thebookofshaders.com/

compute-shader-toy/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "compute-shader-toy"
33
version = "0.1.0"
44
authors = ["Raph Levien <raph@google.com>"]
55
license = "MIT/Apache-2.0"
6+
description = "A simple compute shader example that draws in a window, based on wgpu."
67
edition = "2018"
78

89
[dependencies]

compute-shader-toy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//
1515
// Also licensed under MIT license, at your choice.
1616

17-
//! A simple
17+
//! A simple compute shader example that draws into a window, based on wgpu.
1818
1919
use wgpu::util::DeviceExt;
2020
use wgpu::{BufferUsage, Extent3d};

docs/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ One barrier to learning and talking about GPU compute is the bewildering termino
88
* [WebGPU](https://github.com/gpuweb/gpuweb) - [WebGPU shading language](https://gpuweb.github.io/gpuweb/wgsl/)
99
* [CUDA](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html)
1010

11-
My choice of 5 API's is somewhat opinionated, and future-leaning. I've left off OpenGL and OpenCL because they appear to be stagnating. Even though my main focus is writing compute shaders, because I'm interested in portability, I'm also including CUDA because it's by far the best developed API for writing GPU compute, and one that will no doubt be familiar to mamy readers.
11+
My choice of 5 API's is somewhat opinionated, and future-leaning. I've left off OpenGL and OpenCL because they appear to be stagnating. Even though my main focus is writing compute shaders, because I'm interested in portability, I'm also including CUDA because it's by far the best developed API for writing GPU compute, and one that will no doubt be familiar to many readers.
1212

1313
I'm including WebGPU because I feel it has potential to become a common, widely implemented standard, on which it's possible to build a rich infrastructure of tools, libraries, and applications. The people working on WebGPU are doing a lot of deep thinking about achieving portability, performance, and security on GPU, and these discussions are openly available.
1414

0 commit comments

Comments
 (0)