Fix crash in vive and interleaved stereo plugins

This commit is contained in:
Brad Davis 2019-02-15 10:46:08 -08:00
parent af25a7bf6e
commit 5483971855
3 changed files with 7 additions and 1 deletions

View file

@ -720,7 +720,7 @@ void OpenGLDisplayPlugin::present() {
}
gpu::Backend::freeGPUMemSize.set(gpu::gl::getFreeDedicatedMemory());
} else {
} else if (alwaysPresent()) {
internalPresent();
}
_movingAveragePresent.addSample((float)(usecTimestampNow() - startPresent));

View file

@ -88,6 +88,11 @@ protected:
glm::uvec2 getSurfaceSize() const;
glm::uvec2 getSurfacePixels() const;
// Some display plugins require us to always execute some present logic,
// whether we have a frame or not (Oculus Mobile plugin)
// Such plugins must be prepared to do the right thing if the `_currentFrame`
// is not populated
virtual bool alwaysPresent() const { return false; }
void updateCompositeFramebuffer();

View file

@ -57,6 +57,7 @@ protected:
void internalPresent() override;
void hmdPresent() override { throw std::runtime_error("Unused"); }
bool isHmdMounted() const override;
bool alwaysPresent() const override { return true; }
static const char* NAME;
mutable gl::Context* _mainContext{ nullptr };