Avoid repeated QByteArray creation when resolving opengl functions
Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>bb10
parent
7ee585bbff
commit
29d8159c44
|
|
@ -1069,10 +1069,19 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
|
|||
Returns 0 if no such function can be found.
|
||||
*/
|
||||
QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) const
|
||||
{
|
||||
return getProcAddress(procName.constData());
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
\since 5.8
|
||||
*/
|
||||
QFunctionPointer QOpenGLContext::getProcAddress(const char *procName) const
|
||||
{
|
||||
Q_D(const QOpenGLContext);
|
||||
if (!d->platformGLContext)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return d->platformGLContext->getProcAddress(procName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ public:
|
|||
|
||||
void swapBuffers(QSurface *surface);
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) const;
|
||||
QFunctionPointer getProcAddress(const char *procName) const;
|
||||
|
||||
QSurface *surface() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,10 +71,9 @@ QT_BEGIN_NAMESPACE
|
|||
The implementation must support being called in a thread different than the gui-thread.
|
||||
*/
|
||||
|
||||
/*! \fn QFunctionPointer QPlatformOpenGLContext::getProcAddress(const QByteArray &procName)
|
||||
Reimplement in subclass to native getProcAddr calls.
|
||||
/*! \fn QFunctionPointer QPlatformOpenGLContext::getProcAddress(const char *procName)
|
||||
|
||||
Note: its convenient to use qPrintable(const QString &str) to get the const char * pointer
|
||||
Reimplement in subclass to native getProcAddr calls.
|
||||
*/
|
||||
|
||||
class QPlatformOpenGLContextPrivate
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public:
|
|||
virtual bool isSharing() const { return false; }
|
||||
virtual bool isValid() const { return true; }
|
||||
|
||||
virtual QFunctionPointer getProcAddress(const QByteArray &procName) = 0;
|
||||
virtual QFunctionPointer getProcAddress(const char *procName) = 0;
|
||||
|
||||
QOpenGLContext *context() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1379,7 +1379,7 @@ bool QOpenGLDebugLogger::initialize()
|
|||
|
||||
#define GET_DEBUG_PROC_ADDRESS(procName) \
|
||||
d->procName = reinterpret_cast< qt_ ## procName ## _t >( \
|
||||
d->context->getProcAddress(QByteArrayLiteral( #procName )) \
|
||||
d->context->getProcAddress(#procName) \
|
||||
);
|
||||
|
||||
GET_DEBUG_PROC_ADDRESS(glDebugMessageControl);
|
||||
|
|
|
|||
|
|
@ -2199,36 +2199,39 @@ private:
|
|||
|
||||
static QFunctionPointer getProcAddress(QOpenGLContext *context, const char *funcName, int policy)
|
||||
{
|
||||
QByteArray fn = funcName;
|
||||
int size = fn.size();
|
||||
QFunctionPointer function = context->getProcAddress(fn);
|
||||
QFunctionPointer function = context->getProcAddress(funcName);
|
||||
|
||||
// create room for the extension names
|
||||
fn.resize(size + 5);
|
||||
char *ext = fn.data() + size;
|
||||
if (!function && (policy & ResolveOES)) {
|
||||
memcpy(ext, "OES\0\0", 5);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
if (!function && policy) {
|
||||
char fn[512];
|
||||
size_t size = strlen(funcName);
|
||||
Q_ASSERT(size < 500);
|
||||
memcpy(fn, funcName, size);
|
||||
|
||||
if (!function) {
|
||||
memcpy(ext, "ARB\0\0", 5);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
char *ext = fn + size;
|
||||
if (!function && (policy & ResolveOES)) {
|
||||
memcpy(ext, "OES", 4);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
|
||||
if (!function && (policy & ResolveEXT)) {
|
||||
memcpy(ext, "EXT\0\0", 5);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
if (!function) {
|
||||
memcpy(ext, "ARB", 4);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
|
||||
if (!function && (policy & ResolveANGLE)) {
|
||||
memcpy(ext, "ANGLE", 5);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
if (!function && (policy & ResolveEXT)) {
|
||||
memcpy(ext, "EXT", 4);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
|
||||
if (!function && (policy & ResolveNV)) {
|
||||
memcpy(ext, "NV\0\0\0", 5);
|
||||
function = context->getProcAddress(fn);
|
||||
if (!function && (policy & ResolveANGLE)) {
|
||||
memcpy(ext, "ANGLE", 6);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
|
||||
if (!function && (policy & ResolveNV)) {
|
||||
memcpy(ext, "NV", 3);
|
||||
function = context->getProcAddress(fn);
|
||||
}
|
||||
}
|
||||
|
||||
return function;
|
||||
|
|
|
|||
|
|
@ -58,28 +58,28 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
|||
|
||||
if (allowDSA && !context->isOpenGLES()
|
||||
&& context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
|
||||
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
|
||||
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
|
||||
TextureParameterfEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLfloat )>(context->getProcAddress(QByteArrayLiteral("glTextureParameterfEXT")));
|
||||
TextureParameterfvEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLfloat *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterfvEXT")));
|
||||
GenerateTextureMipmapEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum )>(context->getProcAddress(QByteArrayLiteral("glGenerateTextureMipmapEXT")));
|
||||
TextureStorage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage3DEXT")));
|
||||
TextureStorage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage2DEXT")));
|
||||
TextureStorage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage1DEXT")));
|
||||
TextureStorage3DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage3DMultisampleEXT")));
|
||||
TextureStorage2DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage2DMultisampleEXT")));
|
||||
TextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DEXT")));
|
||||
TextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DEXT")));
|
||||
TextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage1DEXT")));
|
||||
TextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage3DEXT")));
|
||||
TextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage2DEXT")));
|
||||
TextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage1DEXT")));
|
||||
CompressedTextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage1DEXT")));
|
||||
CompressedTextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage2DEXT")));
|
||||
CompressedTextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage3DEXT")));
|
||||
CompressedTextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage1DEXT")));
|
||||
CompressedTextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage2DEXT")));
|
||||
CompressedTextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage3DEXT")));
|
||||
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress("glTextureParameteriEXT"));
|
||||
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress("glTextureParameterivEXT"));
|
||||
TextureParameterfEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLfloat )>(context->getProcAddress("glTextureParameterfEXT"));
|
||||
TextureParameterfvEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLfloat *)>(context->getProcAddress("glTextureParameterfvEXT"));
|
||||
GenerateTextureMipmapEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum )>(context->getProcAddress("glGenerateTextureMipmapEXT"));
|
||||
TextureStorage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress("glTextureStorage3DEXT"));
|
||||
TextureStorage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress("glTextureStorage2DEXT"));
|
||||
TextureStorage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress("glTextureStorage1DEXT"));
|
||||
TextureStorage3DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureStorage3DMultisampleEXT"));
|
||||
TextureStorage2DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureStorage2DMultisampleEXT"));
|
||||
TextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage3DEXT"));
|
||||
TextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage2DEXT"));
|
||||
TextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureImage1DEXT"));
|
||||
TextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage3DEXT"));
|
||||
TextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage2DEXT"));
|
||||
TextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTextureSubImage1DEXT"));
|
||||
CompressedTextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage1DEXT"));
|
||||
CompressedTextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage2DEXT"));
|
||||
CompressedTextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureSubImage3DEXT"));
|
||||
CompressedTextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage1DEXT"));
|
||||
CompressedTextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage2DEXT"));
|
||||
CompressedTextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTextureImage3DEXT"));
|
||||
|
||||
// Use the real DSA functions
|
||||
TextureParameteri = &QOpenGLTextureHelper::dsa_TextureParameteri;
|
||||
|
|
@ -133,8 +133,8 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
|||
// Some DSA functions are part of NV_texture_multisample instead
|
||||
if (!context->isOpenGLES()
|
||||
&& context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
|
||||
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
|
||||
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
|
||||
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureImage3DMultisampleNV"));
|
||||
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTextureImage2DMultisampleNV"));
|
||||
|
||||
TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;
|
||||
TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;
|
||||
|
|
@ -202,10 +202,10 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
|||
#endif
|
||||
|
||||
if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
|
||||
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES")));
|
||||
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES")));
|
||||
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES")));
|
||||
CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3DOES")));
|
||||
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress("glTexImage3DOES"));
|
||||
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress("glTexSubImage3DOES"));
|
||||
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress("glCompressedTexImage3DOES"));
|
||||
CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(context->getProcAddress("glCompressedTexSubImage3DOES"));
|
||||
} else {
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
if (ctx->isOpenGLES() && ctx->format().majorVersion() >= 3) {
|
||||
|
|
@ -217,41 +217,41 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
|||
CompressedTexSubImage3D = es3->CompressedTexSubImage3D;
|
||||
} else {
|
||||
// OpenGL 1.2
|
||||
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexImage3D")));
|
||||
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3D")));
|
||||
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage3D"));
|
||||
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage3D"));
|
||||
|
||||
// OpenGL 1.3
|
||||
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3D")));
|
||||
CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3D")));
|
||||
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage3D"));
|
||||
CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage3D"));
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
// OpenGL 1.3
|
||||
GetCompressedTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glGetCompressedTexImage")));
|
||||
CompressedTexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage1D")));
|
||||
CompressedTexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage2D")));
|
||||
CompressedTexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage1D")));
|
||||
CompressedTexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage2D")));
|
||||
ActiveTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress(QByteArrayLiteral("glActiveTexture")));
|
||||
GetCompressedTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLvoid *)>(context->getProcAddress("glGetCompressedTexImage"));
|
||||
CompressedTexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage1D"));
|
||||
CompressedTexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage2D"));
|
||||
CompressedTexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage1D"));
|
||||
CompressedTexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexImage2D"));
|
||||
ActiveTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress("glActiveTexture"));
|
||||
|
||||
// OpenGL 3.0
|
||||
GenerateMipmap = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress(QByteArrayLiteral("glGenerateMipmap")));
|
||||
GenerateMipmap = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress("glGenerateMipmap"));
|
||||
|
||||
// OpenGL 3.2
|
||||
TexImage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexImage3DMultisample")));
|
||||
TexImage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexImage2DMultisample")));
|
||||
TexImage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexImage3DMultisample"));
|
||||
TexImage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexImage2DMultisample"));
|
||||
|
||||
// OpenGL 4.2
|
||||
TexStorage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTexStorage3D")));
|
||||
TexStorage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTexStorage2D")));
|
||||
TexStorage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTexStorage1D")));
|
||||
TexStorage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress("glTexStorage3D"));
|
||||
TexStorage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress("glTexStorage2D"));
|
||||
TexStorage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress("glTexStorage1D"));
|
||||
|
||||
// OpenGL 4.3
|
||||
TexStorage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexStorage3DMultisample")));
|
||||
TexStorage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexStorage2DMultisample")));
|
||||
TexBufferRange = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLuint , GLintptr , GLsizeiptr )>(context->getProcAddress(QByteArrayLiteral("glTexBufferRange")));
|
||||
TextureView = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLuint , GLenum , GLuint , GLuint , GLuint , GLuint )>(context->getProcAddress(QByteArrayLiteral("glTextureView")));
|
||||
TexStorage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexStorage3DMultisample"));
|
||||
TexStorage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress("glTexStorage2DMultisample"));
|
||||
TexBufferRange = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLuint , GLintptr , GLsizeiptr )>(context->getProcAddress("glTexBufferRange"));
|
||||
TextureView = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLuint , GLenum , GLuint , GLuint , GLuint , GLuint )>(context->getProcAddress("glTextureView"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,26 +70,26 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper,
|
|||
helper->IsVertexArray = es3->IsVertexArray;
|
||||
tryARB = false;
|
||||
} else if (context->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
|
||||
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
|
||||
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
|
||||
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
|
||||
helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glIsVertexArrayOES")));
|
||||
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress("glGenVertexArraysOES"));
|
||||
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress("glDeleteVertexArraysOES"));
|
||||
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress("glBindVertexArrayOES"));
|
||||
helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress("glIsVertexArrayOES"));
|
||||
tryARB = false;
|
||||
}
|
||||
} else if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object")) &&
|
||||
!context->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
|
||||
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE")));
|
||||
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysAPPLE")));
|
||||
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayAPPLE")));
|
||||
helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glIsVertexArrayAPPLE")));
|
||||
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress("glGenVertexArraysAPPLE"));
|
||||
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress("glDeleteVertexArraysAPPLE"));
|
||||
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress("glBindVertexArrayAPPLE"));
|
||||
helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress("glIsVertexArrayAPPLE"));
|
||||
tryARB = false;
|
||||
}
|
||||
|
||||
if (tryARB && context->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) {
|
||||
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArrays")));
|
||||
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArrays")));
|
||||
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArray")));
|
||||
helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glIsVertexArray")));
|
||||
helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress("glGenVertexArrays"));
|
||||
helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress("glDeleteVertexArrays"));
|
||||
helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress("glBindVertexArray"));
|
||||
helper->IsVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_IsVertexArray_t>(context->getProcAddress("glIsVertexArray"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,17 +43,17 @@
|
|||
#include <AppKit/AppKit.h>
|
||||
#include <QVector>
|
||||
|
||||
void (*qcgl_getProcAddress(const QByteArray &procName))()
|
||||
QFunctionPointer qcgl_getProcAddress(const char *procName)
|
||||
{
|
||||
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
|
||||
CFSTR("/System/Library/Frameworks/OpenGL.framework"), kCFURLPOSIXPathStyle, false);
|
||||
CFBundleRef bundle = CFBundleCreate(kCFAllocatorDefault, url);
|
||||
CFStringRef procNameCF = QCFString::toCFStringRef(QString::fromLatin1(procName.constData()));
|
||||
CFStringRef procNameCF = QCFString::toCFStringRef(QString::fromLatin1(procName));
|
||||
void *proc = CFBundleGetFunctionPointerForName(bundle, procNameCF);
|
||||
CFRelease(url);
|
||||
CFRelease(bundle);
|
||||
CFRelease(procNameCF);
|
||||
return (void (*) ())proc;
|
||||
return (QFunctionPointer)proc;
|
||||
}
|
||||
|
||||
// Match up with createNSOpenGLPixelFormat below!
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
#include <QString>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
void (*qcgl_getProcAddress(const QByteArray &procName))();
|
||||
QFunctionPointer qcgl_getProcAddress(const char *procName);
|
||||
QSurfaceFormat qcgl_surfaceFormat();
|
||||
void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format);
|
||||
|
||||
|
|
|
|||
|
|
@ -440,10 +440,10 @@ void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface)
|
|||
}
|
||||
}
|
||||
|
||||
void (*QEGLPlatformContext::getProcAddress(const QByteArray &procName)) ()
|
||||
QFunctionPointer QEGLPlatformContext::getProcAddress(const char *procName)
|
||||
{
|
||||
eglBindAPI(m_api);
|
||||
return eglGetProcAddress(procName.constData());
|
||||
return eglGetProcAddress(procName);
|
||||
}
|
||||
|
||||
QSurfaceFormat QEGLPlatformContext::format() const
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
void doneCurrent() Q_DECL_OVERRIDE;
|
||||
void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
QSurfaceFormat format() const Q_DECL_OVERRIDE;
|
||||
bool isSharing() const Q_DECL_OVERRIDE { return m_shareContext != EGL_NO_CONTEXT; }
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
void doneCurrent() Q_DECL_OVERRIDE;
|
||||
|
||||
void (*getProcAddress(const QByteArray &procName)) () Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
void update();
|
||||
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ void QCocoaGLContext::doneCurrent()
|
|||
[NSOpenGLContext clearCurrentContext];
|
||||
}
|
||||
|
||||
void (*QCocoaGLContext::getProcAddress(const QByteArray &procName))()
|
||||
QFunctionPointer QCocoaGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
return qcgl_getProcAddress(procName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ void QDirectFbGLContext::doneCurrent()
|
|||
m_dfbGlContext->Unlock(m_dfbGlContext);
|
||||
}
|
||||
|
||||
void *QDirectFbGLContext::getProcAddress(const QString &procName)
|
||||
void *QDirectFbGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
void *proc;
|
||||
DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext,qPrintable(procName),&proc);
|
||||
DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext, procName, &proc);
|
||||
if (result == DFB_OK)
|
||||
return proc;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public:
|
|||
void doneCurrent() Q_DECL_OVERRIDE;
|
||||
|
||||
GLuint defaultFramebufferObject(QPlatformSurface *) const Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
bool isSharing() const Q_DECL_OVERRIDE;
|
||||
bool isValid() const Q_DECL_OVERRIDE;
|
||||
|
|
|
|||
|
|
@ -266,9 +266,9 @@ void QIOSContext::windowDestroyed(QObject *object)
|
|||
}
|
||||
}
|
||||
|
||||
QFunctionPointer QIOSContext::getProcAddress(const QByteArray& functionName)
|
||||
QFunctionPointer QIOSContext::getProcAddress(const char *functionName)
|
||||
{
|
||||
return QFunctionPointer(dlsym(RTLD_DEFAULT, functionName.constData()));
|
||||
return QFunctionPointer(dlsym(RTLD_DEFAULT, functionName));
|
||||
}
|
||||
|
||||
bool QIOSContext::isValid() const
|
||||
|
|
|
|||
|
|
@ -143,12 +143,12 @@ void QMirClientOpenGLContext::swapBuffers(QPlatformSurface* surface)
|
|||
ubuntuWindow->onSwapBuffersDone();
|
||||
}
|
||||
|
||||
void (*QMirClientOpenGLContext::getProcAddress(const QByteArray& procName)) ()
|
||||
QFunctionPointer QMirClientOpenGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
#if defined(QT_NO_DEBUG)
|
||||
eglBindAPI(api_in_use());
|
||||
#else
|
||||
ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE);
|
||||
#endif
|
||||
return eglGetProcAddress(procName.constData());
|
||||
return eglGetProcAddress(procName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface* surface) override;
|
||||
void doneCurrent() override;
|
||||
bool isValid() const override { return mEglContext != EGL_NO_CONTEXT; }
|
||||
void (*getProcAddress(const QByteArray& procName)) () override;
|
||||
QFunctionPointer getProcAddress(const char *procName) override;
|
||||
|
||||
EGLContext eglContext() const { return mEglContext; }
|
||||
|
||||
|
|
|
|||
|
|
@ -227,9 +227,9 @@ void QOffscreenX11GLXContext::swapBuffers(QPlatformSurface *)
|
|||
{
|
||||
}
|
||||
|
||||
void (*QOffscreenX11GLXContext::getProcAddress(const QByteArray &procName)) ()
|
||||
QFunctionPointer QOffscreenX11GLXContext::getProcAddress(const char *procName)
|
||||
{
|
||||
return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData()));
|
||||
return (QFunctionPointer)glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName));
|
||||
}
|
||||
|
||||
QSurfaceFormat QOffscreenX11GLXContext::format() const
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
void doneCurrent() Q_DECL_OVERRIDE;
|
||||
void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
QSurfaceFormat format() const Q_DECL_OVERRIDE;
|
||||
bool isSharing() const Q_DECL_OVERRIDE;
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ void QOpenWFDGLContext::swapBuffers(QPlatformSurface *surface)
|
|||
screen->swapBuffers();
|
||||
}
|
||||
|
||||
void (*QOpenWFDGLContext::getProcAddress(const QByteArray &procName)) ()
|
||||
QFunctionPointer QOpenWFDGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
return eglGetProcAddress(procName.data());
|
||||
return eglGetProcAddress(procName);
|
||||
}
|
||||
|
||||
EGLContext QOpenWFDGLContext::eglContext() const
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
void swapBuffers(QPlatformSurface *surface);
|
||||
|
||||
void (*getProcAddress(const QByteArray &procName)) ();
|
||||
QFunctionPointer getProcAddress(const char *procName);
|
||||
|
||||
EGLContext eglContext() const;
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ void QQnxGLContext::swapBuffers(QPlatformSurface *surface)
|
|||
platformWindow->swapEGLBuffers();
|
||||
}
|
||||
|
||||
QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName)
|
||||
QFunctionPointer QQnxGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
qGLContextDebug();
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName)
|
|||
qFatal("QQNX: failed to set EGL API, err=%d", eglGetError());
|
||||
|
||||
// Lookup EGL extension function pointer
|
||||
return static_cast<QFunctionPointer>(eglGetProcAddress(procName.constData()));
|
||||
return static_cast<QFunctionPointer>(eglGetProcAddress(procName));
|
||||
}
|
||||
|
||||
bool QQnxGLContext::isSharing() const
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface *surface);
|
||||
void doneCurrent();
|
||||
void swapBuffers(QPlatformSurface *surface);
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName);
|
||||
QFunctionPointer getProcAddress(const char *procName);
|
||||
|
||||
virtual QSurfaceFormat format() const { return m_windowFormat; }
|
||||
bool isSharing() const;
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ void QWindowsEGLContext::swapBuffers(QPlatformSurface *surface)
|
|||
}
|
||||
}
|
||||
|
||||
QFunctionPointer QWindowsEGLContext::getProcAddress(const QByteArray &procName)
|
||||
QFunctionPointer QWindowsEGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
// We support AllGLFunctionsQueryable, which means this function must be able to
|
||||
// return a function pointer for standard GLES2 functions too. These are not
|
||||
|
|
@ -838,15 +838,15 @@ QFunctionPointer QWindowsEGLContext::getProcAddress(const QByteArray &procName)
|
|||
{ "glDepthRangef", (void *) QWindowsEGLStaticContext::libGLESv2.glDepthRangef }
|
||||
};
|
||||
for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i)
|
||||
if (procName == standardFuncs[i].name)
|
||||
if (!qstrcmp(procName, standardFuncs[i].name))
|
||||
return reinterpret_cast<QFunctionPointer>(standardFuncs[i].func);
|
||||
|
||||
QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api);
|
||||
QFunctionPointer procAddress = reinterpret_cast<QFunctionPointer>(QWindowsEGLStaticContext::libEGL.eglGetProcAddress(procName.constData()));
|
||||
QFunctionPointer procAddress = reinterpret_cast<QFunctionPointer>(QWindowsEGLStaticContext::libEGL.eglGetProcAddress(procName));
|
||||
if (QWindowsContext::verbose > 1)
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << procName << QWindowsEGLStaticContext::libEGL.eglGetCurrentContext() << "returns" << procAddress;
|
||||
if (!procAddress && QWindowsContext::verbose)
|
||||
qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName.constData());
|
||||
qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName);
|
||||
return procAddress;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
void doneCurrent() Q_DECL_OVERRIDE;
|
||||
void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
|
||||
bool isSharing() const Q_DECL_OVERRIDE { return m_shareContext != EGL_NO_CONTEXT; }
|
||||
|
|
|
|||
|
|
@ -1381,7 +1381,7 @@ void QWindowsGLContext::doneCurrent()
|
|||
releaseDCs();
|
||||
}
|
||||
|
||||
QFunctionPointer QWindowsGLContext::getProcAddress(const QByteArray &procName)
|
||||
QFunctionPointer QWindowsGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
// We support AllGLFunctionsQueryable, which means this function must be able to
|
||||
// return a function pointer even for functions that are in GL.h and exported
|
||||
|
|
@ -1444,17 +1444,17 @@ QFunctionPointer QWindowsGLContext::getProcAddress(const QByteArray &procName)
|
|||
{ "glDepthRange", (void *) QOpenGLStaticContext::opengl32.glDepthRange },
|
||||
};
|
||||
for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i)
|
||||
if (procName == standardFuncs[i].name)
|
||||
if (!qstrcmp(procName, standardFuncs[i].name))
|
||||
return reinterpret_cast<QFunctionPointer>(standardFuncs[i].func);
|
||||
|
||||
// Even though we use QFunctionPointer, it does not mean the function can be called.
|
||||
// It will need to be cast to the proper function type with the correct calling
|
||||
// convention. QFunctionPointer is nothing more than a glorified void* here.
|
||||
QFunctionPointer procAddress = reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress(procName.constData()));
|
||||
QFunctionPointer procAddress = reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.wglGetProcAddress(procName));
|
||||
if (QWindowsContext::verbose > 1)
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << procName << QOpenGLStaticContext::opengl32.wglGetCurrentContext() << "returns" << procAddress;
|
||||
if (!procAddress && QWindowsContext::verbose)
|
||||
qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName.constData());
|
||||
qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName);
|
||||
return procAddress;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ public:
|
|||
|
||||
typedef void (*GL_Proc) ();
|
||||
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
HGLRC renderingContext() const { return m_renderingContext; }
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ QSurfaceFormat QWinRTEGLContext::format() const
|
|||
return d->format;
|
||||
}
|
||||
|
||||
QFunctionPointer QWinRTEGLContext::getProcAddress(const QByteArray &procName)
|
||||
QFunctionPointer QWinRTEGLContext::getProcAddress(const char *procName)
|
||||
{
|
||||
static QHash<QByteArray, QFunctionPointer> standardFuncs;
|
||||
if (standardFuncs.isEmpty()) {
|
||||
|
|
@ -347,7 +347,7 @@ QFunctionPointer QWinRTEGLContext::getProcAddress(const QByteArray &procName)
|
|||
if (i != standardFuncs.end())
|
||||
return i.value();
|
||||
|
||||
return eglGetProcAddress(procName.constData());
|
||||
return eglGetProcAddress(procName);
|
||||
}
|
||||
|
||||
EGLDisplay QWinRTEGLContext::display()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
void swapBuffers(QPlatformSurface *windowSurface) Q_DECL_OVERRIDE;
|
||||
|
||||
QSurfaceFormat format() const Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
static EGLDisplay display();
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -550,10 +550,10 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface)
|
|||
}
|
||||
}
|
||||
|
||||
void (*QGLXContext::getProcAddress(const QByteArray &procName)) ()
|
||||
QFunctionPointer QGLXContext::getProcAddress(const char *procName)
|
||||
{
|
||||
#ifdef QT_STATIC
|
||||
return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData()));
|
||||
return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName));
|
||||
#else
|
||||
typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *);
|
||||
static qt_glXGetProcAddressARB glXGetProcAddressARB = 0;
|
||||
|
|
@ -585,7 +585,7 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) ()
|
|||
}
|
||||
if (!glXGetProcAddressARB)
|
||||
return 0;
|
||||
return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData()));
|
||||
return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
void doneCurrent() Q_DECL_OVERRIDE;
|
||||
void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE;
|
||||
QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
|
||||
|
||||
QSurfaceFormat format() const Q_DECL_OVERRIDE;
|
||||
bool isSharing() const Q_DECL_OVERRIDE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue