Skip to content

Commit 6d71b12

Browse files
committed
Fix pre-loop encoder cleanup
1 parent fbbf45b commit 6d71b12

5 files changed

Lines changed: 13 additions & 0 deletions

File tree

demo/android/app/src/main/cpp/native_engine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,7 @@ bool NativeEngine::init_app(bool use_vulkan) {
9090

9191
init_app_common(window_size);
9292

93+
pf_queue->wait_idle();
94+
9395
return true;
9496
}

demo/native/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ int main() {
4040
blit->set_texture(dst_texture);
4141
}
4242

43+
// Make sure encoders submitted are all finished before the main loop starts and the ring buffers starts to work.
44+
queue->wait_idle();
45+
4346
// Main loop.
4447
while (!window->should_close()) {
4548
window_builder->poll_events();

pathfinder/gpu/queue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Queue {
2121

2222
virtual void begin_frame(uint32_t current_frame_index) {}
2323

24+
virtual void wait_idle() {}
25+
2426
protected:
2527
uint32_t current_frame_index_{};
2628
};

pathfinder/gpu/vk/queue.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ void QueueVk::begin_frame(uint32_t current_frame_index) {
5555
encoders_in_flight_[current_frame_index_ % frames_in_flight_].clear();
5656
}
5757

58+
void QueueVk::wait_idle() {
59+
vkQueueWaitIdle(vk_graphics_queue_);
60+
}
61+
5862
} // namespace Pathfinder

pathfinder/gpu/vk/queue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class QueueVk : public Queue {
1414

1515
void begin_frame(uint32_t current_frame_index) override;
1616

17+
void wait_idle() override;
18+
1719
private:
1820
VkDevice vk_device_{};
1921

0 commit comments

Comments
 (0)