Merge "Dont query for supported GLExtensions during Initialization." into tizen
authorRusty Lynch <rusty.lynch@intel.com>
Mon, 15 Jul 2013 19:51:25 +0000 (12:51 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 15 Jul 2013 19:51:25 +0000 (12:51 -0700)
Source/WebCore/platform/graphics/surfaces/egl/EGLHelper.cpp

index 8ab6836..931eb4d 100644 (file)
@@ -145,11 +145,6 @@ void EGLHelper::resolveEGLBindings(EGLDisplay eglDisplay)
         eglUnlockSurfaceKHR = (PFNEGLUNLOCKSURFACEKHRPROC)eglGetProcAddress("eglUnlockSurfaceKHR");
     }
 
-    if (!GLPlatformContext::supportsGLExtension("GL_OES_EGL_image")) {
-        LOG_ERROR("Platform doesn't support GL_OES_EGL_image. Support for this extension is required for Hardware Acceleration.");
-        return;
-    }
-
 #if PLATFORM(WAYLAND)
     if (GLPlatformContext::supportsEGLExtension(display, "EGL_KHR_image_base") && GLPlatformContext::supportsEGLExtension(display, "EGL_WL_bind_wayland_display")) {
 #else
@@ -176,7 +171,7 @@ void EGLHelper::createEGLImage(EGLImageKHR* image, GLenum target, const EGLClien
         return;
 
     EGLImageKHR tempHandle = EGL_NO_IMAGE_KHR;
-    if (eglCreateImageKHR && eglImageTargetTexture2DOES && eglDestroyImageKHR)
+    if (eglCreateImageKHR && eglDestroyImageKHR)
         tempHandle = eglCreateImageKHR(display, EGL_NO_CONTEXT, target, clientBuffer, attributes);
 
     *image = tempHandle;
@@ -197,8 +192,21 @@ void EGLHelper::destroyEGLImage(const EGLImageKHR image, EGLDisplay eglDisplay)
 
 void EGLHelper::imageTargetTexture2DOES(const EGLImageKHR image)
 {
-    if (eglImageTargetTexture2DOES)
-        eglImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(image));
+    if (!eglImageTargetTexture2DOES) {
+        static bool supportsEGLImageTarget = GLPlatformContext::supportsGLExtension("GL_OES_EGL_image");
+        if (!supportsEGLImageTarget) {
+            LOG_ERROR("Platform doesn't support GL_OES_EGL_image. Support for this extension is required for Hardware Acceleration.");
+            return;
+        }
+
+        eglImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
+        if (!eglImageTargetTexture2DOES) {
+            LOG_ERROR("Failed to resolve eglImageTargetTexture2DOES.");
+            return;
+        }
+    }
+
+    eglImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(image));
 }
 
 bool EGLHelper::lockSurface(EGLSurface surface, EGLint lockAttrib[], EGLDisplay eglDisplay)