mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 15:22:09 +02:00
OpenGlDisplayPlugin: Add possibility to present frames only once.
Don't present frame more than once in OpenXrDisplayPlugin.
This commit is contained in:
parent
479b1aa6da
commit
ae5c1d8d00
3 changed files with 10 additions and 0 deletions
|
@ -743,6 +743,13 @@ void OpenGLDisplayPlugin::present(const std::shared_ptr<RefreshRateController>&
|
|||
}
|
||||
|
||||
gpu::Backend::freeGPUMemSize.set(gpu::gl::getFreeDedicatedMemory());
|
||||
|
||||
// Drop current frame after presenting it once.
|
||||
// This is required for the OpenXR frame cycle, since we call xrEndFrame after presenting.
|
||||
// xrEndFrame must not be called multiple times.
|
||||
if (_presentOnlyOnce) {
|
||||
_currentFrame.reset();
|
||||
}
|
||||
} else if (alwaysPresent()) {
|
||||
refreshRateController->clockEndTime();
|
||||
internalPresent();
|
||||
|
|
|
@ -201,4 +201,6 @@ protected:
|
|||
|
||||
QImage getScreenshot(float aspectRatio);
|
||||
QImage getSecondaryCameraScreenshot();
|
||||
|
||||
bool _presentOnlyOnce = false;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ constexpr GLint XR_PREFERRED_COLOR_FORMAT = GL_SRGB8_ALPHA8;
|
|||
|
||||
OpenXrDisplayPlugin::OpenXrDisplayPlugin(std::shared_ptr<OpenXrContext> c) {
|
||||
_context = c;
|
||||
_presentOnlyOnce = true;
|
||||
}
|
||||
|
||||
bool OpenXrDisplayPlugin::isSupported() const {
|
||||
|
|
Loading…
Reference in a new issue