summaryrefslogtreecommitdiff
path: root/vcl/source/opengl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-01-26 11:17:57 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-08 14:14:55 +0000
commit59ebd032b834f31f2b3069395f7e7962a0adfea2 (patch)
tree5a123cad10bad8c6c9ec0d1e17a002431b78ca5a /vcl/source/opengl
parent572252b562075825a0ee7e8b6c2421d16e48f98c (diff)
tdf#97633 Add API to get the number of OpenGL buffer swaps, including ...
... through UNO (cherry picked from commits dff18c2be9c72aa05940982f506804eb41d3d79a, 2c55288357c9d5410afae58c1fbb97cdfabf0360, 32d98b2551644dea50e58f99ae921a82a0f69753 and 4cd058f3f6568724c65ac88769f17fcc6078da23) Change-Id: Iff29ac615ad4b6516790b1cbbde0215a3cd0efe6 Reviewed-on: https://gerrit.libreoffice.org/22209 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl/source/opengl')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 82d987deeaae..bdd6a4e7e08e 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -11,6 +11,7 @@
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <vcl/opengl/OpenGLWrapper.hxx>
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
@@ -22,7 +23,8 @@
#if defined(MACOSX)
#include <premac.h>
-#include "OpenGLWrapper.hxx"
+#include <AppKit/NSOpenGLView.h>
+#include <AppKit/NSOpenGL.h>
#include <postmac.h>
#endif
@@ -49,6 +51,8 @@ static std::vector<GLXContext> g_vShareList;
static std::vector<HGLRC> g_vShareList;
#endif
+static sal_Int64 nBufferSwapCounter = 0;
+
GLWindow::~GLWindow()
{
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS)
@@ -991,7 +995,7 @@ bool OpenGLContext::ImplInit()
VCL_GL_INFO("OpenGLContext::ImplInit----start");
NSOpenGLView* pView = getOpenGLView();
- OpenGLWrapper::makeCurrent(pView);
+ [[pView openGLContext] makeCurrentContext];
bool bRet = InitGLEW();
InitGLEWDebugging();
@@ -1265,7 +1269,7 @@ void OpenGLContext::reset()
m_aGLWin.hRC = 0;
}
#elif defined( MACOSX )
- OpenGLWrapper::resetCurrent();
+ [NSOpenGLContext clearCurrentContext];
#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
// nothing
#elif defined( UNX )
@@ -1421,7 +1425,7 @@ void OpenGLContext::makeCurrent()
}
#elif defined( MACOSX )
NSOpenGLView* pView = getOpenGLView();
- OpenGLWrapper::makeCurrent(pView);
+ [[pView openGLContext] makeCurrentContext];
#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
// nothing
#elif defined( UNX )
@@ -1512,7 +1516,7 @@ void OpenGLContext::resetCurrent()
wglMakeCurrent(NULL, NULL);
#elif defined( MACOSX )
(void) this; // loplugin:staticmethods
- OpenGLWrapper::resetCurrent();
+ [NSOpenGLContext clearCurrentContext];
#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
// nothing
#elif defined( UNX )
@@ -1529,13 +1533,15 @@ void OpenGLContext::swapBuffers()
SwapBuffers(m_aGLWin.hDC);
#elif defined( MACOSX )
NSOpenGLView* pView = getOpenGLView();
- OpenGLWrapper::swapBuffers(pView);
+ [[pView openGLContext] flushBuffer];
#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
// nothing
#elif defined( UNX )
glXSwapBuffers(m_aGLWin.dpy, m_aGLWin.win);
#endif
+ nBufferSwapCounter++;
+
static bool bSleep = getenv("SAL_GL_SLEEP_ON_SWAP");
if (bSleep)
{
@@ -1545,6 +1551,11 @@ void OpenGLContext::swapBuffers()
}
}
+sal_Int64 OpenGLWrapper::getBufferSwapCounter()
+{
+ return nBufferSwapCounter;
+}
+
void OpenGLContext::sync()
{
OpenGLZone aZone;