This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit 2f80d6b
committed
[Impeller] Fix a race between SwapchainImplVK::Present and WaitForFence
The previous implementation used an fml::CountDownLatch to synchronize between FrameSynchronizer::WaitForFence and the task queued by SwapchainImplVK::Present.
fml::CountDownLatch:Wait always waits, even if the count is already zero. So the raster thread would deadlock if the present task signals the latch before FrameSynchronizer::WaitForFence enters the wait.
This PR instead uses a semaphore that is set each time SwapchainImplVK::Present is called. FrameSynchronizer::WaitForFence will check the semaphore to determine whether a present task is pending and if so wait for its completion.1 parent 16bbb46 commit 2f80d6b
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
| |||
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
74 | | - | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
505 | 511 | | |
506 | 512 | | |
507 | 513 | | |
508 | | - | |
| 514 | + | |
509 | 515 | | |
510 | 516 | | |
511 | 517 | | |
| |||
529 | 535 | | |
530 | 536 | | |
531 | 537 | | |
| 538 | + | |
| 539 | + | |
532 | 540 | | |
533 | 541 | | |
534 | 542 | | |
| |||
0 commit comments