Skip to content

Commit d7ad46e

Browse files
committed
Merge branch 'main' of github.com:eliemichel/LearnWebGPU
2 parents fc19468 + c6cddc7 commit d7ad46e

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

advanced-techniques/benchmarking/time.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ submit_to_do_on_gpu(write_current_time, end_timestamp_query)
5858

5959
We must then **fetch** the timestamp values back to the CPU, through a mapped buffer like we see in [Playing with buffers](../../basic-3d-rendering/input-geometry/playing-with-buffers.md#mapping-context).
6060

61-
> 🫡 Okey, got it, so what about actual C++ code?
61+
> 🫡 Okay, got it, so what about actual C++ code?
6262
6363
Whether they measure timestamps or other things, GPU queries are stored in a `QuerySet`. We typically store both the start and end time in the same set:
6464

@@ -293,7 +293,7 @@ Reading timestamps
293293
294294
### Resolving timestamps
295295
296-
Okey, the render pass writes to our first query when it begins, and writes to the second query when it ends. We only need to compute the difference now, right? But the timestamps still **live in the GPU memory**, so we first need to **fetch them back** to the CPU.
296+
Okay, the render pass writes to our first query when it begins, and writes to the second query when it ends. We only need to compute the difference now, right? But the timestamps still **live in the GPU memory**, so we first need to **fetch them back** to the CPU.
297297
298298
The first step consists in **resolving** the query. This gets the timestamp values from whatever internal representation the WebGPU implementation uses to store query set and write them in a **GPU buffer**.
299299

appendices/custom-extensions/with-dawn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ I leave the feature state to `Stable` for the sake of simplicity. If you want to
153153

154154
### Backend change (Vulkan)
155155

156-
Okey now our feature is correctly wired up in the internal API, but so far **none of the backends support it**! At this stage we must focus on **a single one at a time**.
156+
Okay, now our feature is correctly wired up in the internal API, but so far **none of the backends support it**! At this stage we must focus on **a single one at a time**.
157157

158158
We start with **Vulkan**, looking inside `dawn/src/dawn/native/vulkan`. So let's first force the Vulkan backend in our application:
159159

basic-3d-rendering/hello-triangle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ pipelineDesc.multisample.mask = ~0u;
353353
pipelineDesc.multisample.alphaToCoverageEnabled = false;
354354
```
355355

356-
Okey, we finally **configured all the stages** of the render pipeline. All that remains now is to specify the behavior of the two **programmable stages**, namely give a **vertex** and a **fragment shaders**.
356+
Okay, we finally **configured all the stages** of the render pipeline. All that remains now is to specify the behavior of the two **programmable stages**, namely give a **vertex** and a **fragment shaders**.
357357

358358
Shaders
359359
-------

basic-3d-rendering/shader-uniforms/a-first-uniform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ The fields `binding.sampler` and `binding.textureView` are only needed when the
354354

355355
### Usage
356356

357-
Okay we are now ready to connect the dots! It is as simple as setting the bind group to use before the draw call:
357+
Okay, we are now ready to connect the dots! It is as simple as setting the bind group to use before the draw call:
358358

359359
````{tab} With webgpu.hpp
360360
```C++

basic-3d-rendering/some-interaction/lighting-control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ In this chapter we have:
388388
- Connected lighting with GUI.
389389
- Created a custom GUI.
390390
391-
Okey, we are now ready to dive into material models for real!
391+
Okay, we are now ready to dive into material models for real!
392392
393393
````{tab} With webgpu.hpp
394394
*Resulting code:* [`step100`](https://github.com/eliemichel/LearnWebGPU-Code/tree/step100)

basic-compute/compute-pipeline.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ The workgroup sizes must be constant expressions.
332332

333333
### Workgroup size vs count
334334

335-
> 😟 Okey, that makes a lot of variables just to set a number of jobs that is just the product of them in the end, doesn't it?
335+
> 😟 Okay, that makes a lot of variables just to set a number of jobs that is just the product of them in the end, doesn't it?
336336
337337
The thing is: **all combinations are not equivalent**, even if they multiply to the same number of threads.
338338

@@ -356,7 +356,7 @@ These rules are somehow contradictory. Only a benchmark on your specific use cas
356356

357357
### Workgroup dimensions
358358

359-
> 😟 Ok I see better now, but what about the different axes $w$, $h$ and $d$? Is a workgroup size of $2 \times 2 \times 4$ different from $16 \times 1 \times 1$?
359+
> 😟 Okay, I see better now, but what about the different axes $w$, $h$ and $d$? Is a workgroup size of $2 \times 2 \times 4$ different from $16 \times 1 \times 1$?
360360
361361
It is different indeed, because this size **gives hints to the hardware** about the potential **consistency of memory access** across threads.
362362

getting-started/first-color.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ First, the render pipeline **does not draw directly on the texture that is curre
2727

2828
Second, drawing takes a **different time** than the frame rate required by your application, so the GPU may have to wait until the next frame is needed. There might be more than one off-screen texture waiting in the queue to be presented, so that fluctuations in the render time get amortized.
2929

30-
Last, **these off-screen textures are reused** as much as possible. As soon as a new texture is presented, the previous one can be reused as a target for the next frame. This whole mechanism of called a **Swap Chain** and is handled under teh hood by the **Surface** object.
30+
Last, **these off-screen textures are reused** as much as possible. As soon as a new texture is presented, the previous one can be reused as a target for the next frame. This whole mechanism of called a **Swap Chain** and is handled under the hood by the **Surface** object.
3131

3232
```{note}
3333
Remember that the GPU process runs at its own pace and that our CPU-issued commands are only asynchronously executed. Implementing the swap chain process manually would hence require a lot of boilerplate, so we are glad it is provided by the API!

getting-started/hello-webgpu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The Dawn-based distribution I provide here fetches the source code of Dawn from
108108
- The initial build takes significantly longer, and occupies more disk space overall.
109109

110110
````{note}
111-
On Linux check out [Dawn's build documentation](https://dawn.googlesource.com/dawn/+/HEAD/docs/building.md) for teh list of packages to install. As of April 7, 2024, the list is the following (for Ubuntu):
111+
On Linux check out [Dawn's build documentation](https://dawn.googlesource.com/dawn/+/HEAD/docs/building.md) for the list of packages to install. As of April 7, 2024, the list is the following (for Ubuntu):
112112
113113
```bash
114114
sudo apt-get install libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev pkg-config nodejs npm

getting-started/opening-a-window.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Application class
163163

164164
### Refactor
165165

166-
Let us **reorganize a bit our project** so that it is more Web-friendly and clearer about the **initialization** versus **main loop** separation.
166+
Let us **reorganize our project a bit** so that it is more Web-friendly and clearer about the **initialization** versus **main loop** separation.
167167

168168
We create functions `Initialize()`, `MainLoop()` and `Terminate()` to split up the three key parts of our program. We also put **all the variables** that these functions share in a common class/struct, that we call for instance `Application`. For better readability, we may have `Initialize()`, `MainLoop()` and `Terminate()` be members of this class:
169169

@@ -331,10 +331,10 @@ glfwTerminate();
331331
```
332332

333333
```{important}
334-
So **not** move the `emscripten_sleep(100)` line to `MainLoop()`. This line is no longer needed once we **let the browser handle** the main loop, because the browser ticks its WebGPU backend itself.
334+
So **do not** move the `emscripten_sleep(100)` line to `MainLoop()`. This line is no longer needed once we **let the browser handle** the main loop, because the browser ticks its WebGPU backend itself.
335335
```
336336

337-
Once you have move everything, you should end up with the following class attributes shared across init/main:
337+
Once you have moved everything, you should end up with the following class attributes shared across init/main:
338338

339339
```{lit} C++, Application attributes
340340
GLFWwindow *window;
@@ -348,7 +348,7 @@ The `WGPUInstance` and `WGPUAdapter` are intermediate steps towards getting the
348348

349349
### Emscripten
350350

351-
As mentionned multiple times above, explicitly writing the `while` loop is not possible when building for the **Web** (with Emscripten) because it **conflicts** with the web browser's own loop. We thus write the main loop differently in such a case:
351+
As mentioned multiple times above, explicitly writing the `while` loop is not possible when building for the **Web** (with Emscripten) because it **conflicts** with the web browser's own loop. We thus write the main loop differently in such a case:
352352

353353
```{lit} C++, Main loop (replace)
354354
#ifdef __EMSCRIPTEN__
@@ -374,7 +374,7 @@ int main() {
374374
}
375375
```
376376

377-
We use here the function [`emscripten_set_main_loop_arg()`](https://emscripten.org/docs/api_reference/emscripten.h.html#c.emscripten_set_main_loop_arg), which is precisely **dedicated to this issue**. This sets a **callback** that the browser will call each time it runs its main rendering loop.
377+
Here we use the function [`emscripten_set_main_loop_arg()`](https://emscripten.org/docs/api_reference/emscripten.h.html#c.emscripten_set_main_loop_arg), which is precisely **dedicated to this issue**. This sets a **callback** that the browser will call each time it runs its main rendering loop.
378378

379379
```C++
380380
// Callback type takes one argument of type 'void*' and returns nothing
@@ -406,7 +406,7 @@ emscripten_set_main_loop_arg(callback, &app, 0, true);
406406
407407
The extra arguments are recommended to be `0` and `true`:
408408
409-
- `fps` is the **framerate** at which the function gets called. For **better performance**, it is recommended to set it to 0 to leave it up to the browser (equivalent of usign `requestAnimationFrame` in JavaScript)
409+
- `fps` is the **framerate** at which the function gets called. For **better performance**, it is recommended to set it to 0 to leave it up to the browser (equivalent of using `requestAnimationFrame` in JavaScript)
410410
- `simulate_infinite_loop` must be `true` to prevent `app` from being freed. Otherwise, the `main` function **returns before the callback gets invoked**, so the application no longer exists and the `arg` pointer is *dangling* (i.e., points to nothing valid).
411411
412412
The Surface

0 commit comments

Comments
 (0)