Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1ed16a

Browse files
authored
Fix possible freeze in recreateSwapChain
1 parent aa8039c commit f1ed16a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fr/03_Dessiner_un_triangle/04_Recréation_de_la_swap_chain.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ jusqu'à ce que la fenêtre soit remise en avant-plan. À ce moment-là nous rec
257257
```c++
258258
void recreateSwapChain() {
259259
int width = 0, height = 0;
260+
glfwGetFramebufferSize(window, &width, &height);
260261
while (width == 0 || height == 0) {
261262
glfwGetFramebufferSize(window, &width, &height);
262263
glfwWaitEvents();
@@ -268,6 +269,8 @@ void recreateSwapChain() {
268269
}
269270
```
270271

272+
L'appel initial à `glfwGetFramebufferSize` prend en charge le cas où la taille est déjà correcte et `glfwWaitEvents` n'aurait rien à attendre.
273+
271274
Félicitations, vous avez codé un programme fonctinnel avec Vulkan! Dans le prochain chapitre nous allons supprimer les
272275
sommets du vertex shader et mettre en place un vertex buffer.
273276

0 commit comments

Comments
 (0)