This repository has been archived by the owner on Jun 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When looking into wgpu-rs as a replacement for WebGL I went to the examples directory on GitHub to browse for a bit. I wanted to see some of the examples at a glance without needing to clone the repository. This commit enables that by adding a README to each example with a description of the example and screenshots / example output. In a few cases the description is a bit redundant - but my hope is that in the future we can improve all the READMEs. Being a web API and thus very accessible, WebGPU could end up being many people's first introduction to graphics programming so the lower we make the barrier the better.
- Loading branch information
Showing
20 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# boids | ||
|
||
Flocking boids example with gpu compute update pass | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example boids | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# capture | ||
|
||
This example shows how to capture an image by rendering it to a texture, copying the texture to | ||
a buffer, and retrieving it from the buffer. | ||
|
||
This could be used for "taking a screenshot," with the added benefit that this method doesn't | ||
require a window to be created. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example capture | ||
open examples/capture/red.png | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# cube | ||
|
||
This example renders a textured cube. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example cube | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# describe | ||
|
||
This example prints output describing the adapter in use. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example describe | ||
``` | ||
|
||
## Example output | ||
|
||
``` | ||
# You might see different output as it depends on your graphics card | ||
AdapterInfo { name: "Intel(R) UHD Graphics 630", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Metal } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# hello-compute | ||
|
||
Runs a compute shader to determine the number of iterations of the rules from | ||
Collatz Conjecture | ||
|
||
- If n is even, n = n/2 | ||
- If n is odd, n = 3n+1 | ||
|
||
that it will take to finish and reach the number `1`. | ||
|
||
## To Run | ||
|
||
``` | ||
# Pass in any 4 numbers as arguments | ||
RUST_LOG=hello_compute cargo run --example hello-compute 1 4 3 295 | ||
``` | ||
|
||
## Example Output | ||
|
||
``` | ||
[2020-04-25T11:15:33Z INFO hello_compute] Times: [0, 2, 7, 55] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# hello-triangle | ||
|
||
This example renders a triangle to a window. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example hello-triangle | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# mipmap | ||
|
||
This example shows how to generate and make use of mipmaps. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example mipmap | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# msaa-line | ||
|
||
This example shows how to render lines using MSAA. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example msaa-line | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# shadow | ||
|
||
This animated example demonstrates shadow mapping. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example shadow | ||
``` | ||
|
||
## Screenshots | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# skybox | ||
|
||
This animated example demonstrates rendering a skybox. | ||
|
||
## To Run | ||
|
||
``` | ||
cargo run --example skybox | ||
``` | ||
|
||
## Screenshots | ||
|
||
 | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.