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
Copy file name to clipboardExpand all lines: en/03_Drawing_a_triangle/03_Drawing/02_Rendering_and_presentation.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -524,11 +524,12 @@ void drawFrame() {
524
524
525
525
The `vkWaitForFences` function takes an array of fences and waits for either any or all of them to be signaled before returning. The `VK_TRUE` we pass here indicates that we want to wait for all fences, but in the case of a single one it obviously doesn't matter. Just like `vkAcquireNextImageKHR` this function also takes a timeout. Unlike the semaphores, we manually need to restore the fence to the unsignaled state by resetting it with the `vkResetFences` call.
526
526
527
-
If you run the program now, you'll notice something something strange. The application no longer seems to be rendering anything. With validation layers enabled, you'll see the following message:
528
-
529
-

530
-
531
-
That means that we're waiting for a fence that has not been submitted. The problem here is that, by default, fences are created in the unsignaled state. That means that `vkWaitForFences` will wait forever if we haven't used the fence before. To solve that, we can change the fence creation to initialize it in the signaled state as if we had rendered an initial frame that finished:
527
+
If you run the program now, you'll notice something something strange. The application
528
+
no longer seems to be rendering anything. The problem is that we're waiting for a fence
529
+
that has not been submitted. Fences are created in the unsignaled state by default,
530
+
which means that `vkWaitForFences` will wait forever if we haven't used the fence
531
+
before. To solve that, we can change the fence creation to initialize it in the
532
+
signaled state as if we had rendered an initial frame that finished:
J'ai choisi de créer les fences avec les sémaphores et de renommer la fonction `createSemaphores` en
448
+
J'ai choisi de créer les fences avec les sémaphores et de renommer la fonction `createSemaphores` en
449
449
`createSyncObjects` :
450
450
451
451
```c++
@@ -519,15 +519,11 @@ différence vu que nous n'avons qu'une seule fence. Comme la fonction `vkAcquire
519
519
durée en argument, que nous ignorons. Nous devons ensuite réinitialiser les fences manuellement à l'aide d'un appel à
520
520
la fonction `vkResetFences`.
521
521
522
-
Si vous lancez le programme maintenant vous allez constater un comportement étrange. Plus rien ne se passe. Encore
523
-
une fois regardez ce que les validation layers vous fournissent comme informations :
524
-
525
-

526
-
527
-
Nous attendons qu'une fence soit signalée alors qu'elle n'a jamais été envoyée à aucune fonction. En effet les fences
528
-
sont par défaut crées dans le mode non signalé. Comme nous appelons `vkWaitForFences` avant `vkQueueSubmit` notre
529
-
première fence va créer une pause infinie. Pour empêcher cela nous devons initialiser les fences dans le mode signalé,
530
-
et ce dès leur création :
522
+
Si vous lancez le programme maintenant vous allez constater un comportement étrange. Plus rien ne se passe. Nous attendons qu'une fence soit signalée alors qu'elle n'a
523
+
jamais été envoyée à aucune fonction. En effet les fences sont par défaut crées dans le
524
+
mode non signalé. Comme nous appelons `vkWaitForFences` avant `vkQueueSubmit` notre
525
+
première fence va créer une pause infinie. Pour empêcher cela nous devons initialiser
526
+
les fences dans le mode signalé, et ce dès leur création :
531
527
532
528
```c++
533
529
voidcreateSyncObjects() {
@@ -569,7 +565,7 @@ void createSyncObjects() {
569
565
}
570
566
```
571
567
572
-
Initialement aucune frame n'utilise d'image, donc on peut explicitement l'initialiser à *pas de fence*. Maintenant, nous allons modifier
568
+
Initialement aucune frame n'utilise d'image, donc on peut explicitement l'initialiser à *pas de fence*. Maintenant, nous allons modifier
573
569
`drawFrame` pour attendre la fin de n'importe quelle frame qui serait en train d'utiliser l'image qu'on nous assigné pour la nouvelle frame.
0 commit comments