From be83a08c3b2fd624ef1b0deaa6c24bbc857dd9f9 Mon Sep 17 00:00:00 2001 From: Tom Poole Date: Fri, 1 Feb 2019 13:00:08 +0000 Subject: [PATCH] Added an assertion to check the OpenGL swap interval on MacOS --- modules/juce_core/containers/juce_AbstractFifo.h | 2 +- modules/juce_opengl/native/juce_OpenGL_osx.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/containers/juce_AbstractFifo.h b/modules/juce_core/containers/juce_AbstractFifo.h index e1aaedcb6f..ef001e6bb6 100644 --- a/modules/juce_core/containers/juce_AbstractFifo.h +++ b/modules/juce_core/containers/juce_AbstractFifo.h @@ -331,7 +331,7 @@ inline void AbstractFifo::ScopedReadWrite::fin { f.finishedWrite (num); } - + template<> inline void AbstractFifo::ScopedReadWrite::prepare (AbstractFifo& f, int num) noexcept { diff --git a/modules/juce_opengl/native/juce_OpenGL_osx.h b/modules/juce_opengl/native/juce_OpenGL_osx.h index 651b4f88f1..ea209d8293 100644 --- a/modules/juce_opengl/native/juce_OpenGL_osx.h +++ b/modules/juce_opengl/native/juce_OpenGL_osx.h @@ -200,6 +200,10 @@ public: bool setSwapInterval (int numFramesPerSwap) { + // The macOS OpenGL programming guide says that numFramesPerSwap + // can only be 0 or 1. + jassert (isPositiveAndBelow (numFramesPerSwap, 2)); + minSwapTimeMs = (numFramesPerSwap * 1000) / 60; [renderContext setValues: (const GLint*) &numFramesPerSwap