You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
60
60
61
-
> 🫡 Okey, got it, so what about actual C++ code?
61
+
> 🫡 Okay, got it, so what about actual C++ code?
62
62
63
63
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:
64
64
@@ -293,7 +293,7 @@ Reading timestamps
293
293
294
294
### Resolving timestamps
295
295
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.
297
297
298
298
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**.
Copy file name to clipboardExpand all lines: appendices/custom-extensions/with-dawn.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,7 +153,7 @@ I leave the feature state to `Stable` for the sake of simplicity. If you want to
153
153
154
154
### Backend change (Vulkan)
155
155
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**.
157
157
158
158
We start with **Vulkan**, looking inside `dawn/src/dawn/native/vulkan`. So let's first force the Vulkan backend in our application:
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**.
Copy file name to clipboardExpand all lines: basic-compute/compute-pipeline.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -332,7 +332,7 @@ The workgroup sizes must be constant expressions.
332
332
333
333
### Workgroup size vs count
334
334
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?
336
336
337
337
The thing is: **all combinations are not equivalent**, even if they multiply to the same number of threads.
338
338
@@ -356,7 +356,7 @@ These rules are somehow contradictory. Only a benchmark on your specific use cas
356
356
357
357
### Workgroup dimensions
358
358
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$?
360
360
361
361
It is different indeed, because this size **gives hints to the hardware** about the potential **consistency of memory access** across threads.
Copy file name to clipboardExpand all lines: getting-started/first-color.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ First, the render pipeline **does not draw directly on the texture that is curre
27
27
28
28
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.
29
29
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.
31
31
32
32
```{note}
33
33
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!
Copy file name to clipboardExpand all lines: getting-started/hello-webgpu.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,7 @@ The Dawn-based distribution I provide here fetches the source code of Dawn from
108
108
- The initial build takes significantly longer, and occupies more disk space overall.
109
109
110
110
````{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):
Copy file name to clipboardExpand all lines: getting-started/opening-a-window.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,7 +163,7 @@ Application class
163
163
164
164
### Refactor
165
165
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.
167
167
168
168
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:
169
169
@@ -331,10 +331,10 @@ glfwTerminate();
331
331
```
332
332
333
333
```{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.
335
335
```
336
336
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:
338
338
339
339
```{lit} C++, Application attributes
340
340
GLFWwindow *window;
@@ -348,7 +348,7 @@ The `WGPUInstance` and `WGPUAdapter` are intermediate steps towards getting the
348
348
349
349
### Emscripten
350
350
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:
352
352
353
353
```{lit} C++, Main loop (replace)
354
354
#ifdef __EMSCRIPTEN__
@@ -374,7 +374,7 @@ int main() {
374
374
}
375
375
```
376
376
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.
378
378
379
379
```C++
380
380
// Callback type takes one argument of type 'void*' and returns nothing
The extra arguments are recommended to be `0` and `true`:
408
408
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)
410
410
- `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).
0 commit comments