diff --git a/atlas/application/window.cpp b/atlas/application/window.cpp index 510d0c93..a38ca17a 100644 --- a/atlas/application/window.cpp +++ b/atlas/application/window.cpp @@ -4479,6 +4479,14 @@ void Window::close() { this->shouldClose = true; } void Window::setCamera(Camera *newCamera) { this->camera = newCamera; } +void Window::waitForRendering() { +#ifdef VULKAN + if (activeCommandBuffer != nullptr) { + activeCommandBuffer->waitForSubmittedWork(); + } +#endif +} + void Window::applyScene(Scene *scene) { atlas_log("Setting active scene"); this->pendingScene = nullptr; diff --git a/include/atlas/window.h b/include/atlas/window.h index 68aea7a6..4946c220 100644 --- a/include/atlas/window.h +++ b/include/atlas/window.h @@ -755,6 +755,8 @@ class Window { */ std::shared_ptr getDevice() const { return this->device; } + void waitForRendering(); + /** * @brief Returns the lazily created deferred geometry buffer. * diff --git a/opal b/opal index 64ae82f7..f1e26353 160000 --- a/opal +++ b/opal @@ -1 +1 @@ -Subproject commit 64ae82f73e1ff57bd20e16ec2b3c696f7a465f13 +Subproject commit f1e26353d4456bf9d6cb4ef5708aeda5cb45e9a9 diff --git a/runtime/lib/context.cpp b/runtime/lib/context.cpp index 0273f282..2ba47f71 100644 --- a/runtime/lib/context.cpp +++ b/runtime/lib/context.cpp @@ -7306,6 +7306,7 @@ void Context::loadMainScene(Window &window) { } void Context::loadScene(Window &window, const json &sceneData) { + window.waitForRendering(); auto sceneNameIt = sceneData.find("name"); if (sceneNameIt != sceneData.end() && sceneNameIt->is_string()) { currentSceneName = sceneNameIt->get();