Skip to content

Commit 1823f8b

Browse files
Fixes and changes to the documentation for increasing clarity (#4806)
Co-authored-by: Connor Fitzgerald <[email protected]>
1 parent 41fb222 commit 1823f8b

File tree

8 files changed

+41
-42
lines changed

8 files changed

+41
-42
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
[![Build Status](https://github.com/gfx-rs/wgpu/workflows/CI/badge.svg)](https://github.com/gfx-rs/wgpu/actions)
99
[![codecov.io](https://codecov.io/gh/gfx-rs/wgpu/branch/trunk/graph/badge.svg?token=84qJTesmeS)](https://codecov.io/gh/gfx-rs/wgpu)
1010

11-
`wgpu` is a cross-platform, safe, pure-rust graphics api. It runs natively on Vulkan, Metal, D3D12, and OpenGL; and on top of WebGL2 and WebGPU on wasm.
11+
`wgpu` is a cross-platform, safe, pure-rust graphics API. It runs natively on Vulkan, Metal, D3D12, and OpenGL; and on top of WebGL2 and WebGPU on wasm.
1212

13-
The api is based on the [WebGPU standard](https://gpuweb.github.io/gpuweb/). It serves as the core of the WebGPU integration in Firefox and Deno.
13+
The API is based on the [WebGPU standard](https://gpuweb.github.io/gpuweb/). It serves as the core of the WebGPU integration in Firefox and Deno.
1414

1515
## Repo Overview
1616

@@ -26,7 +26,7 @@ The repository hosts the following libraries:
2626

2727
The following binaries:
2828

29-
- [![Crates.io](https://img.shields.io/crates/v/naga-cli.svg?label=naga-cli)](https://crates.io/crates/naga-cli) - Tool for translating shaders between different languages using naga.
29+
- [![Crates.io](https://img.shields.io/crates/v/naga-cli.svg?label=naga-cli)](https://crates.io/crates/naga-cli) - Tool for translating shaders between different languages using `naga`.
3030
- [![Crates.io](https://img.shields.io/crates/v/wgpu-info.svg?label=wgpu-info)](https://crates.io/crates/wgpu-info) - Tool for getting information on GPUs in the system.
3131
- `cts_runner` - WebGPU Conformance Test Suite runner using `deno_webgpu`.
3232
- `player` - standalone application for replaying the API traces.
@@ -39,9 +39,9 @@ For an overview of all the components in the gfx-rs ecosystem, see [the big pict
3939

4040
Rust examples can be found at [wgpu/examples](examples). You can run the examples on native with `cargo run --bin wgpu-examples <example>`. See the [list of examples](examples).
4141

42-
To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin wgpu-example`. Then connect to `http://localhost:8000` in your WebGPU enabled browser, and you can choose an example to run.
42+
To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin wgpu-example`. Then connect to `http://localhost:8000` in your WebGPU-enabled browser, and you can choose an example to run.
4343

44-
To run the examples on WebGL on wasm, run `cargo xtask run-wasm --bin wgpu-example --features webgl`. Then connect to `http://localhost:8000` in your WebGL enabled browser, and you can choose an example to run.
44+
To run the examples on WebGL on wasm, run `cargo xtask run-wasm --bin wgpu-example --features webgl`. Then connect to `http://localhost:8000` in your WebGL-enabled browser, and you can choose an example to run.
4545

4646
If you are looking for a wgpu tutorial, look at the following:
4747

@@ -93,8 +93,7 @@ We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) that serves as a knowledge
9393

9494
wgpu supports shaders in [WGSL](https://gpuweb.github.io/gpuweb/wgsl/), SPIR-V, and GLSL.
9595
Both [HLSL](https://github.com/Microsoft/DirectXShaderCompiler) and [GLSL](https://github.com/KhronosGroup/glslang)
96-
have compilers to target SPIR-V. All of these shader languages can be used with any backend, we
97-
will handle all of the conversion. Additionally, support for these shader inputs is not going away.
96+
have compilers to target SPIR-V. All of these shader languages can be used with any backend as we handle all of the conversions. Additionally, support for these shader inputs is not going away.
9897

9998
While WebGPU does not support any shading language other than WGSL, we will automatically convert your
10099
non-WGSL shaders if you're running on WebGPU.
@@ -110,9 +109,9 @@ To enable GLSL shaders, enable the `glsl` feature of wgpu.
110109

111110
### Angle
112111

113-
[Angle](http://angleproject.org) is a translation layer from GLES to other backends, developed by Google.
112+
[Angle](http://angleproject.org) is a translation layer from GLES to other backends developed by Google.
114113
We support running our GLES3 backend over it in order to reach platforms DX11 support, which aren't accessible otherwise.
115-
In order to run with Angle, "angle" feature has to be enabled, and Angle libraries placed in a location visible to the application.
114+
In order to run with Angle, the "angle" feature has to be enabled, and Angle libraries placed in a location visible to the application.
116115
These binaries can be downloaded from [gfbuild-angle](https://github.com/DileSoft/gfbuild-angle) artifacts, [manual compilation](https://github.com/google/angle/blob/main/doc/DevSetup.md) may be required on Macs with Apple silicon.
117116

118117
On Windows, you generally need to copy them into the working directory, in the same directory as the executable, or somewhere in your path.
@@ -122,10 +121,10 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment.
122121

123122
Due to complex dependants, we have two MSRV policies:
124123
- `d3d12`, `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**.
125-
- The rest of the workspace has the MSRV of **1.71**.
124+
- The rest of the workspace has an MSRV of **1.71**.
126125

127-
It is enforced on CI (in "/.github/workflows/ci.yml") with `CORE_MSRV` and `REPO_MSRV` variable.
128-
This version can only be upgraded in breaking releases, though we release a breaking version every 3 months.
126+
It is enforced on CI (in "/.github/workflows/ci.yml") with the `CORE_MSRV` and `REPO_MSRV` variables.
127+
This version can only be upgraded in breaking releases, though we release a breaking version every three months.
129128

130129
The `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates should never
131130
require an MSRV ahead of Firefox's MSRV for nightly builds, as
@@ -136,10 +135,10 @@ determined by the value of `MINIMUM_RUST_VERSION` in
136135

137136
## Environment Variables
138137

139-
All testing and example infrastructure shares the same set of environment variables that determine which Backend/GPU it will run on.
138+
All testing and example infrastructure share the same set of environment variables that determine which Backend/GPU it will run on.
140139

141140
- `WGPU_ADAPTER_NAME` with a substring of the name of the adapter you want to use (ex. `1080` will match `NVIDIA GeForce 1080ti`).
142-
- `WGPU_BACKEND` with a comma separated list of the backends you want to use (`vulkan`, `metal`, `dx12`, `dx11`, or `gl`).
141+
- `WGPU_BACKEND` with a comma-separated list of the backends you want to use (`vulkan`, `metal`, `dx12`, `dx11`, or `gl`).
143142
- `WGPU_POWER_PREF` with the power preference to choose when a specific adapter name isn't specified (`high`, `low` or `none`)
144143
- `WGPU_DX12_COMPILER` with the DX12 shader compiler you wish to use (`dxc` or `fxc`, note that `dxc` requires `dxil.dll` and `dxcompiler.dll` to be in the working directory otherwise it will fall back to `fxc`)
145144
- `WGPU_GLES_MINOR_VERSION` with the minor OpenGL ES 3 version number to request (`0`, `1`, `2` or `automatic`).
@@ -187,7 +186,7 @@ If you are a user and want a way to help contribute to wgpu, we always need more
187186

188187
WebGPU includes a Conformance Test Suite to validate that implementations are working correctly. We can run this CTS against wgpu.
189188

190-
To run the CTS, first you need to check it out:
189+
To run the CTS, first, you need to check it out:
191190

192191
```
193192
git clone https://github.com/gpuweb/cts.git
@@ -199,7 +198,7 @@ git checkout $(cat ../cts_runner/revision.txt)
199198
To run a given set of tests:
200199

201200
```
202-
# Must be inside the cts folder we just checked out, else this will fail
201+
# Must be inside the `cts` folder we just checked out, else this will fail
203202
cargo run --manifest-path ../Cargo.toml --bin cts_runner -- ./tools/run_deno --verbose "<test string>"
204203
```
205204

@@ -224,7 +223,7 @@ Exactly which WGSL features `wgpu` supports depends on how you are using it:
224223
to translate WGSL code into the shading language of your platform's native GPU API.
225224
Naga has [a milestone][naga wgsl milestone]
226225
for catching up to the WGSL specification,
227-
but in general there is no up-to-date summary
226+
but in general, there is no up-to-date summary
228227
of the differences between Naga and the WGSL spec.
229228

230229
- When running in a web browser (by compilation to WebAssembly)

deno_webgpu/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ running through our WPT runner. This will be used to validate implementation
1919
conformance.
2020

2121
GitHub CI doesn't run with GPUs, so testing relies on software like DX WARP &
22-
Vulkan lavapipe. Currently only using DX WARP works, so tests are only run on
22+
Vulkan lavapipe. Currently, only using DX WARP works, so tests are only run on
2323
Windows.
2424

2525
## Links

examples/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ For the simplest examples without using any helping code (see `framework.rs` her
88

99
### Summary of examples
1010

11-
A summary of the basic examples as split along the graphics and compute "pathways", layed out roughly in order of building on each other. Those further indented and thus more roughly dependant on more other examples tend to be more complicated as well as those further down. It should be noted though that computing examples, even though they are mentioned further down (because rendering to a window is by far the most common use case), tend to be less complex as they require less surrounding context to create and manage a window to render to.
11+
A summary of the basic examples as split along the graphics and compute "pathways" laid out roughly in order of building on each other. Those further indented, and thus more roughly dependent on more other examples, tend to be more complicated as well as those further down. It should be noted, though, that computing examples, even though they are mentioned further down (because rendering to a window is by far the most common use case), tend to be less complex as they require less surrounding context to create and manage a window to render to.
1212

13-
The rest of the example are for demonstrating specific features that you can come back for later when you know what those features are.
13+
The rest of the examples are for demonstrating specific features that you can come back for later when you know what those features are.
1414

1515
#### General
1616

@@ -19,24 +19,24 @@ The rest of the example are for demonstrating specific features that you can com
1919
#### Graphics
2020

2121
- `hello-triangle` - Provides an example of a bare-bones WGPU workflow using the Winit crate that simply renders a red triangle on a green background.
22-
- `uniform-values` - Demonstrates the basics of enabling shaders and the GPU in general to access app state through uniform variables. `uniform-values` also serves as an example of rudimentary app building as the app stores state and takes window-captured keyboard events. The app displays the Mandelbrot Set in grayscale (similar to `storage-texture`) but allows the user to navigate and explore it using their arrow keys and scroll wheel.
22+
- `uniform-values` - Demonstrates the basics of enabling shaders and the GPU, in general, to access app state through uniform variables. `uniform-values` also serves as an example of rudimentary app building as the app stores state and takes window-captured keyboard events. The app displays the Mandelbrot Set in grayscale (similar to `storage-texture`) but allows the user to navigate and explore it using their arrow keys and scroll wheel.
2323
- `cube` - Introduces the user to slightly more advanced models. The example creates a set of triangles to form a cube on the CPU and then uses a vertex and index buffer to send the generated model to the GPU for usage in rendering. It also uses a texture generated on the CPU to shade the sides of the cube and a uniform variable to apply a transformation matrix to the cube in the shader.
24-
- `bunnymark` - Demonstrates many things but chief among them, preforming numerous draw calls with different bind groups in one render pass. The example also uses textures for the icon and uniform buffers to transfer both global and per-particle state.
25-
- `skybox` - Shows off too many concepts to list here. The name comes from game development where a "skybox" acts as a background for rendering, usually to add a sky texture for immersion although they can also be used for backdrops to give the idea of a world beyond of the game scene. This example does so much more than this though as it uses a car model loaded from a file and uses the user's mouse to rotate the car model in 3d. `skybox` also makes use of depth textures and similar app patterns to `uniform-values`.
26-
- `shadow` - Likely by far the most complex example (certainly the largest in lines of code) of the official WGPU examples. `shadow` demonstrates basic scene rendering with the main attraction being lighting and shadows (as the name implies). It is recommended that any user looking into lighting be very familiar with the basic concepts of not only rendering with WGPU but the primary mathematical ideas of computer graphics.
24+
- `bunnymark` - Demonstrates many things, but chief among them is performing numerous draw calls with different bind groups in one render pass. The example also uses textures for the icon and uniform buffers to transfer both global and per-particle states.
25+
- `skybox` - Shows off too many concepts to list here. The name comes from game development where a "skybox" acts as a background for rendering, usually to add a sky texture for immersion, although they can also be used for backdrops to give the idea of a world beyond the game scene. This example does so much more than this, though, as it uses a car model loaded from a file and uses the user's mouse to rotate the car model in 3d. `skybox` also makes use of depth textures and similar app patterns to `uniform-values`.
26+
- `shadow` - Likely by far the most complex example (certainly the largest in lines of code) of the official WGPU examples. `shadow` demonstrates basic scene rendering with the main attraction being lighting and shadows (as the name implies). It is recommended that any user looking into lighting be very familiar with the basic concepts of not only rendering with WGPU but also the primary mathematical ideas of computer graphics.
2727
- `render-to-texture` - Renders to an image texture offscreen, demonstrating both off-screen rendering as well as how to add a sort of resolution-agnostic screenshot feature to an engine. This example either outputs an image file of your naming (pass command line arguments after specifying a `--` like `cargo run --bin render-to-texture -- "test.png"`) or adds an `img` element containing the image to the page in WASM.
2828

2929
#### Compute
3030

31-
- `hello-compute` - Demonstrates the basic workflow for getting arrays of numbers to the GPU, executing a shader on them, and getting the results back. The operation it preforms is finding the Collatz value (how many iterations of the [Collatz equation](https://en.wikipedia.org/wiki/Collatz_conjecture) it takes for the number to either reach 1 or overflow) of a set of numbers and prints the results.
32-
- `repeated-compute` - Mostly for going into detail on subjects `hello-compute` did not. It, too, computes the Collatz conjecture but this time, it automatically loads large arrays of randomly generated numbers, prints them, runs them, and prints the result. It does this cycle 10 times.
31+
- `hello-compute` - Demonstrates the basic workflow for getting arrays of numbers to the GPU, executing a shader on them, and getting the results back. The operation it performs is finding the Collatz value (how many iterations of the [Collatz equation](https://en.wikipedia.org/wiki/Collatz_conjecture) it takes for the number to either reach 1 or overflow) of a set of numbers and prints the results.
32+
- `repeated-compute` - Mostly for going into detail on subjects `hello-compute` did not. It, too, computes the Collatz conjecture, but this time, it automatically loads large arrays of randomly generated numbers, prints them, runs them, and prints the result. It does this cycle 10 times.
3333
- `hello-workgroups` - Teaches the user about the basics of compute workgroups; what they are and what they can do.
3434
- `hello-synchronization` - Teaches the user about synchronization in WGSL, the ability to force all invocations in a workgroup to synchronize with each other before continuing via a sort of barrier.
35-
- `storage-texture` - Demonstrates the use of storage textures as outputs to compute shaders. The example on the outside seems very similar to `render-to-texture` in that it outputs an image either to the file system or the web page except displaying a grayscale render of the Mandelbrot Set. However, inside, the example dispatches a grid of compute workgroups, one for each pixel which calculates the pixel value and stores it to the corresponding pixel of the output storage texture.
35+
- `storage-texture` - Demonstrates the use of storage textures as outputs to compute shaders. The example on the outside seems very similar to `render-to-texture` in that it outputs an image either to the file system or the web page, except displaying a grayscale render of the Mandelbrot Set. However, inside, the example dispatches a grid of compute workgroups, one for each pixel, which calculates the pixel value and stores it to the corresponding pixel of the output storage texture.
3636

3737
#### Combined
3838

39-
- `boids` - Demonstrates how to combine compute and render workflows by preforming a [boid](https://en.wikipedia.org/wiki/Boids) simulation and rendering the boids to the screen as little triangles.
39+
- `boids` - Demonstrates how to combine compute and render workflows by performing a [boid](https://en.wikipedia.org/wiki/Boids) simulation and rendering the boids to the screen as little triangles.
4040

4141
## Feature matrix
4242

@@ -83,16 +83,16 @@ The rest of the example are for demonstrating specific features that you can com
8383

8484
## Additional notes
8585

86-
Note that the examples regarding computing build off of each other; repeated-compute extends hello-compute, hello-workgroups assumes you know the basic workflow of gpu computation, and hello-synchronization assumes you know what a workgroup is. Also note that the computing examples cannot be downleveled to WebGL as WebGL does not allow storage textures. Running these in a browser will require that browser to support WebGPU.
86+
Note that the examples regarding computing build off of each other; repeated-compute extends hello-compute, hello-workgroups assumes you know the basic workflow of GPU computation, and hello-synchronization assumes you know what a workgroup is. Also, note that the computing examples cannot be downleveled to WebGL as WebGL does not allow storage textures. Running these in a browser will require that browser to support WebGPU.
8787

8888
All the examples use [WGSL](https://gpuweb.github.io/gpuweb/wgsl.html) shaders unless specified otherwise.
8989

9090
All framework-based examples render to the window and are reftested against the screenshot in the directory.
9191

9292
## Hacking
9393

94-
You can record an API trace any of the framework-based examples by starting them as:
94+
You can record an API trace for any of the framework-based examples by starting them as:
9595

9696
```sh
97-
mkdir -p trace && WGPU_TRACE=trace cargo run --features trace --bin <example-name>
97+
mkdir -p trace && WGPU_TRACE=trace cargo run --features trace --bin wgpu-examples <example-name>
9898
```

0 commit comments

Comments
 (0)