Title: [127874] trunk/Source/WebCore
Revision
127874
Author
hausm...@webkit.org
Date
2012-09-07 09:05:12 -0700 (Fri, 07 Sep 2012)

Log Message

Build of OpenGLShims.cpp against EGL/GLES2 platforms is broken
https://bugs.webkit.org/show_bug.cgi?id=95556

Reviewed by Jocelyn Turcotte.

There were a few problems:

1) GL_ANGLE_framebuffer_blit is the name of the macro indicating the
availability of the _declaration_ of that ANGLE extension. It is not the
name of the actual function, which is glBlitFramebufferANGLE.

2) The presence of the preprocessor macros indicating the availability
of the declaration of the extension does not imply presence of the extension
prototypes at link time. Instead extensions need to be looked up dynamically
at run-time.

3) dlfcn.h was unconditionally included. We do not need it when building against
Qt (and there it breaks the Windows build)

This patch implements the dynamic lookup of glBlitFramebufferANGLE
(used in GraphicsContext3DOpenGLES.cpp) as well as the dynamic lookup of the
Angle and Apple renderbuffer multisampling extensions.

* platform/graphics/OpenGLShims.cpp:
(WebCore):
(WebCore::initializeOpenGLShims):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127873 => 127874)


--- trunk/Source/WebCore/ChangeLog	2012-09-07 16:03:25 UTC (rev 127873)
+++ trunk/Source/WebCore/ChangeLog	2012-09-07 16:05:12 UTC (rev 127874)
@@ -1,3 +1,32 @@
+2012-09-07  Simon Hausmann  <simon.hausm...@nokia.com>
+
+        Build of OpenGLShims.cpp against EGL/GLES2 platforms is broken
+        https://bugs.webkit.org/show_bug.cgi?id=95556
+
+        Reviewed by Jocelyn Turcotte.
+
+        There were a few problems:
+
+        1) GL_ANGLE_framebuffer_blit is the name of the macro indicating the
+        availability of the _declaration_ of that ANGLE extension. It is not the
+        name of the actual function, which is glBlitFramebufferANGLE.
+
+        2) The presence of the preprocessor macros indicating the availability
+        of the declaration of the extension does not imply presence of the extension
+        prototypes at link time. Instead extensions need to be looked up dynamically
+        at run-time.
+
+        3) dlfcn.h was unconditionally included. We do not need it when building against
+        Qt (and there it breaks the Windows build)
+
+        This patch implements the dynamic lookup of glBlitFramebufferANGLE
+        (used in GraphicsContext3DOpenGLES.cpp) as well as the dynamic lookup of the
+        Angle and Apple renderbuffer multisampling extensions.
+
+        * platform/graphics/OpenGLShims.cpp:
+        (WebCore):
+        (WebCore::initializeOpenGLShims):
+
 2012-09-07  Zan Dobersek  <zandober...@gmail.com>
 
         [GTK] Multiple feature defines in webcore_cppflags can occur

Modified: trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp (127873 => 127874)


--- trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp	2012-09-07 16:03:25 UTC (rev 127873)
+++ trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp	2012-09-07 16:05:12 UTC (rev 127874)
@@ -22,7 +22,10 @@
 #define DISABLE_SHIMS
 #include "OpenGLShims.h"
 
+#if !PLATFORM(QT)
 #include <dlfcn.h>
+#endif
+
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
@@ -34,11 +37,6 @@
     return &table;
 }
 
-#if PLATFORM(QT) && defined(QT_OPENGL_ES_2)
-#define ASSIGN_FUNCTION_TABLE_ENTRY(FunctionName, success) \
-    openGLFunctionTable()->FunctionName = ::FunctionName
-#else
-
 #if PLATFORM(QT)
 static void* getProcAddress(const char* procName)
 {
@@ -63,9 +61,9 @@
 }
 #endif
 
