diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/opengl/qopengldebug.cpp | 12 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexturehelper.cpp | 15 | ||||
-rw-r--r-- | src/gui/opengl/qopenglversionfunctions.cpp | 26 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowseglcontext.cpp | 476 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowseglcontext.h | 148 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.cpp | 126 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.h | 48 |
7 files changed, 189 insertions, 662 deletions
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index 7bdf6ee443..24aa6094dd 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -1388,19 +1388,7 @@ bool QOpenGLDebugLogger::initialize() GET_DEBUG_PROC_ADDRESS(glGetDebugMessageLog); GET_DEBUG_PROC_ADDRESS(glPushDebugGroup); GET_DEBUG_PROC_ADDRESS(glPopDebugGroup); - - // Windows' Desktop GL doesn't allow resolution of "basic GL entry points" - // through wglGetProcAddress -#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) - { - HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle()); - if (!handle) - handle = GetModuleHandleA("opengl32.dll"); - d->glGetPointerv = reinterpret_cast<qt_glGetPointerv_t>(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv"))); - } -#else GET_DEBUG_PROC_ADDRESS(glGetPointerv) -#endif #undef GET_DEBUG_PROC_ADDRESS diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 23e5ef6579..be88946e90 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -143,17 +143,6 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample; } -#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) - // wglGetProcAddress should not be used to (and indeed will not) load OpenGL <= 1.1 functions. - // Hence, we resolve them "the hard way" - HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle()); - if (!handle) - handle = GetModuleHandleA("opengl32.dll"); - - TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexImage1D"))); - TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexSubImage1D"))); -#endif - #if defined(QT_OPENGL_ES_2) // Here we are targeting OpenGL ES 2.0+ only. This is likely using EGL, where, // similarly to WGL, non-extension functions (i.e. any function that is part of the @@ -227,6 +216,10 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) } #ifndef QT_OPENGL_ES_2 + // OpenGL 1.0 and 1.1 + TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage1D")); + TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage1D"));\ + // OpenGL 1.3 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")); diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp index 3fba00bc47..9fa224b0aa 100644 --- a/src/gui/opengl/qopenglversionfunctions.cpp +++ b/src/gui/opengl/qopenglversionfunctions.cpp @@ -67,24 +67,6 @@ void CLASS::init() \ } \ } -#ifdef Q_OS_WIN -#define QT_OPENGL_IMPLEMENT_WIN(CLASS, FUNCTIONS) \ -void CLASS::init() \ -{ \ - HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle()); \ - if (!handle) \ - handle = GetModuleHandleA("opengl32.dll"); \ - const char *names = FUNCTIONS(QT_OPENGL_FUNCTION_NAMES); \ - const char *name = names; \ - for (int i = 0; i < FUNCTIONS(QT_OPENGL_COUNT_FUNCTIONS); ++i) { \ - functions[i] = (QFunctionPointer)GetProcAddress(handle, name); \ - name += strlen(name) + 1; \ - } \ -} -#else -#define QT_OPENGL_IMPLEMENT_WIN QT_OPENGL_IMPLEMENT -#endif - QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage() : backends(0) { @@ -325,8 +307,8 @@ QOpenGLContext *QAbstractOpenGLFunctions::owningContext() const #if !defined(QT_OPENGL_ES_2) -QT_OPENGL_IMPLEMENT_WIN(QOpenGLFunctions_1_0_CoreBackend, QT_OPENGL_1_0_FUNCTIONS) -QT_OPENGL_IMPLEMENT_WIN(QOpenGLFunctions_1_1_CoreBackend, QT_OPENGL_1_1_FUNCTIONS) +QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_0_CoreBackend, QT_OPENGL_1_0_FUNCTIONS) +QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_1_CoreBackend, QT_OPENGL_1_1_FUNCTIONS) QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_2_CoreBackend, QT_OPENGL_1_2_FUNCTIONS) QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_3_CoreBackend, QT_OPENGL_1_3_FUNCTIONS) @@ -345,8 +327,8 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_3_CoreBackend, QT_OPENGL_4_3_FUNCTIONS) QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_4_CoreBackend, QT_OPENGL_4_4_FUNCTIONS) QT_OPENGL_IMPLEMENT(QOpenGLFunctions_4_5_CoreBackend, QT_OPENGL_4_5_FUNCTIONS) -QT_OPENGL_IMPLEMENT_WIN(QOpenGLFunctions_1_0_DeprecatedBackend, QT_OPENGL_1_0_DEPRECATED_FUNCTIONS) -QT_OPENGL_IMPLEMENT_WIN(QOpenGLFunctions_1_1_DeprecatedBackend, QT_OPENGL_1_1_DEPRECATED_FUNCTIONS) +QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_0_DeprecatedBackend, QT_OPENGL_1_0_DEPRECATED_FUNCTIONS) +QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_1_DeprecatedBackend, QT_OPENGL_1_1_DEPRECATED_FUNCTIONS) QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_2_DeprecatedBackend, QT_OPENGL_1_2_DEPRECATED_FUNCTIONS) QT_OPENGL_IMPLEMENT(QOpenGLFunctions_1_3_DeprecatedBackend, QT_OPENGL_1_3_DEPRECATED_FUNCTIONS) diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 253fa1d217..87800283ee 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -107,11 +107,7 @@ static void *resolveFunc(HMODULE lib, const char *name) void *QWindowsLibEGL::resolve(const char *name) { - void *proc = m_lib ? resolveFunc(m_lib, name) : 0; - if (!proc) - qErrnoWarning(::GetLastError(), "Failed to resolve EGL function %s", name); - - return proc; + return m_lib ? resolveFunc(m_lib, name) : 0; } #endif // !QT_STATIC @@ -174,11 +170,7 @@ bool QWindowsLibEGL::init() #if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) void *QWindowsLibGLESv2::resolve(const char *name) { - void *proc = m_lib ? resolveFunc(m_lib, name) : 0; - if (!proc) - qWarning() << "Failed to resolve OpenGL ES function" << name; - - return proc; + return m_lib ? resolveFunc(m_lib, name) : 0; } #endif // !QT_STATIC @@ -200,150 +192,10 @@ bool QWindowsLibGLESv2::init() } #endif // !QT_STATIC - glBindTexture = RESOLVE((void (APIENTRY *)(GLenum , GLuint )), glBindTexture); - glBlendFunc = RESOLVE((void (APIENTRY *)(GLenum , GLenum )), glBlendFunc); - glClear = RESOLVE((void (APIENTRY *)(GLbitfield )), glClear); - glClearColor = RESOLVE((void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )), glClearColor); - glClearStencil = RESOLVE((void (APIENTRY *)(GLint )), glClearStencil); - glColorMask = RESOLVE((void (APIENTRY *)(GLboolean , GLboolean , GLboolean , GLboolean )), glColorMask); - glCopyTexImage2D = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLenum , GLint , GLint , GLsizei , GLsizei , GLint )), glCopyTexImage2D); - glCopyTexSubImage2D = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLint , GLint , GLsizei , GLsizei )), glCopyTexSubImage2D); - glCullFace = RESOLVE((void (APIENTRY *)(GLenum )), glCullFace); - glDeleteTextures = RESOLVE((void (APIENTRY *)(GLsizei , const GLuint *)), glDeleteTextures); - glDepthFunc = RESOLVE((void (APIENTRY *)(GLenum )), glDepthFunc); - glDepthMask = RESOLVE((void (APIENTRY *)(GLboolean )), glDepthMask); - glDisable = RESOLVE((void (APIENTRY *)(GLenum )), glDisable); - glDrawArrays = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLsizei )), glDrawArrays); - glDrawElements = RESOLVE((void (APIENTRY *)(GLenum , GLsizei , GLenum , const GLvoid *)), glDrawElements); - glEnable = RESOLVE((void (APIENTRY *)(GLenum )), glEnable); - glFinish = RESOLVE((void (APIENTRY *)()), glFinish); - glFlush = RESOLVE((void (APIENTRY *)()), glFlush); - glFrontFace = RESOLVE((void (APIENTRY *)(GLenum )), glFrontFace); - glGenTextures = RESOLVE((void (APIENTRY *)(GLsizei , GLuint *)), glGenTextures); - glGetBooleanv = RESOLVE((void (APIENTRY *)(GLenum , GLboolean *)), glGetBooleanv); - glGetError = RESOLVE((GLenum (APIENTRY *)()), glGetError); - glGetFloatv = RESOLVE((void (APIENTRY *)(GLenum , GLfloat *)), glGetFloatv); - glGetIntegerv = RESOLVE((void (APIENTRY *)(GLenum , GLint *)), glGetIntegerv); + void (APIENTRY * glBindTexture)(GLenum target, GLuint texture) = RESOLVE((void (APIENTRY *)(GLenum , GLuint )), glBindTexture); + GLuint (APIENTRY * glCreateShader)(GLenum type) = RESOLVE((GLuint (APIENTRY *)(GLenum )), glCreateShader); + void (APIENTRY * glClearDepthf)(GLclampf depth) = RESOLVE((void (APIENTRY *)(GLclampf )), glClearDepthf); glGetString = RESOLVE((const GLubyte * (APIENTRY *)(GLenum )), glGetString); - glGetTexParameterfv = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLfloat *)), glGetTexParameterfv); - glGetTexParameteriv = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLint *)), glGetTexParameteriv); - glHint = RESOLVE((void (APIENTRY *)(GLenum , GLenum )), glHint); - glIsEnabled = RESOLVE((GLboolean (APIENTRY *)(GLenum )), glIsEnabled); - glIsTexture = RESOLVE((GLboolean (APIENTRY *)(GLuint )), glIsTexture); - glLineWidth = RESOLVE((void (APIENTRY *)(GLfloat )), glLineWidth); - glPixelStorei = RESOLVE((void (APIENTRY *)(GLenum , GLint )), glPixelStorei); - glPolygonOffset = RESOLVE((void (APIENTRY *)(GLfloat , GLfloat )), glPolygonOffset); - glReadPixels = RESOLVE((void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , GLvoid *)), glReadPixels); - glScissor = RESOLVE((void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei )), glScissor); - glStencilFunc = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLuint )), glStencilFunc); - glStencilMask = RESOLVE((void (APIENTRY *)(GLuint )), glStencilMask); - glStencilOp = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLenum )), glStencilOp); - glTexImage2D = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLint , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)), glTexImage2D); - glTexParameterf = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLfloat )), glTexParameterf); - glTexParameterfv = RESOLVE((void (APIENTRY *)(GLenum , GLenum , const GLfloat *)), glTexParameterfv); - glTexParameteri = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLint )), glTexParameteri); - glTexParameteriv = RESOLVE((void (APIENTRY *)(GLenum , GLenum , const GLint *)), glTexParameteriv); - glTexSubImage2D = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)), glTexSubImage2D); - glViewport = RESOLVE((void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei )), glViewport); - - glActiveTexture = RESOLVE((void (APIENTRY *)(GLenum)), glActiveTexture); - glAttachShader = RESOLVE((void (APIENTRY *)(GLuint , GLuint )), glAttachShader); - glBindAttribLocation = RESOLVE((void (APIENTRY *)(GLuint , GLuint , const GLchar* )), glBindAttribLocation); - glBindBuffer = RESOLVE((void (APIENTRY *)(GLenum , GLuint )), glBindBuffer); - glBindFramebuffer = RESOLVE((void (APIENTRY *)(GLenum , GLuint )), glBindFramebuffer); - glBindRenderbuffer = RESOLVE((void (APIENTRY *)(GLenum , GLuint )), glBindRenderbuffer); - glBlendColor = RESOLVE((void (APIENTRY *)(GLclampf , GLclampf , GLclampf , GLclampf )), glBlendColor); - glBlendEquation = RESOLVE((void (APIENTRY *)(GLenum )), glBlendEquation); - glBlendEquationSeparate = RESOLVE((void (APIENTRY *)(GLenum , GLenum )), glBlendEquationSeparate); - glBlendFuncSeparate = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLenum , GLenum )), glBlendFuncSeparate); - glBufferData = RESOLVE((void (APIENTRY *)(GLenum , qopengl_GLsizeiptr , const GLvoid* , GLenum )), glBufferData); - glBufferSubData = RESOLVE((void (APIENTRY *)(GLenum , qopengl_GLintptr , qopengl_GLsizeiptr , const GLvoid* )), glBufferSubData); - glCheckFramebufferStatus = RESOLVE((GLenum (APIENTRY *)(GLenum )), glCheckFramebufferStatus); - glCompileShader = RESOLVE((void (APIENTRY *)(GLuint )), glCompileShader); - glCompressedTexImage2D = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLenum , GLsizei , GLsizei, GLint, GLsizei, const GLvoid* )), glCompressedTexImage2D); - glCompressedTexSubImage2D = RESOLVE((void (APIENTRY *)(GLenum , GLint , GLint , GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid* )), glCompressedTexSubImage2D); - glCreateProgram = RESOLVE((GLuint (APIENTRY *)(void)), glCreateProgram); - glCreateShader = RESOLVE((GLuint (APIENTRY *)(GLenum )), glCreateShader); - glDeleteBuffers = RESOLVE((void (APIENTRY *)(GLsizei , const GLuint*)), glDeleteBuffers); - glDeleteFramebuffers = RESOLVE((void (APIENTRY *)(GLsizei , const GLuint* )), glDeleteFramebuffers); - glDeleteProgram = RESOLVE((void (APIENTRY *)(GLuint )), glDeleteProgram); - glDeleteRenderbuffers = RESOLVE((void (APIENTRY *)(GLsizei , const GLuint* )), glDeleteRenderbuffers); - glDeleteShader = RESOLVE((void (APIENTRY *)(GLuint )), glDeleteShader); - glDetachShader = RESOLVE((void (APIENTRY *)(GLuint , GLuint )), glDetachShader); - glDisableVertexAttribArray = RESOLVE((void (APIENTRY *)(GLuint )), glDisableVertexAttribArray); - glEnableVertexAttribArray = RESOLVE((void (APIENTRY *)(GLuint )), glEnableVertexAttribArray); - glFramebufferRenderbuffer = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLenum , GLuint )), glFramebufferRenderbuffer); - glFramebufferTexture2D = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLenum , GLuint , GLint )), glFramebufferTexture2D); - glGenBuffers = RESOLVE((void (APIENTRY *)(GLsizei , GLuint* )), glGenBuffers); - glGenerateMipmap = RESOLVE((void (APIENTRY *)(GLenum )), glGenerateMipmap); - glGenFramebuffers = RESOLVE((void (APIENTRY *)(GLsizei , GLuint* )), glGenFramebuffers); - glGenRenderbuffers = RESOLVE((void (APIENTRY *)(GLsizei , GLuint* )), glGenRenderbuffers); - glGetActiveAttrib = RESOLVE((void (APIENTRY *)(GLuint , GLuint , GLsizei , GLsizei* , GLint* , GLenum* , GLchar* )), glGetActiveAttrib); - glGetActiveUniform = RESOLVE((void (APIENTRY *)(GLuint , GLuint , GLsizei , GLsizei* , GLint* , GLenum* , GLchar* )), glGetActiveUniform); - glGetAttachedShaders = RESOLVE((void (APIENTRY *)(GLuint , GLsizei , GLsizei*, GLuint* )), glGetAttachedShaders); - glGetAttribLocation = RESOLVE((int (APIENTRY *)(GLuint , const GLchar* )), glGetAttribLocation); - glGetBufferParameteriv = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLint* )), glGetBufferParameteriv); - glGetFramebufferAttachmentParameteriv = RESOLVE((void (APIENTRY *)(GLenum , GLenum, GLenum , GLint* )), glGetFramebufferAttachmentParameteriv); - glGetProgramiv = RESOLVE((void (APIENTRY *)(GLuint , GLenum , GLint* )), glGetProgramiv); - glGetProgramInfoLog = RESOLVE((void (APIENTRY *)(GLuint , GLsizei , GLsizei* , GLchar* )), glGetProgramInfoLog); - glGetRenderbufferParameteriv = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLint* )), glGetRenderbufferParameteriv); - glGetShaderiv = RESOLVE((void (APIENTRY *)(GLuint , GLenum , GLint* )), glGetShaderiv); - glGetShaderInfoLog = RESOLVE((void (APIENTRY *)(GLuint , GLsizei , GLsizei*, GLchar*)), glGetShaderInfoLog); - glGetShaderPrecisionFormat = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLint* , GLint* )), glGetShaderPrecisionFormat); - glGetShaderSource = RESOLVE((void (APIENTRY *)(GLuint , GLsizei , GLsizei* , GLchar* )), glGetShaderSource); - glGetUniformfv = RESOLVE((void (APIENTRY *)(GLuint , GLint , GLfloat*)), glGetUniformfv); - glGetUniformiv = RESOLVE((void (APIENTRY *)(GLuint , GLint , GLint*)), glGetUniformiv); - glGetUniformLocation = RESOLVE((int (APIENTRY *)(GLuint , const GLchar* )), glGetUniformLocation); - glGetVertexAttribfv = RESOLVE((void (APIENTRY *)(GLuint , GLenum , GLfloat* )), glGetVertexAttribfv); - glGetVertexAttribiv = RESOLVE((void (APIENTRY *)(GLuint , GLenum , GLint* )), glGetVertexAttribiv); - glGetVertexAttribPointerv = RESOLVE((void (APIENTRY *)(GLuint , GLenum , GLvoid** pointer)), glGetVertexAttribPointerv); - glIsBuffer = RESOLVE((GLboolean (APIENTRY *)(GLuint )), glIsBuffer); - glIsFramebuffer = RESOLVE((GLboolean (APIENTRY *)(GLuint )), glIsFramebuffer); - glIsProgram = RESOLVE((GLboolean (APIENTRY *)(GLuint )), glIsProgram); - glIsRenderbuffer = RESOLVE((GLboolean (APIENTRY *)(GLuint )), glIsRenderbuffer); - glIsShader = RESOLVE((GLboolean (APIENTRY *)(GLuint )), glIsShader); - glLinkProgram = RESOLVE((void (APIENTRY *)(GLuint )), glLinkProgram); - glReleaseShaderCompiler = RESOLVE((void (APIENTRY *)(void)), glReleaseShaderCompiler); - glRenderbufferStorage = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLsizei , GLsizei )), glRenderbufferStorage); - glSampleCoverage = RESOLVE((void (APIENTRY *)(GLclampf , GLboolean )), glSampleCoverage); - glShaderBinary = RESOLVE((void (APIENTRY *)(GLsizei , const GLuint*, GLenum , const GLvoid* , GLsizei )), glShaderBinary); - glShaderSource = RESOLVE((void (APIENTRY *)(GLuint , GLsizei , const GLchar* *, const GLint* )), glShaderSource); - glStencilFuncSeparate = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLint , GLuint )), glStencilFuncSeparate); - glStencilMaskSeparate = RESOLVE((void (APIENTRY *)(GLenum , GLuint )), glStencilMaskSeparate); - glStencilOpSeparate = RESOLVE((void (APIENTRY *)(GLenum , GLenum , GLenum , GLenum )), glStencilOpSeparate); - glUniform1f = RESOLVE((void (APIENTRY *)(GLint , GLfloat )), glUniform1f); - glUniform1fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLfloat* )), glUniform1fv); - glUniform1i = RESOLVE((void (APIENTRY *)(GLint , GLint )), glUniform1i); - glUniform1iv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLint* )), glUniform1iv); - glUniform2f = RESOLVE((void (APIENTRY *)(GLint , GLfloat , GLfloat )), glUniform2f); - glUniform2fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLfloat* )), glUniform2fv); - glUniform2i = RESOLVE((void (APIENTRY *)(GLint , GLint , GLint )), glUniform2i); - glUniform2iv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLint* )), glUniform2iv); - glUniform3f = RESOLVE((void (APIENTRY *)(GLint , GLfloat , GLfloat , GLfloat )), glUniform3f); - glUniform3fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLfloat* )), glUniform3fv); - glUniform3i = RESOLVE((void (APIENTRY *)(GLint , GLint , GLint , GLint )), glUniform3i); - glUniform3iv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLint* )), glUniform3iv); - glUniform4f = RESOLVE((void (APIENTRY *)(GLint , GLfloat , GLfloat , GLfloat , GLfloat )), glUniform4f); - glUniform4fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLfloat* )), glUniform4fv); - glUniform4i = RESOLVE((void (APIENTRY *)(GLint , GLint , GLint , GLint , GLint )), glUniform4i); - glUniform4iv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , const GLint* )), glUniform4iv); - glUniformMatrix2fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , GLboolean , const GLfloat* )), glUniformMatrix2fv); - glUniformMatrix3fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , GLboolean , const GLfloat* )), glUniformMatrix3fv); - glUniformMatrix4fv = RESOLVE((void (APIENTRY *)(GLint , GLsizei , GLboolean , const GLfloat* )), glUniformMatrix4fv); - glUseProgram = RESOLVE((void (APIENTRY *)(GLuint )), glUseProgram); - glValidateProgram = RESOLVE((void (APIENTRY *)(GLuint )), glValidateProgram); - glVertexAttrib1f = RESOLVE((void (APIENTRY *)(GLuint , GLfloat )), glVertexAttrib1f); - glVertexAttrib1fv = RESOLVE((void (APIENTRY *)(GLuint , const GLfloat* )), glVertexAttrib1fv); - glVertexAttrib2f = RESOLVE((void (APIENTRY *)(GLuint , GLfloat , GLfloat )), glVertexAttrib2f); - glVertexAttrib2fv = RESOLVE((void (APIENTRY *)(GLuint , const GLfloat* )), glVertexAttrib2fv); - glVertexAttrib3f = RESOLVE((void (APIENTRY *)(GLuint , GLfloat , GLfloat , GLfloat )), glVertexAttrib3f); - glVertexAttrib3fv = RESOLVE((void (APIENTRY *)(GLuint , const GLfloat* )), glVertexAttrib3fv); - glVertexAttrib4f = RESOLVE((void (APIENTRY *)(GLuint , GLfloat , GLfloat , GLfloat , GLfloat )), glVertexAttrib4f); - glVertexAttrib4fv = RESOLVE((void (APIENTRY *)(GLuint , const GLfloat* )), glVertexAttrib4fv); - glVertexAttribPointer = RESOLVE((void (APIENTRY *)(GLuint , GLint, GLenum, GLboolean, GLsizei, const GLvoid* )), glVertexAttribPointer); - - glClearDepthf = RESOLVE((void (APIENTRY *)(GLclampf )), glClearDepthf); - glDepthRangef = RESOLVE((void (APIENTRY *)(GLclampf , GLclampf )), glDepthRangef); return glBindTexture && glCreateShader && glClearDepthf; } @@ -685,168 +537,174 @@ void QWindowsEGLContext::swapBuffers(QPlatformSurface *surface) QFunctionPointer QWindowsEGLContext::getProcAddress(const char *procName) { + QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api); + QFunctionPointer procAddress = reinterpret_cast<QFunctionPointer>(QWindowsEGLStaticContext::libEGL.eglGetProcAddress(procName)); + // We support AllGLFunctionsQueryable, which means this function must be able to // return a function pointer for standard GLES2 functions too. These are not // guaranteed to be queryable via eglGetProcAddress(). - static struct StdFunc { - const char *name; - void *func; - } standardFuncs[] = { - { "glBindTexture", (void *) QWindowsEGLStaticContext::libGLESv2.glBindTexture }, - { "glBlendFunc", (void *) QWindowsEGLStaticContext::libGLESv2.glBlendFunc }, - { "glClear", (void *) QWindowsEGLStaticContext::libGLESv2.glClear }, - { "glClearColor", (void *) QWindowsEGLStaticContext::libGLESv2.glClearColor }, - { "glClearStencil", (void *) QWindowsEGLStaticContext::libGLESv2.glClearStencil }, - { "glColorMask", (void *) QWindowsEGLStaticContext::libGLESv2.glColorMask }, - { "glCopyTexImage2D", (void *) QWindowsEGLStaticContext::libGLESv2.glCopyTexImage2D }, - { "glCopyTexSubImage2D", (void *) QWindowsEGLStaticContext::libGLESv2.glCopyTexSubImage2D }, - { "glCullFace", (void *) QWindowsEGLStaticContext::libGLESv2.glCullFace }, - { "glDeleteTextures", (void *) QWindowsEGLStaticContext::libGLESv2.glDeleteTextures }, - { "glDepthFunc", (void *) QWindowsEGLStaticContext::libGLESv2.glDepthFunc }, - { "glDepthMask", (void *) QWindowsEGLStaticContext::libGLESv2.glDepthMask }, - { "glDisable", (void *) QWindowsEGLStaticContext::libGLESv2.glDisable }, - { "glDrawArrays", (void *) QWindowsEGLStaticContext::libGLESv2.glDrawArrays }, - { "glDrawElements", (void *) QWindowsEGLStaticContext::libGLESv2.glDrawElements }, - { "glEnable", (void *) QWindowsEGLStaticContext::libGLESv2.glEnable }, - { "glFinish", (void *) QWindowsEGLStaticContext::libGLESv2.glFinish }, - { "glFlush", (void *) QWindowsEGLStaticContext::libGLESv2.glFlush }, - { "glFrontFace", (void *) QWindowsEGLStaticContext::libGLESv2.glFrontFace }, - { "glGenTextures", (void *) QWindowsEGLStaticContext::libGLESv2.glGenTextures }, - { "glGetBooleanv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetBooleanv }, - { "glGetError", (void *) QWindowsEGLStaticContext::libGLESv2.glGetError }, - { "glGetFloatv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetFloatv }, - { "glGetIntegerv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetIntegerv }, - { "glGetString", (void *) QWindowsEGLStaticContext::libGLESv2.glGetString }, - { "glGetTexParameterfv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetTexParameterfv }, - { "glGetTexParameteriv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetTexParameteriv }, - { "glHint", (void *) QWindowsEGLStaticContext::libGLESv2.glHint }, - { "glIsEnabled", (void *) QWindowsEGLStaticContext::libGLESv2.glIsEnabled }, - { "glIsTexture", (void *) QWindowsEGLStaticContext::libGLESv2.glIsTexture }, - { "glLineWidth", (void *) QWindowsEGLStaticContext::libGLESv2.glLineWidth }, - { "glPixelStorei", (void *) QWindowsEGLStaticContext::libGLESv2.glPixelStorei }, - { "glPolygonOffset", (void *) QWindowsEGLStaticContext::libGLESv2.glPolygonOffset }, - { "glReadPixels", (void *) QWindowsEGLStaticContext::libGLESv2.glReadPixels }, - { "glScissor", (void *) QWindowsEGLStaticContext::libGLESv2.glScissor }, - { "glStencilFunc", (void *) QWindowsEGLStaticContext::libGLESv2.glStencilFunc }, - { "glStencilMask", (void *) QWindowsEGLStaticContext::libGLESv2.glStencilMask }, - { "glStencilOp", (void *) QWindowsEGLStaticContext::libGLESv2.glStencilOp }, - { "glTexImage2D", (void *) QWindowsEGLStaticContext::libGLESv2.glTexImage2D }, - { "glTexParameterf", (void *) QWindowsEGLStaticContext::libGLESv2.glTexParameterf }, - { "glTexParameterfv", (void *) QWindowsEGLStaticContext::libGLESv2.glTexParameterfv }, - { "glTexParameteri", (void *) QWindowsEGLStaticContext::libGLESv2.glTexParameteri }, - { "glTexParameteriv", (void *) QWindowsEGLStaticContext::libGLESv2.glTexParameteriv }, - { "glTexSubImage2D", (void *) QWindowsEGLStaticContext::libGLESv2.glTexSubImage2D }, - { "glViewport", (void *) QWindowsEGLStaticContext::libGLESv2.glViewport }, - - { "glActiveTexture", (void *) QWindowsEGLStaticContext::libGLESv2.glActiveTexture }, - { "glAttachShader", (void *) QWindowsEGLStaticContext::libGLESv2.glAttachShader }, - { "glBindAttribLocation", (void *) QWindowsEGLStaticContext::libGLESv2.glBindAttribLocation }, - { "glBindBuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glBindBuffer }, - { "glBindFramebuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glBindFramebuffer }, - { "glBindRenderbuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glBindRenderbuffer }, - { "glBlendColor", (void *) QWindowsEGLStaticContext::libGLESv2.glBlendColor }, - { "glBlendEquation", (void *) QWindowsEGLStaticContext::libGLESv2.glBlendEquation }, - { "glBlendEquationSeparate", (void *) QWindowsEGLStaticContext::libGLESv2.glBlendEquationSeparate }, - { "glBlendFuncSeparate", (void *) QWindowsEGLStaticContext::libGLESv2.glBlendFuncSeparate }, - { "glBufferData", (void *) QWindowsEGLStaticContext::libGLESv2.glBufferData }, - { "glBufferSubData", (void *) QWindowsEGLStaticContext::libGLESv2.glBufferSubData }, - { "glCheckFramebufferStatus", (void *) QWindowsEGLStaticContext::libGLESv2.glCheckFramebufferStatus }, - { "glCompileShader", (void *) QWindowsEGLStaticContext::libGLESv2.glCompileShader }, - { "glCompressedTexImage2D", (void *) QWindowsEGLStaticContext::libGLESv2.glCompressedTexImage2D }, - { "glCompressedTexSubImage2D", (void *) QWindowsEGLStaticContext::libGLESv2.glCompressedTexSubImage2D }, - { "glCreateProgram", (void *) QWindowsEGLStaticContext::libGLESv2.glCreateProgram }, - { "glCreateShader", (void *) QWindowsEGLStaticContext::libGLESv2.glCreateShader }, - { "glDeleteBuffers", (void *) QWindowsEGLStaticContext::libGLESv2.glDeleteBuffers }, - { "glDeleteFramebuffers", (void *) QWindowsEGLStaticContext::libGLESv2.glDeleteFramebuffers }, - { "glDeleteProgram", (void *) QWindowsEGLStaticContext::libGLESv2.glDeleteProgram }, - { "glDeleteRenderbuffers", (void *) QWindowsEGLStaticContext::libGLESv2.glDeleteRenderbuffers }, - { "glDeleteShader", (void *) QWindowsEGLStaticContext::libGLESv2.glDeleteShader }, - { "glDetachShader", (void *) QWindowsEGLStaticContext::libGLESv2.glDetachShader }, - { "glDisableVertexAttribArray", (void *) QWindowsEGLStaticContext::libGLESv2.glDisableVertexAttribArray }, - { "glEnableVertexAttribArray", (void *) QWindowsEGLStaticContext::libGLESv2.glEnableVertexAttribArray }, - { "glFramebufferRenderbuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glFramebufferRenderbuffer }, - { "glFramebufferTexture2D", (void *) QWindowsEGLStaticContext::libGLESv2.glFramebufferTexture2D }, - { "glGenBuffers", (void *) QWindowsEGLStaticContext::libGLESv2.glGenBuffers }, - { "glGenerateMipmap", (void *) QWindowsEGLStaticContext::libGLESv2.glGenerateMipmap }, - { "glGenFramebuffers", (void *) QWindowsEGLStaticContext::libGLESv2.glGenFramebuffers }, - { "glGenRenderbuffers", (void *) QWindowsEGLStaticContext::libGLESv2.glGenRenderbuffers }, - { "glGetActiveAttrib", (void *) QWindowsEGLStaticContext::libGLESv2.glGetActiveAttrib }, - { "glGetActiveUniform", (void *) QWindowsEGLStaticContext::libGLESv2.glGetActiveUniform }, - { "glGetAttachedShaders", (void *) QWindowsEGLStaticContext::libGLESv2.glGetAttachedShaders }, - { "glGetAttribLocation", (void *) QWindowsEGLStaticContext::libGLESv2.glGetAttribLocation }, - { "glGetBufferParameteriv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetBufferParameteriv }, - { "glGetFramebufferAttachmentParameteriv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetFramebufferAttachmentParameteriv }, - { "glGetProgramiv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetProgramiv }, - { "glGetProgramInfoLog", (void *) QWindowsEGLStaticContext::libGLESv2.glGetProgramInfoLog }, - { "glGetRenderbufferParameteriv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetRenderbufferParameteriv }, - { "glGetShaderiv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetShaderiv }, - { "glGetShaderInfoLog", (void *) QWindowsEGLStaticContext::libGLESv2.glGetShaderInfoLog }, - { "glGetShaderPrecisionFormat", (void *) QWindowsEGLStaticContext::libGLESv2.glGetShaderPrecisionFormat }, - { "glGetShaderSource", (void *) QWindowsEGLStaticContext::libGLESv2.glGetShaderSource }, - { "glGetUniformfv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetUniformfv }, - { "glGetUniformiv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetUniformiv }, - { "glGetUniformLocation", (void *) QWindowsEGLStaticContext::libGLESv2.glGetUniformLocation }, - { "glGetVertexAttribfv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetVertexAttribfv }, - { "glGetVertexAttribiv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetVertexAttribiv }, - { "glGetVertexAttribPointerv", (void *) QWindowsEGLStaticContext::libGLESv2.glGetVertexAttribPointerv }, - { "glIsBuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glIsBuffer }, - { "glIsFramebuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glIsFramebuffer }, - { "glIsProgram", (void *) QWindowsEGLStaticContext::libGLESv2.glIsProgram }, - { "glIsRenderbuffer", (void *) QWindowsEGLStaticContext::libGLESv2.glIsRenderbuffer }, - { "glIsShader", (void *) QWindowsEGLStaticContext::libGLESv2.glIsShader }, - { "glLinkProgram", (void *) QWindowsEGLStaticContext::libGLESv2.glLinkProgram }, - { "glReleaseShaderCompiler", (void *) QWindowsEGLStaticContext::libGLESv2.glReleaseShaderCompiler }, - { "glRenderbufferStorage", (void *) QWindowsEGLStaticContext::libGLESv2.glRenderbufferStorage }, - { "glSampleCoverage", (void *) QWindowsEGLStaticContext::libGLESv2.glSampleCoverage }, - { "glShaderBinary", (void *) QWindowsEGLStaticContext::libGLESv2.glShaderBinary }, - { "glShaderSource", (void *) QWindowsEGLStaticContext::libGLESv2.glShaderSource }, - { "glStencilFuncSeparate", (void *) QWindowsEGLStaticContext::libGLESv2.glStencilFuncSeparate }, - { "glStencilMaskSeparate", (void *) QWindowsEGLStaticContext::libGLESv2.glStencilMaskSeparate }, - { "glStencilOpSeparate", (void *) QWindowsEGLStaticContext::libGLESv2.glStencilOpSeparate }, - { "glUniform1f", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform1f }, - { "glUniform1fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform1fv }, - { "glUniform1i", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform1i }, - { "glUniform1iv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform1iv }, - { "glUniform2f", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform2f }, - { "glUniform2fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform2fv }, - { "glUniform2i", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform2i }, - { "glUniform2iv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform2iv }, - { "glUniform3f", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform3f }, - { "glUniform3fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform3fv }, - { "glUniform3i", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform3i }, - { "glUniform3iv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform3iv }, - { "glUniform4f", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform4f }, - { "glUniform4fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform4fv }, - { "glUniform4i", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform4i }, - { "glUniform4iv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniform4iv }, - { "glUniformMatrix2fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniformMatrix2fv }, - { "glUniformMatrix3fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniformMatrix3fv }, - { "glUniformMatrix4fv", (void *) QWindowsEGLStaticContext::libGLESv2.glUniformMatrix4fv }, - { "glUseProgram", (void *) QWindowsEGLStaticContext::libGLESv2.glUseProgram }, - { "glValidateProgram", (void *) QWindowsEGLStaticContext::libGLESv2.glValidateProgram }, - { "glVertexAttrib1f", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib1f }, - { "glVertexAttrib1fv", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib1fv }, - { "glVertexAttrib2f", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib2f }, - { "glVertexAttrib2fv", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib2fv }, - { "glVertexAttrib3f", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib3f }, - { "glVertexAttrib3fv", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib3fv }, - { "glVertexAttrib4f", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib4f }, - { "glVertexAttrib4fv", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttrib4fv }, - { "glVertexAttribPointer", (void *) QWindowsEGLStaticContext::libGLESv2.glVertexAttribPointer }, - - { "glClearDepthf", (void *) QWindowsEGLStaticContext::libGLESv2.glClearDepthf }, - { "glDepthRangef", (void *) QWindowsEGLStaticContext::libGLESv2.glDepthRangef } - }; - for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i) - if (!qstrcmp(procName, standardFuncs[i].name)) - return reinterpret_cast<QFunctionPointer>(standardFuncs[i].func); + if (!procAddress) { +#if defined(QT_STATIC) + static struct StdFunc { + const char *name; + void *func; + } standardFuncs[] = { + { "glBindTexture", (void *) ::glBindTexture }, + { "glBlendFunc", (void *) ::glBlendFunc }, + { "glClear", (void *) ::glClear }, + { "glClearColor", (void *) ::glClearColor }, + { "glClearStencil", (void *) ::glClearStencil }, + { "glColorMask", (void *) ::glColorMask }, + { "glCopyTexImage2D", (void *) ::glCopyTexImage2D }, + { "glCopyTexSubImage2D", (void *) ::glCopyTexSubImage2D }, + { "glCullFace", (void *) ::glCullFace }, + { "glDeleteTextures", (void *) ::glDeleteTextures }, + { "glDepthFunc", (void *) ::glDepthFunc }, + { "glDepthMask", (void *) ::glDepthMask }, + { "glDisable", (void *) ::glDisable }, + { "glDrawArrays", (void *) ::glDrawArrays }, + { "glDrawElements", (void *) ::glDrawElements }, + { "glEnable", (void *) ::glEnable }, + { "glFinish", (void *) ::glFinish }, + { "glFlush", (void *) ::glFlush }, + { "glFrontFace", (void *) ::glFrontFace }, + { "glGenTextures", (void *) ::glGenTextures }, + { "glGetBooleanv", (void *) ::glGetBooleanv }, + { "glGetError", (void *) ::glGetError }, + { "glGetFloatv", (void *) ::glGetFloatv }, + { "glGetIntegerv", (void *) ::glGetIntegerv }, + { "glGetString", (void *) ::glGetString }, + { "glGetTexParameterfv", (void *) ::glGetTexParameterfv }, + { "glGetTexParameteriv", (void *) ::glGetTexParameteriv }, + { "glHint", (void *) ::glHint }, + { "glIsEnabled", (void *) ::glIsEnabled }, + { "glIsTexture", (void *) ::glIsTexture }, + { "glLineWidth", (void *) ::glLineWidth }, + { "glPixelStorei", (void *) ::glPixelStorei }, + { "glPolygonOffset", (void *) ::glPolygonOffset }, + { "glReadPixels", (void *) ::glReadPixels }, + { "glScissor", (void *) ::glScissor }, + { "glStencilFunc", (void *) ::glStencilFunc }, + { "glStencilMask", (void *) ::glStencilMask }, + { "glStencilOp", (void *) ::glStencilOp }, + { "glTexImage2D", (void *) ::glTexImage2D }, + { "glTexParameterf", (void *) ::glTexParameterf }, + { "glTexParameterfv", (void *) ::glTexParameterfv }, + { "glTexParameteri", (void *) ::glTexParameteri }, + { "glTexParameteriv", (void *) ::glTexParameteriv }, + { "glTexSubImage2D", (void *) ::glTexSubImage2D }, + { "glViewport", (void *) ::glViewport }, + + { "glActiveTexture", (void *) ::glActiveTexture }, + { "glAttachShader", (void *) ::glAttachShader }, + { "glBindAttribLocation", (void *) ::glBindAttribLocation }, + { "glBindBuffer", (void *) ::glBindBuffer }, + { "glBindFramebuffer", (void *) ::glBindFramebuffer }, + { "glBindRenderbuffer", (void *) ::glBindRenderbuffer }, + { "glBlendColor", (void *) ::glBlendColor }, + { "glBlendEquation", (void *) ::glBlendEquation }, + { "glBlendEquationSeparate", (void *) ::glBlendEquationSeparate }, + { "glBlendFuncSeparate", (void *) ::glBlendFuncSeparate }, + { "glBufferData", (void *) ::glBufferData }, + { "glBufferSubData", (void *) ::glBufferSubData }, + { "glCheckFramebufferStatus", (void *) ::glCheckFramebufferStatus }, + { "glCompileShader", (void *) ::glCompileShader }, + { "glCompressedTexImage2D", (void *) ::glCompressedTexImage2D }, + { "glCompressedTexSubImage2D", (void *) ::glCompressedTexSubImage2D }, + { "glCreateProgram", (void *) ::glCreateProgram }, + { "glCreateShader", (void *) ::glCreateShader }, + { "glDeleteBuffers", (void *) ::glDeleteBuffers }, + { "glDeleteFramebuffers", (void *) ::glDeleteFramebuffers }, + { "glDeleteProgram", (void *) ::glDeleteProgram }, + { "glDeleteRenderbuffers", (void *) ::glDeleteRenderbuffers }, + { "glDeleteShader", (void *) ::glDeleteShader }, + { "glDetachShader", (void *) ::glDetachShader }, + { "glDisableVertexAttribArray", (void *) ::glDisableVertexAttribArray }, + { "glEnableVertexAttribArray", (void *) ::glEnableVertexAttribArray }, + { "glFramebufferRenderbuffer", (void *) ::glFramebufferRenderbuffer }, + { "glFramebufferTexture2D", (void *) ::glFramebufferTexture2D }, + { "glGenBuffers", (void *) ::glGenBuffers }, + { "glGenerateMipmap", (void *) ::glGenerateMipmap }, + { "glGenFramebuffers", (void *) ::glGenFramebuffers }, + { "glGenRenderbuffers", (void *) ::glGenRenderbuffers }, + { "glGetActiveAttrib", (void *) ::glGetActiveAttrib }, + { "glGetActiveUniform", (void *) ::glGetActiveUniform }, + { "glGetAttachedShaders", (void *) ::glGetAttachedShaders }, + { "glGetAttribLocation", (void *) ::glGetAttribLocation }, + { "glGetBufferParameteriv", (void *) ::glGetBufferParameteriv }, + { "glGetFramebufferAttachmentParameteriv", (void *) ::glGetFramebufferAttachmentParameteriv }, + { "glGetProgramiv", (void *) ::glGetProgramiv }, + { "glGetProgramInfoLog", (void *) ::glGetProgramInfoLog }, + { "glGetRenderbufferParameteriv", (void *) ::glGetRenderbufferParameteriv }, + { "glGetShaderiv", (void *) ::glGetShaderiv }, + { "glGetShaderInfoLog", (void *) ::glGetShaderInfoLog }, + { "glGetShaderPrecisionFormat", (void *) ::glGetShaderPrecisionFormat }, + { "glGetShaderSource", (void *) ::glGetShaderSource }, + { "glGetUniformfv", (void *) ::glGetUniformfv }, + { "glGetUniformiv", (void *) ::glGetUniformiv }, + { "glGetUniformLocation", (void *) ::glGetUniformLocation }, + { "glGetVertexAttribfv", (void *) ::glGetVertexAttribfv }, + { "glGetVertexAttribiv", (void *) ::glGetVertexAttribiv }, + { "glGetVertexAttribPointerv", (void *) ::glGetVertexAttribPointerv }, + { "glIsBuffer", (void *) ::glIsBuffer }, + { "glIsFramebuffer", (void *) ::glIsFramebuffer }, + { "glIsProgram", (void *) ::glIsProgram }, + { "glIsRenderbuffer", (void *) ::glIsRenderbuffer }, + { "glIsShader", (void *) ::glIsShader }, + { "glLinkProgram", (void *) ::glLinkProgram }, + { "glReleaseShaderCompiler", (void *) ::glReleaseShaderCompiler }, + { "glRenderbufferStorage", (void *) ::glRenderbufferStorage }, + { "glSampleCoverage", (void *) ::glSampleCoverage }, + { "glShaderBinary", (void *) ::glShaderBinary }, + { "glShaderSource", (void *) ::glShaderSource }, + { "glStencilFuncSeparate", (void *) ::glStencilFuncSeparate }, + { "glStencilMaskSeparate", (void *) ::glStencilMaskSeparate }, + { "glStencilOpSeparate", (void *) ::glStencilOpSeparate }, + { "glUniform1f", (void *) ::glUniform1f }, + { "glUniform1fv", (void *) ::glUniform1fv }, + { "glUniform1i", (void *) ::glUniform1i }, + { "glUniform1iv", (void *) ::glUniform1iv }, + { "glUniform2f", (void *) ::glUniform2f }, + { "glUniform2fv", (void *) ::glUniform2fv }, + { "glUniform2i", (void *) ::glUniform2i }, + { "glUniform2iv", (void *) ::glUniform2iv }, + { "glUniform3f", (void *) ::glUniform3f }, + { "glUniform3fv", (void *) ::glUniform3fv }, + { "glUniform3i", (void *) ::glUniform3i }, + { "glUniform3iv", (void *) ::glUniform3iv }, + { "glUniform4f", (void *) ::glUniform4f }, + { "glUniform4fv", (void *) ::glUniform4fv }, + { "glUniform4i", (void *) ::glUniform4i }, + { "glUniform4iv", (void *) ::glUniform4iv }, + { "glUniformMatrix2fv", (void *) ::glUniformMatrix2fv }, + { "glUniformMatrix3fv", (void *) ::glUniformMatrix3fv }, + { "glUniformMatrix4fv", (void *) ::glUniformMatrix4fv }, + { "glUseProgram", (void *) ::glUseProgram }, + { "glValidateProgram", (void *) ::glValidateProgram }, + { "glVertexAttrib1f", (void *) ::glVertexAttrib1f }, + { "glVertexAttrib1fv", (void *) ::glVertexAttrib1fv }, + { "glVertexAttrib2f", (void *) ::glVertexAttrib2f }, + { "glVertexAttrib2fv", (void *) ::glVertexAttrib2fv }, + { "glVertexAttrib3f", (void *) ::glVertexAttrib3f }, + { "glVertexAttrib3fv", (void *) ::glVertexAttrib3fv }, + { "glVertexAttrib4f", (void *) ::glVertexAttrib4f }, + { "glVertexAttrib4fv", (void *) ::glVertexAttrib4fv }, + { "glVertexAttribPointer", (void *) ::glVertexAttribPointer }, + + { "glClearDepthf", (void *) ::glClearDepthf }, + { "glDepthRangef", (void *) ::glDepthRangef } + }; + for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i) + if (!qstrcmp(procName, standardFuncs[i].name)) + return reinterpret_cast<QFunctionPointer>(standardFuncs[i].func); +#else + procAddress = reinterpret_cast<QFunctionPointer>(QWindowsEGLStaticContext::libGLESv2.resolve(procName)); +#endif +} - QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api); - 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); + return procAddress; } diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h index e49d1da9c5..c7f7cee3c2 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.h +++ b/src/plugins/platforms/windows/qwindowseglcontext.h @@ -98,157 +98,11 @@ struct QWindowsLibGLESv2 void *moduleHandle() const { return Q_NULLPTR; } #endif - // GL1+GLES2 common - void (APIENTRY * glBindTexture)(GLenum target, GLuint texture); - void (APIENTRY * glBlendFunc)(GLenum sfactor, GLenum dfactor); - void (APIENTRY * glClear)(GLbitfield mask); - void (APIENTRY * glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY * glClearStencil)(GLint s); - void (APIENTRY * glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - void (APIENTRY * glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - void (APIENTRY * glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * glCullFace)(GLenum mode); - void (APIENTRY * glDeleteTextures)(GLsizei n, const GLuint* textures); - void (APIENTRY * glDepthFunc)(GLenum func); - void (APIENTRY * glDepthMask)(GLboolean flag); - void (APIENTRY * glDisable)(GLenum cap); - void (APIENTRY * glDrawArrays)(GLenum mode, GLint first, GLsizei count); - void (APIENTRY * glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); - void (APIENTRY * glEnable)(GLenum cap); - void (APIENTRY * glFinish)(); - void (APIENTRY * glFlush)(); - void (APIENTRY * glFrontFace)(GLenum mode); - void (APIENTRY * glGenTextures)(GLsizei n, GLuint* textures); - void (APIENTRY * glGetBooleanv)(GLenum pname, GLboolean* params); - GLenum (APIENTRY * glGetError)(); - void (APIENTRY * glGetFloatv)(GLenum pname, GLfloat* params); - void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params); const GLubyte * (APIENTRY * glGetString)(GLenum name); - void (APIENTRY * glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params); - void (APIENTRY * glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params); - void (APIENTRY * glHint)(GLenum target, GLenum mode); - GLboolean (APIENTRY * glIsEnabled)(GLenum cap); - GLboolean (APIENTRY * glIsTexture)(GLuint texture); - void (APIENTRY * glLineWidth)(GLfloat width); - void (APIENTRY * glPixelStorei)(GLenum pname, GLint param); - void (APIENTRY * glPolygonOffset)(GLfloat factor, GLfloat units); - void (APIENTRY * glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); - void (APIENTRY * glScissor)(GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * glStencilFunc)(GLenum func, GLint ref, GLuint mask); - void (APIENTRY * glStencilMask)(GLuint mask); - void (APIENTRY * glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); - void (APIENTRY * glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); - void (APIENTRY * glTexParameterf)(GLenum target, GLenum pname, GLfloat param); - void (APIENTRY * glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params); - void (APIENTRY * glTexParameteri)(GLenum target, GLenum pname, GLint param); - void (APIENTRY * glTexParameteriv)(GLenum target, GLenum pname, const GLint* params); - void (APIENTRY * glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); - void (APIENTRY * glViewport)(GLint x, GLint y, GLsizei width, GLsizei height); - // GLES2 - void (APIENTRY * glActiveTexture)(GLenum texture); - void (APIENTRY * glAttachShader)(GLuint program, GLuint shader); - void (APIENTRY * glBindAttribLocation)(GLuint program, GLuint index, const char* name); - void (APIENTRY * glBindBuffer)(GLenum target, GLuint buffer); - void (APIENTRY * glBindFramebuffer)(GLenum target, GLuint framebuffer); - void (APIENTRY * glBindRenderbuffer)(GLenum target, GLuint renderbuffer); - void (APIENTRY * glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY * glBlendEquation)(GLenum mode); - void (APIENTRY * glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); - void (APIENTRY * glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - void (APIENTRY * glBufferData)(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage); - void (APIENTRY * glBufferSubData)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data); - GLenum (APIENTRY * glCheckFramebufferStatus)(GLenum target); - void (APIENTRY * glCompileShader)(GLuint shader); - void (APIENTRY * glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); - void (APIENTRY * glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); - GLuint (APIENTRY * glCreateProgram)(); - GLuint (APIENTRY * glCreateShader)(GLenum type); - void (APIENTRY * glDeleteBuffers)(GLsizei n, const GLuint* buffers); - void (APIENTRY * glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); - void (APIENTRY * glDeleteProgram)(GLuint program); - void (APIENTRY * glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); - void (APIENTRY * glDeleteShader)(GLuint shader); - void (APIENTRY * glDetachShader)(GLuint program, GLuint shader); - void (APIENTRY * glDisableVertexAttribArray)(GLuint index); - void (APIENTRY * glEnableVertexAttribArray)(GLuint index); - void (APIENTRY * glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); - void (APIENTRY * glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - void (APIENTRY * glGenBuffers)(GLsizei n, GLuint* buffers); - void (APIENTRY * glGenerateMipmap)(GLenum target); - void (APIENTRY * glGenFramebuffers)(GLsizei n, GLuint* framebuffers); - void (APIENTRY * glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers); - void (APIENTRY * glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); - void (APIENTRY * glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); - void (APIENTRY * glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); - GLint (APIENTRY * glGetAttribLocation)(GLuint program, const char* name); - void (APIENTRY * glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); - void (APIENTRY * glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); - void (APIENTRY * glGetProgramiv)(GLuint program, GLenum pname, GLint* params); - void (APIENTRY * glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); - void (APIENTRY * glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); - void (APIENTRY * glGetShaderiv)(GLuint shader, GLenum pname, GLint* params); - void (APIENTRY * glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); - void (APIENTRY * glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - void (APIENTRY * glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source); - void (APIENTRY * glGetUniformfv)(GLuint program, GLint location, GLfloat* params); - void (APIENTRY * glGetUniformiv)(GLuint program, GLint location, GLint* params); - GLint (APIENTRY * glGetUniformLocation)(GLuint program, const char* name); - void (APIENTRY * glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); - void (APIENTRY * glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params); - void (APIENTRY * glGetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer); - GLboolean (APIENTRY * glIsBuffer)(GLuint buffer); - GLboolean (APIENTRY * glIsFramebuffer)(GLuint framebuffer); - GLboolean (APIENTRY * glIsProgram)(GLuint program); - GLboolean (APIENTRY * glIsRenderbuffer)(GLuint renderbuffer); - GLboolean (APIENTRY * glIsShader)(GLuint shader); - void (APIENTRY * glLinkProgram)(GLuint program); - void (APIENTRY * glReleaseShaderCompiler)(); - void (APIENTRY * glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - void (APIENTRY * glSampleCoverage)(GLclampf value, GLboolean invert); - void (APIENTRY * glShaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length); - void (APIENTRY * glShaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length); - void (APIENTRY * glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); - void (APIENTRY * glStencilMaskSeparate)(GLenum face, GLuint mask); - void (APIENTRY * glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - void (APIENTRY * glUniform1f)(GLint location, GLfloat x); - void (APIENTRY * glUniform1fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * glUniform1i)(GLint location, GLint x); - void (APIENTRY * glUniform1iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * glUniform2f)(GLint location, GLfloat x, GLfloat y); - void (APIENTRY * glUniform2fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * glUniform2i)(GLint location, GLint x, GLint y); - void (APIENTRY * glUniform2iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * glUniform3fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * glUniform3i)(GLint location, GLint x, GLint y, GLint z); - void (APIENTRY * glUniform3iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY * glUniform4fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); - void (APIENTRY * glUniform4iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (APIENTRY * glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (APIENTRY * glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (APIENTRY * glUseProgram)(GLuint program); - void (APIENTRY * glValidateProgram)(GLuint program); - void (APIENTRY * glVertexAttrib1f)(GLuint indx, GLfloat x); - void (APIENTRY * glVertexAttrib1fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y); - void (APIENTRY * glVertexAttrib2fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * glVertexAttrib3fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY * glVertexAttrib4fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); - - // ES only - void (APIENTRY * glClearDepthf)(GLclampf depth); - void (APIENTRY * glDepthRangef)(GLclampf nearVal, GLclampf farVal); - -private: #if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) void *resolve(const char *name); +private: HMODULE m_lib; #endif }; diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 8eac7cca9e..cc2f05b6d1 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -156,8 +156,6 @@ void *QWindowsOpengl32DLL::resolve(const char *name) #else void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0; #endif - if (!proc) - qErrnoWarning(::GetLastError(), "Failed to resolve OpenGL function %s", name); return proc; } @@ -199,56 +197,11 @@ bool QWindowsOpengl32DLL::init(bool softwareRendering) wglSwapBuffers = reinterpret_cast<BOOL (WINAPI *)(HDC)>(resolve("wglSwapBuffers")); wglSetPixelFormat = reinterpret_cast<BOOL (WINAPI *)(HDC, int, const PIXELFORMATDESCRIPTOR *)>(resolve("wglSetPixelFormat")); - glBindTexture = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint )>(resolve("glBindTexture")); - glBlendFunc = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolve("glBlendFunc")); - glClear = reinterpret_cast<void (APIENTRY *)(GLbitfield )>(resolve("glClear")); - glClearColor = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolve("glClearColor")); - glClearStencil = reinterpret_cast<void (APIENTRY *)(GLint )>(resolve("glClearStencil")); - glColorMask = reinterpret_cast<void (APIENTRY *)(GLboolean , GLboolean , GLboolean , GLboolean )>(resolve("glColorMask")); - glCopyTexImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLint , GLint , GLsizei , GLsizei , GLint )>(resolve("glCopyTexImage2D")); - glCopyTexSubImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLint , GLint , GLsizei , GLsizei )>(resolve("glCopyTexSubImage2D")); - glCullFace = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolve("glCullFace")); - glDeleteTextures = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint *)>(resolve("glDeleteTextures")); - glDepthFunc = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolve("glDepthFunc")); - glDepthMask = reinterpret_cast<void (APIENTRY *)(GLboolean )>(resolve("glDepthMask")); - glDisable = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolve("glDisable")); - glDrawArrays = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLsizei )>(resolve("glDrawArrays")); - glDrawElements = reinterpret_cast<void (APIENTRY *)(GLenum , GLsizei , GLenum , const GLvoid *)>(resolve("glDrawElements")); - glEnable = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolve("glEnable")); - glFinish = reinterpret_cast<void (APIENTRY *)()>(resolve("glFinish")); - glFlush = reinterpret_cast<void (APIENTRY *)()>(resolve("glFlush")); - glFrontFace = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolve("glFrontFace")); - glGenTextures = reinterpret_cast<void (APIENTRY *)(GLsizei , GLuint *)>(resolve("glGenTextures")); - glGetBooleanv = reinterpret_cast<void (APIENTRY *)(GLenum , GLboolean *)>(resolve("glGetBooleanv")); glGetError = reinterpret_cast<GLenum (APIENTRY *)()>(resolve("glGetError")); - glGetFloatv = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat *)>(resolve("glGetFloatv")); glGetIntegerv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint *)>(resolve("glGetIntegerv")); glGetString = reinterpret_cast<const GLubyte * (APIENTRY *)(GLenum )>(resolve("glGetString")); - glGetTexParameterfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolve("glGetTexParameterfv")); - glGetTexParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolve("glGetTexParameteriv")); - glHint = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolve("glHint")); - glIsEnabled = reinterpret_cast<GLboolean (APIENTRY *)(GLenum )>(resolve("glIsEnabled")); - glIsTexture = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolve("glIsTexture")); - glLineWidth = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolve("glLineWidth")); - glPixelStorei = reinterpret_cast<void (APIENTRY *)(GLenum , GLint )>(resolve("glPixelStorei")); - glPolygonOffset = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolve("glPolygonOffset")); - glReadPixels = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , GLvoid *)>(resolve("glReadPixels")); - glScissor = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei )>(resolve("glScissor")); - glStencilFunc = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLuint )>(resolve("glStencilFunc")); - glStencilMask = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolve("glStencilMask")); - glStencilOp = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLenum )>(resolve("glStencilOp")); - glTexImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(resolve("glTexImage2D")); - glTexParameterf = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat )>(resolve("glTexParameterf")); - glTexParameterfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLfloat *)>(resolve("glTexParameterfv")); - glTexParameteri = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint )>(resolve("glTexParameteri")); - glTexParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLint *)>(resolve("glTexParameteriv")); - glTexSubImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(resolve("glTexSubImage2D")); - glViewport = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei )>(resolve("glViewport")); - - glClearDepth = reinterpret_cast<void (APIENTRY *)(GLdouble )>(resolve("glClearDepth")); - glDepthRange = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble )>(resolve("glDepthRange")); - - return wglCreateContext && glBindTexture && glClearDepth; + + return wglCreateContext && glGetError && glGetString; } BOOL QWindowsOpengl32DLL::swapBuffers(HDC dc) @@ -1383,78 +1336,23 @@ void QWindowsGLContext::doneCurrent() QFunctionPointer QWindowsGLContext::getProcAddress(const char *procName) { + // 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)); + // 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 // normally from opengl32.dll. wglGetProcAddress() is not guaranteed to work for such // functions, however in QT_OPENGL_DYNAMIC builds QOpenGLFunctions will just blindly - // call into here for _any_ OpenGL function. Hence the need to handle these specially - // here. The list has to match QOpenGLFunctions. See - // QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *). - static struct StdFunc { - const char *name; - void *func; - } standardFuncs[] = { - { "glBindTexture", (void *) QOpenGLStaticContext::opengl32.glBindTexture }, - { "glBlendFunc", (void *) QOpenGLStaticContext::opengl32.glBlendFunc }, - { "glClear", (void *) QOpenGLStaticContext::opengl32.glClear }, - { "glClearColor", (void *) QOpenGLStaticContext::opengl32.glClearColor }, - { "glClearStencil", (void *) QOpenGLStaticContext::opengl32.glClearStencil }, - { "glColorMask", (void *) QOpenGLStaticContext::opengl32.glColorMask }, - { "glCopyTexImage2D", (void *) QOpenGLStaticContext::opengl32.glCopyTexImage2D }, - { "glCopyTexSubImage2D", (void *) QOpenGLStaticContext::opengl32.glCopyTexSubImage2D }, - { "glCullFace", (void *) QOpenGLStaticContext::opengl32.glCullFace }, - { "glDeleteTextures", (void *) QOpenGLStaticContext::opengl32.glDeleteTextures }, - { "glDepthFunc", (void *) QOpenGLStaticContext::opengl32.glDepthFunc }, - { "glDepthMask", (void *) QOpenGLStaticContext::opengl32.glDepthMask }, - { "glDisable", (void *) QOpenGLStaticContext::opengl32.glDisable }, - { "glDrawArrays", (void *) QOpenGLStaticContext::opengl32.glDrawArrays }, - { "glDrawElements", (void *) QOpenGLStaticContext::opengl32.glDrawElements }, - { "glEnable", (void *) QOpenGLStaticContext::opengl32.glEnable }, - { "glFinish", (void *) QOpenGLStaticContext::opengl32.glFinish }, - { "glFlush", (void *) QOpenGLStaticContext::opengl32.glFlush }, - { "glFrontFace", (void *) QOpenGLStaticContext::opengl32.glFrontFace }, - { "glGenTextures", (void *) QOpenGLStaticContext::opengl32.glGenTextures }, - { "glGetBooleanv", (void *) QOpenGLStaticContext::opengl32.glGetBooleanv }, - { "glGetError", (void *) QOpenGLStaticContext::opengl32.glGetError }, - { "glGetFloatv", (void *) QOpenGLStaticContext::opengl32.glGetFloatv }, - { "glGetIntegerv", (void *) QOpenGLStaticContext::opengl32.glGetIntegerv }, - { "glGetString", (void *) QOpenGLStaticContext::opengl32.glGetString }, - { "glGetTexParameterfv", (void *) QOpenGLStaticContext::opengl32.glGetTexParameterfv }, - { "glGetTexParameteriv", (void *) QOpenGLStaticContext::opengl32.glGetTexParameteriv }, - { "glHint", (void *) QOpenGLStaticContext::opengl32.glHint }, - { "glIsEnabled", (void *) QOpenGLStaticContext::opengl32.glIsEnabled }, - { "glIsTexture", (void *) QOpenGLStaticContext::opengl32.glIsTexture }, - { "glLineWidth", (void *) QOpenGLStaticContext::opengl32.glLineWidth }, - { "glPixelStorei", (void *) QOpenGLStaticContext::opengl32.glPixelStorei }, - { "glPolygonOffset", (void *) QOpenGLStaticContext::opengl32.glPolygonOffset }, - { "glReadPixels", (void *) QOpenGLStaticContext::opengl32.glReadPixels }, - { "glScissor", (void *) QOpenGLStaticContext::opengl32.glScissor }, - { "glStencilFunc", (void *) QOpenGLStaticContext::opengl32.glStencilFunc }, - { "glStencilMask", (void *) QOpenGLStaticContext::opengl32.glStencilMask }, - { "glStencilOp", (void *) QOpenGLStaticContext::opengl32.glStencilOp }, - { "glTexImage2D", (void *) QOpenGLStaticContext::opengl32.glTexImage2D }, - { "glTexParameterf", (void *) QOpenGLStaticContext::opengl32.glTexParameterf }, - { "glTexParameterfv", (void *) QOpenGLStaticContext::opengl32.glTexParameterfv }, - { "glTexParameteri", (void *) QOpenGLStaticContext::opengl32.glTexParameteri }, - { "glTexParameteriv", (void *) QOpenGLStaticContext::opengl32.glTexParameteriv }, - { "glTexSubImage2D", (void *) QOpenGLStaticContext::opengl32.glTexSubImage2D }, - { "glViewport", (void *) QOpenGLStaticContext::opengl32.glViewport }, - - { "glClearDepth", (void *) QOpenGLStaticContext::opengl32.glClearDepth }, - { "glDepthRange", (void *) QOpenGLStaticContext::opengl32.glDepthRange }, - }; - for (size_t i = 0; i < sizeof(standardFuncs) / sizeof(StdFunc); ++i) - if (!qstrcmp(procName, standardFuncs[i].name)) - return reinterpret_cast<QFunctionPointer>(standardFuncs[i].func); + // call into here for _any_ OpenGL function. + if (!procAddress || procAddress == reinterpret_cast<void *>(0x1) || procAddress == reinterpret_cast<void *>(0x2) + || procAddress == reinterpret_cast<void *>(0x3) || procAddress == reinterpret_cast<void *>(-1)) + procAddress = reinterpret_cast<QFunctionPointer>(QOpenGLStaticContext::opengl32.resolve(procName)); - // 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)); 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); + return procAddress; } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index a0fc31227e..e8c78860f2 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -118,58 +118,12 @@ struct QWindowsOpengl32DLL BOOL (WINAPI * wglShareLists)(HGLRC context1, HGLRC context2); // GL1+GLES2 common - void (APIENTRY * glBindTexture)(GLenum target, GLuint texture); - void (APIENTRY * glBlendFunc)(GLenum sfactor, GLenum dfactor); - void (APIENTRY * glClear)(GLbitfield mask); - void (APIENTRY * glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY * glClearStencil)(GLint s); - void (APIENTRY * glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - void (APIENTRY * glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - void (APIENTRY * glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * glCullFace)(GLenum mode); - void (APIENTRY * glDeleteTextures)(GLsizei n, const GLuint* textures); - void (APIENTRY * glDepthFunc)(GLenum func); - void (APIENTRY * glDepthMask)(GLboolean flag); - void (APIENTRY * glDisable)(GLenum cap); - void (APIENTRY * glDrawArrays)(GLenum mode, GLint first, GLsizei count); - void (APIENTRY * glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); - void (APIENTRY * glEnable)(GLenum cap); - void (APIENTRY * glFinish)(); - void (APIENTRY * glFlush)(); - void (APIENTRY * glFrontFace)(GLenum mode); - void (APIENTRY * glGenTextures)(GLsizei n, GLuint* textures); - void (APIENTRY * glGetBooleanv)(GLenum pname, GLboolean* params); GLenum (APIENTRY * glGetError)(); - void (APIENTRY * glGetFloatv)(GLenum pname, GLfloat* params); void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params); const GLubyte * (APIENTRY * glGetString)(GLenum name); - void (APIENTRY * glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params); - void (APIENTRY * glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params); - void (APIENTRY * glHint)(GLenum target, GLenum mode); - GLboolean (APIENTRY * glIsEnabled)(GLenum cap); - GLboolean (APIENTRY * glIsTexture)(GLuint texture); - void (APIENTRY * glLineWidth)(GLfloat width); - void (APIENTRY * glPixelStorei)(GLenum pname, GLint param); - void (APIENTRY * glPolygonOffset)(GLfloat factor, GLfloat units); - void (APIENTRY * glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); - void (APIENTRY * glScissor)(GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * glStencilFunc)(GLenum func, GLint ref, GLuint mask); - void (APIENTRY * glStencilMask)(GLuint mask); - void (APIENTRY * glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); - void (APIENTRY * glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); - void (APIENTRY * glTexParameterf)(GLenum target, GLenum pname, GLfloat param); - void (APIENTRY * glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params); - void (APIENTRY * glTexParameteri)(GLenum target, GLenum pname, GLint param); - void (APIENTRY * glTexParameteriv)(GLenum target, GLenum pname, const GLint* params); - void (APIENTRY * glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); - void (APIENTRY * glViewport)(GLint x, GLint y, GLsizei width, GLsizei height); - - // GL only - void (APIENTRY * glClearDepth)(GLdouble depth); - void (APIENTRY * glDepthRange)(GLdouble zNear, GLdouble zFar); -private: void *resolve(const char *name); +private: HMODULE m_lib; bool m_nonOpengl32; |