Add methods to disable synchronization during scene loading as the application will get killed by the sync timeout otherwise

This commit is contained in:
Alexander Bock
2016-09-21 22:29:52 +02:00
parent a85356dcff
commit 2ed8042667
5 changed files with 21 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ class SGCTWindowWrapper : public WindowWrapper {
public:
void terminate() override;
void setBarrier(bool enabled) override;
void setSynchronization(bool enabled) override;
void clearAllWindows(const glm::vec4& clearColor) override;
bool windowHasResized() const override;

View File

@@ -55,6 +55,14 @@ public:
* disables it
*/
virtual void setBarrier(bool enabled);
/**
* This method enables or disables a framelock barrier. If the specific windowing
* framework does not provide a framelock, this method defaults to a no-op.
* \param enabled If <code>true</code> the framelock is enabled, <code>false</code>
* disables it
*/
virtual void setSynchronization(bool enabled);
/**
* This method clears all the rendering windows with the specified \p clearColor. In

View File

@@ -44,6 +44,10 @@ void SGCTWindowWrapper::setBarrier(bool enabled) {
sgct::SGCTWindow::setBarrier(enabled);
}
void SGCTWindowWrapper::setSynchronization(bool enabled) {
sgct_core::ClusterManager::instance()->setUseIgnoreSync(enabled);
}
void SGCTWindowWrapper::clearAllWindows(const glm::vec4& clearColor) {
size_t n = sgct::Engine::instance()->getNumberOfWindows();
for (size_t i = 0; i < n; ++i) {

View File

@@ -35,6 +35,8 @@ WindowWrapper::WindowWrapperException::WindowWrapperException(const std::string&
void WindowWrapper::terminate() {}
void WindowWrapper::setBarrier(bool) {}
void WindowWrapper::setSynchronization(bool) {}
void WindowWrapper::clearAllWindows(const glm::vec4& clearColor) {}

View File

@@ -26,6 +26,7 @@
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/query/query.h>
#include <openspace/rendering/renderengine.h>
@@ -182,11 +183,15 @@ void Scene::clearSceneGraph() {
bool Scene::loadSceneInternal(const std::string& sceneDescriptionFilePath) {
ghoul::Dictionary dictionary;
OsEng.windowWrapper().setSynchronization(false);
OnExit(
[](){ OsEng.windowWrapper().setSynchronization(true); }
);
lua_State* state = ghoul::lua::createNewLuaState();
OnExit(
// Delete the Lua state at the end of the scope, no matter what
[state](){ghoul::lua::destroyLuaState(state);}
[state](){ ghoul::lua::destroyLuaState(state); }
);
OsEng.scriptEngine().initializeLuaState(state);