-static void* lookupOpenGLFunctionAddress(const char* functionName, bool& success)
+static void* lookupOpenGLFunctionAddress(const char* functionName, bool* success = 0)
 {
-    if (!success)
+    if (success && !*success)
         return 0;
 
     void* target = getProcAddress(functionName);
@@ -82,17 +80,39 @@
     fullFunctionName.append("EXT");
     target = getProcAddress(fullFunctionName.utf8().data());
 
+#if defined(GL_ES_VERSION_2_0)
+    fullFunctionName = functionName;
+    fullFunctionName.append("ANGLE");
+    target = getProcAddress(fullFunctionName.utf8().data());
+
+    fullFunctionName = functionName;
+    fullFunctionName.append("APPLE");
+    target = getProcAddress(fullFunctionName.utf8().data());
+#endif
+
     // A null address is still a failure case.
-    if (!target)
-        success = false;
+    if (!target && success)
+        *success = false;
 
     return target;
 }
 
+#if PLATFORM(QT) && defined(QT_OPENGL_ES_2)
+
+// With Angle only EGL/GLES2 extensions are available through eglGetProcAddress, not the regular standardized functions.
 #define ASSIGN_FUNCTION_TABLE_ENTRY(FunctionName, success) \
-    openGLFunctionTable()->FunctionName = reinterpret_cast<FunctionName##Type>(lookupOpenGLFunctionAddress(#FunctionName, success))
+    openGLFunctionTable()->FunctionName = ::FunctionName
+
+#else
+
+#define ASSIGN_FUNCTION_TABLE_ENTRY(FunctionName, success) \
+    openGLFunctionTable()->FunctionName = reinterpret_cast<FunctionName##Type>(lookupOpenGLFunctionAddress(#FunctionName, &success))
+
 #endif
 
+#define ASSIGN_FUNCTION_TABLE_ENTRY_EXT(FunctionName) \
+    openGLFunctionTable()->FunctionName = reinterpret_cast<FunctionName##Type>(lookupOpenGLFunctionAddress(#FunctionName))
+
 bool initializeOpenGLShims()
 {
     static bool success = true;
@@ -111,15 +131,10 @@
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlendEquation, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlendEquationSeparate, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlendFuncSeparate, success);
+    // In GLES2 there is optional an ANGLE extension for glBlitFramebuffer
 #if defined(GL_ES_VERSION_2_0)
-
-#if defined(GL_ANGLE_framebuffer_blit)
-    openGLFunctionTable()->glBlitFramebuffer = ::GL_ANGLE_framebuffer_blit;
+    ASSIGN_FUNCTION_TABLE_ENTRY_EXT(glBlitFramebuffer);
 #else
-    openGLFunctionTable()->glBlitFramebuffer = 0;
-#endif
-
-#else
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlitFramebuffer, success);
 #endif
     ASSIGN_FUNCTION_TABLE_ENTRY(glBufferData, success);
@@ -167,17 +182,10 @@
     ASSIGN_FUNCTION_TABLE_ENTRY(glIsShader, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glLinkProgram, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glRenderbufferStorage, success);
+    // In GLES2 there are optional ANGLE and APPLE extensions for glRenderbufferStorageMultisample.
 #if defined(GL_ES_VERSION_2_0)
-
-#if defined(GL_APPLE_framebuffer_multisample)
-    openGLFunctionTable()->glRenderbufferStorageMultisample = ::glRenderbufferStorageMultisampleAPPLE;
-#elif defined(GL_ANGLE_framebuffer_multisample)
-    openGLFunctionTable()->glRenderbufferStorageMultisample = ::glRenderbufferStorageMultisampleANGLE;
+    ASSIGN_FUNCTION_TABLE_ENTRY_EXT(glRenderbufferStorageMultisample);
 #else
-    openGLFunctionTable()->glRenderbufferStorageMultisample = 0;
-#endif
-
-#else
     ASSIGN_FUNCTION_TABLE_ENTRY(glRenderbufferStorageMultisample, success);
 #endif
     ASSIGN_FUNCTION_TABLE_ENTRY(glSampleCoverage, success);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to