Ensure we can query all GL functions in all platform plugins
This is required to simplify our code in the opengl classes and makes it possible to remove OS dependent code paths in Qt Gui. Change-Id: Ice09440840c86b2d6ac8d3955d273846695338d4 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
parent
c69622fc60
commit
5e9a5246fb
@ -224,7 +224,8 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
platforms where no window management is available, meaning for example that windows
|
||||
are never repositioned by the window manager. The default implementation returns \c true.
|
||||
|
||||
\value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is
|
||||
\value AllGLFunctionsQueryable Deprecated. Used to indicate whether the QOpenGLContext
|
||||
backend provided by the platform is
|
||||
able to return function pointers from getProcAddress() even for standard OpenGL
|
||||
functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is
|
||||
important because the OpenGL specifications do not require this ability from the
|
||||
@ -232,7 +233,8 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
platform plugins may however choose to enhance the behavior in the backend
|
||||
implementation for QOpenGLContext::getProcAddress() and support returning a function
|
||||
pointer also for the standard, non-extension functions. This capability is a
|
||||
prerequisite for dynamic OpenGL loading.
|
||||
prerequisite for dynamic OpenGL loading. Starting with Qt 5.7, the platform plugin
|
||||
is required to have this capability.
|
||||
|
||||
\value ApplicationIcon The platform supports setting the application icon. (since 5.5)
|
||||
*/
|
||||
|
@ -73,7 +73,9 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
/*! \fn QFunctionPointer QPlatformOpenGLContext::getProcAddress(const char *procName)
|
||||
|
||||
Reimplement in subclass to native getProcAddr calls.
|
||||
Reimplement in subclass to allow dynamic querying of OpenGL symbols. As opposed to e.g. the wglGetProcAddress
|
||||
function on Windows, Qt expects this methods to be able to return valid function pointers even for standard
|
||||
OpenGL symbols.
|
||||
*/
|
||||
|
||||
class QPlatformOpenGLContextPrivate
|
||||
|
@ -26,4 +26,6 @@ contains(QT_CONFIG,egl) {
|
||||
LIBS_PRIVATE += $$QMAKE_LIBS_X11
|
||||
}
|
||||
CONFIG += egl
|
||||
|
||||
LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
|
||||
}
|
||||
|
@ -48,6 +48,9 @@
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QtCore/private/qjnihelpers_p.h>
|
||||
#endif
|
||||
#ifndef Q_OS_WIN
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -443,7 +446,12 @@ void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface)
|
||||
QFunctionPointer QEGLPlatformContext::getProcAddress(const char *procName)
|
||||
{
|
||||
eglBindAPI(m_api);
|
||||
return eglGetProcAddress(procName);
|
||||
QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
|
||||
#ifndef Q_OS_WIN
|
||||
if (!proc)
|
||||
proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
|
||||
#endif
|
||||
return proc;
|
||||
}
|
||||
|
||||
QSurfaceFormat QEGLPlatformContext::format() const
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "qdirectfbglcontext.h"
|
||||
|
||||
#include <directfbgl.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -80,13 +81,13 @@ void QDirectFbGLContext::doneCurrent()
|
||||
m_dfbGlContext->Unlock(m_dfbGlContext);
|
||||
}
|
||||
|
||||
void *QDirectFbGLContext::getProcAddress(const char *procName)
|
||||
QFunctionPointer QDirectFbGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
void *proc;
|
||||
DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext, procName, &proc);
|
||||
if (result == DFB_OK)
|
||||
return proc;
|
||||
return 0;
|
||||
return (QFunctionPointer) proc;
|
||||
return dlsym(RTLD_DEFAULT, procName);
|
||||
}
|
||||
|
||||
void QDirectFbGLContext::swapBuffers()
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "qmirclientlogging.h"
|
||||
#include <QtPlatformSupport/private/qeglconvenience_p.h>
|
||||
#include <QtGui/private/qopenglcontext_p.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
static void printOpenGLESConfig() {
|
||||
@ -150,5 +151,8 @@ QFunctionPointer QMirClientOpenGLContext::getProcAddress(const char *procName)
|
||||
#else
|
||||
ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
|
||||
#endif
|
||||
return eglGetProcAddress(procName);
|
||||
QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
|
||||
if (!proc)
|
||||
proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
|
||||
return proc;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "qopenwfdwindow.h"
|
||||
#include "qopenwfdscreen.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
QOpenWFDGLContext::QOpenWFDGLContext(QOpenWFDDevice *device)
|
||||
: QPlatformOpenGLContext()
|
||||
@ -86,7 +87,10 @@ void QOpenWFDGLContext::swapBuffers(QPlatformSurface *surface)
|
||||
|
||||
QFunctionPointer QOpenWFDGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
return eglGetProcAddress(procName);
|
||||
QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName);
|
||||
if (!proc)
|
||||
proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName);
|
||||
return proc;
|
||||
}
|
||||
|
||||
EGLContext QOpenWFDGLContext::eglContext() const
|
||||
|
Loading…
Reference in New Issue
Block a user