Skip to content

Commit 008df3c

Browse files
authored
Correct some typos/out-of-sync in docs (#669)
* Typo ad bug fixes to tut 1 * tutorial 2 Includes a bug fix for a bug I ran into. This is probably common on Macs with Retina displays, which have a default resolution of 3024 x 1964 for the 14" * small typo * Update README.md
1 parent 1f23ef4 commit 008df3c

4 files changed

Lines changed: 23 additions & 10 deletions

File tree

docs/beginner/tutorial1-window/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl State {
7878
// ...
7979
```
8080

81-
There's not much going on here, but once we start using WGPU will start filling this up pretty quick. Most of the methods on this struct are place holders, though in `render()` we ask the window to draw another frame as soon as possible as winit only draws one frame unless the window is resized or we request it to draw another one.
81+
There's not much going on here, but once we start using, we WGPU will start filling this up pretty quick. Most of the methods on this struct are place holders, though in `render()` we ask the window to draw another frame as soon as possible as winit only draws one frame unless the window is resized or we request it to draw another one.
8282

8383
Now that we have our `State` struct, we need to tell winit how to use it. We'll create an `App` struct for this.
8484

@@ -135,7 +135,7 @@ impl ApplicationHandler<State> for App {
135135
#[cfg(not(target_arch = "wasm32"))]
136136
{
137137
// If we are not on web we can use pollster to
138-
// await the
138+
// await the window creation
139139
self.state = Some(pollster::block_on(State::new(window)).unwrap());
140140
}
141141

@@ -180,7 +180,7 @@ The `resumed` method seems like it does a lot, but it only does a few things:
180180
- It defines attributes about the window including some web specific stuff.
181181
- We use those attributes to create the window.
182182
- We create a future that creates our `State` struct
183-
- On native we use pollster to get await the future
183+
- On native we use `pollster` to await the future
184184
- On web we run the future asynchronously which sends the results to the `user_event` function
185185

186186
The `user_event` function just serves as a landing point for our `State` future. `resumed` isn't async so we need to offload the future and send the results somewhere.
@@ -284,7 +284,7 @@ Now, all we need are some more dependencies that are specific to running in WASM
284284
```toml
285285
# This should go in the Cargo.toml in the root directory
286286

287-
# tThis is not required for WASM as wasm-opt should take care of this.
287+
# This is not required for WASM as wasm-opt should take care of this.
288288
# It can also interfere with WASM builds so feel free to leave it out.
289289
# It helps if you are wanting to build native binaries, as it helps reduce
290290
# the size of the executable, and make it harder to reverse engineer.
@@ -341,7 +341,7 @@ Now you can build a wgpu application with just wasm-bindgen, but I ran into some
341341

342342
To get around this shortcoming and to make the lives of everyone reading this easier, I opted to add [wasm-pack](https://drager.github.io/wasm-pack/) to the mix. Wasm-pack handles installing the correct version of wasm-bindgen for you, and it supports building for different types of web targets as well: browser, NodeJS, and bundlers such as webpack.
343343

344-
To use wasm-pack, first, you need to [install it](https://drager.github.io/wasm-pack/).
344+
To use wasm-pack, first, you need to [install it](https://wasm-bindgen.github.io/wasm-pack/installer/).
345345

346346
Once you've done that, we can use it to build our crate. If you only have one crate in your project, you can just use `wasm-pack build`. If you're using a workspace, you'll have to specify what crate you want to build. Imagine your crate is a directory called `game`. You would then use:
347347

docs/beginner/tutorial2-surface/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ pub fn resize(&mut self, width: u32, height: u32) {
239239

240240
This is where we configure the `surface`. We need the surface to be configured before we can do anything with it. We set the `is_surface_configured` flag to true here and we'll check it in the `render()` function.
241241

242+
Note that the max supported dimension in WebGL is 2048 px. If you have a larger display, you must cap the height and width, e.g.:
243+
244+
```rust
245+
if width > 0 && height > 0 {
246+
let max = 2048;
247+
self.config.width = width.min(max);
248+
self.config.height = height.min(max);
249+
```
250+
242251
## handle_key()
243252

244253
This is where we'll handle keyboard events. Currently just want to exit the app when the escape key is pressed. We'll do some other stuff later.

docs/beginner/tutorial3-pipeline/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ pub struct State {
167167
queue: wgpu::Queue,
168168
config: wgpu::SurfaceConfiguration,
169169
is_surface_configured: bool,
170+
window: Arc<Window>,
170171
// NEW!
171172
render_pipeline: wgpu::RenderPipeline,
172-
window: Arc<Window>,
173173
}
174174
```
175175

@@ -311,6 +311,7 @@ If you run your program now, it'll take a little longer to start, but it will st
311311
Some(wgpu::RenderPassColorAttachment {
312312
view: &view,
313313
resolve_target: None,
314+
depth_slice: None,
314315
ops: wgpu::Operations {
315316
load: wgpu::LoadOp::Clear(
316317
wgpu::Color {
@@ -325,6 +326,9 @@ If you run your program now, it'll take a little longer to start, but it will st
325326
})
326327
],
327328
depth_stencil_attachment: None,
329+
occlusion_query_set: None,
330+
timestamp_writes: None,
331+
multiview_mask: None,
328332
});
329333

330334
// NEW!

docs/compute/introduction/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ said, not all algorithms benefit from leveraging this compute power.
4343
I can't possibly make a comprehensive list of all the things you could use a GPU for,
4444
but here are some rules of thumb:
4545

46-
- Tasks that can be easily parrallelized. GPUs don't like switching tasks, so if you
46+
- Tasks that can be easily parallelized. GPUs don't like switching tasks, so if you
4747
need the computation to use data from previous operations, compute shaders are likely
4848
to be slower than a CPU based approach. If each operation can excute without any
4949
knowledge of other operations, you can get a lot out of the GPU.
50-
- You already have the data on the GPU. If your working with texture or model data
51-
It can often be faster to process it with a compute shader rather than copying the data
52-
to the CPU, modifying it, than shipping that back to the GPU.
50+
- You already have the data on the GPU. If you're working with texture or model data,
51+
it can often be faster to process it with a compute shader rather than copying the data
52+
to the CPU, modifying it, then shipping that back to the GPU.
5353
- You have a massive amount of data. At some point the size of your data starts to outweigh
5454
the setup time and complexity of using a compute pipeline. You'll still need to tailor
5555
your approach to the data and processing you need to do.

0 commit comments

Comments
 (0)