[WebGL][EFL][GTK][Qt]Add support for OES_vertex_array_object.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2013 21:30:21 +0000 (21:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2013 21:30:21 +0000 (21:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109382

Patch by Kondapally Kalyan <kalyan.kondapally@intel.com> on 2013-02-13
Reviewed by Kenneth Russell.

Source/WebCore:

Covered by fast/canvas/webgl/oes-vertex-array-object.html

This patch adds support for using Vertex Array Object with OpenGl.
The patch adds support for loading necessary opengl functions
and support for checking GL_ARB_vertex_array_object. The support
for OES_vertex_array_object is advertised if GL_ARB_vertex_array_object is
supported.

* platform/graphics/OpenGLShims.cpp:
(WebCore::initializeOpenGLShims):
* platform/graphics/OpenGLShims.h:
(_OpenGLFunctionTable):
Added support for loading the necessary functions.

* platform/graphics/opengl/Extensions3DOpenGL.cpp:
(WebCore::Extensions3DOpenGL::createVertexArrayOES):
(WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
(WebCore::Extensions3DOpenGL::isVertexArrayOES):
(WebCore::Extensions3DOpenGL::bindVertexArrayOES):
(WebCore::Extensions3DOpenGL::supportsExtension):

(WebCore):
(WebCore::Extensions3DOpenGL::isVertexArrayObjectSupported):
* platform/graphics/opengl/Extensions3DOpenGL.h:
(Extensions3DOpenGL):

LayoutTests:

Enable oes-vertex-array-object for EFL port.

* fast/canvas/webgl/oes-vertex-array-object-expected.txt:
* fast/canvas/webgl/oes-vertex-array-object.html:
* platform/efl/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142786 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/oes-vertex-array-object-expected.txt
LayoutTests/fast/canvas/webgl/oes-vertex-array-object.html
LayoutTests/platform/efl/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/OpenGLShims.cpp
Source/WebCore/platform/graphics/OpenGLShims.h
Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h

index 6c6bdd15d842a351d8a0cd5ef7ee976063b0b9d1..86a5084e567a432d2a96ddef4d32a18bbc19f5a1 100644 (file)
@@ -1,3 +1,16 @@
+2013-02-13  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [WebGL][EFL][GTK][Qt]Add support for OES_vertex_array_object.
+        https://bugs.webkit.org/show_bug.cgi?id=109382
+
+        Reviewed by Kenneth Russell.
+
+        Enable oes-vertex-array-object for EFL port.
+
+        * fast/canvas/webgl/oes-vertex-array-object-expected.txt:
+        * fast/canvas/webgl/oes-vertex-array-object.html:
+        * platform/efl/TestExpectations:
+
 2013-02-13  Filip Pizlo  <fpizlo@apple.com>
 
         DFG LogicalNot/Branch peephole removal and inversion ignores the possibility of things exiting
index 37abadd781b64fbd62164c71a7b9636b2087f629..5ddf3728fe288051da549662272b65c79fb1b91b 100644 (file)
@@ -47,4 +47,5 @@ PASS getError was expected value: NO_ERROR : there should be no errors
 
 PASS successfullyParsed is true
 
-TEST COMPLETE
\ No newline at end of file
+TEST COMPLETE
+
index cd07943709f181385d52c40bcd94a48d0e30d25d..3a13d6a15f1d2abea662b53b3806c945973cc01e 100644 (file)
@@ -33,6 +33,9 @@ description("This test verifies the functionality of the OES_vertex_array_object
 
 debug("");
 
+if (window.internals)
+    window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
+
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("canvas");
 var gl = create3DContext(canvas);
@@ -590,8 +593,7 @@ function runArrayBufferBindTests() {
 
 debug("");
 successfullyParsed = true;
+isSuccessfullyParsed();
 </script>
-<script src="../../resources/js-test-post.js"></script>
-
 </body>
 </html>
index 5046882c040a02ef6acf41ca3bf1ce5bf31fc778..6cf3576b0e2477293d9f550740ab4b2a92a932d1 100644 (file)
@@ -345,9 +345,6 @@ fast/css/draggable-region-parser.html
 
 webkit.org/b/99096 fast/canvas/webgl/arraybuffer-transfer-of-control.html [ Failure Pass ]
 
-# Expected to fail until support for extension is implemented
-webkit.org/b/96828 fast/canvas/webgl/oes-vertex-array-object.html [ Failure Pass ]
-
 # Expected to fail until OES_element_index_uint extension is implemented
 webkit.org/b/98257 fast/canvas/webgl/oes-element-index-uint.html [ Failure Pass ]
 
index d424848c1d0d5ce9f6388bc0fed337f4d08e882d..3e6c92cd905d19d3cf530e8caa6335c29a29a803 100644 (file)
@@ -1,3 +1,36 @@
+2013-02-13  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [WebGL][EFL][GTK][Qt]Add support for OES_vertex_array_object.
+        https://bugs.webkit.org/show_bug.cgi?id=109382
+
+        Reviewed by Kenneth Russell.
+
+        Covered by fast/canvas/webgl/oes-vertex-array-object.html
+
+        This patch adds support for using Vertex Array Object with OpenGl.
+        The patch adds support for loading necessary opengl functions
+        and support for checking GL_ARB_vertex_array_object. The support
+        for OES_vertex_array_object is advertised if GL_ARB_vertex_array_object is
+        supported.
+
+        * platform/graphics/OpenGLShims.cpp:
+        (WebCore::initializeOpenGLShims):
+        * platform/graphics/OpenGLShims.h:
+        (_OpenGLFunctionTable):
+        Added support for loading the necessary functions.
+
+        * platform/graphics/opengl/Extensions3DOpenGL.cpp:
+        (WebCore::Extensions3DOpenGL::createVertexArrayOES):
+        (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
+        (WebCore::Extensions3DOpenGL::isVertexArrayOES):
+        (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
+        (WebCore::Extensions3DOpenGL::supportsExtension):
+
+        (WebCore):
+        (WebCore::Extensions3DOpenGL::isVertexArrayObjectSupported):
+        * platform/graphics/opengl/Extensions3DOpenGL.h:
+        (Extensions3DOpenGL):
+
 2013-02-13  Eberhard Graether  <egraether@google.com>
 
         chromium: remove CompositorHUDFontAtlas
index ac7df609e1e8a7c57a6695cade69557c3ce2ac24..988f8b98daa7348688d3f0b54bd6e1b8c5fe0932 100644 (file)
@@ -127,6 +127,7 @@ bool initializeOpenGLShims()
     ASSIGN_FUNCTION_TABLE_ENTRY(glBindBuffer, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBindFramebuffer, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBindRenderbuffer, success);
+    ASSIGN_FUNCTION_TABLE_ENTRY(glBindVertexArray, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlendColor, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlendEquation, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glBlendEquationSeparate, success);
@@ -148,6 +149,7 @@ bool initializeOpenGLShims()
     ASSIGN_FUNCTION_TABLE_ENTRY(glDeleteProgram, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glDeleteRenderbuffers, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glDeleteShader, success);
+    ASSIGN_FUNCTION_TABLE_ENTRY(glDeleteVertexArrays, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glDetachShader, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glDisableVertexAttribArray, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glEnableVertexAttribArray, success);
@@ -157,6 +159,7 @@ bool initializeOpenGLShims()
     ASSIGN_FUNCTION_TABLE_ENTRY(glGenerateMipmap, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glGenFramebuffers, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glGenRenderbuffers, success);
+    ASSIGN_FUNCTION_TABLE_ENTRY(glGenVertexArrays, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glGetActiveAttrib, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glGetActiveUniform, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glGetAttachedShaders, success);
@@ -180,6 +183,7 @@ bool initializeOpenGLShims()
     ASSIGN_FUNCTION_TABLE_ENTRY(glIsProgram, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glIsRenderbuffer, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glIsShader, success);
+    ASSIGN_FUNCTION_TABLE_ENTRY(glIsVertexArray, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glLinkProgram, success);
     ASSIGN_FUNCTION_TABLE_ENTRY(glRenderbufferStorage, success);
     // In GLES2 there are optional ANGLE and APPLE extensions for glRenderbufferStorageMultisample.
index 3d96927e6f717d147eb9935a34957e9567683a9a..b37131db823be3ebc69ebf943c9ae3c4a68f638b 100644 (file)
@@ -53,6 +53,7 @@ typedef void (GLAPIENTRY *glBindAttribLocationType) (GLuint, GLuint, const char*
 typedef void (GLAPIENTRY *glBindBufferType) (GLenum, GLuint);
 typedef void (GLAPIENTRY *glBindFramebufferType) (GLenum, GLuint);
 typedef void (GLAPIENTRY *glBindRenderbufferType) (GLenum, GLuint);
+typedef void (GLAPIENTRY *glBindVertexArrayType) (GLuint);
 typedef void (GLAPIENTRY *glBlendColorType) (GLclampf, GLclampf, GLclampf, GLclampf);
 typedef void (GLAPIENTRY *glBlendEquationType) (GLenum);
 typedef void (GLAPIENTRY *glBlendEquationSeparateType)(GLenum, GLenum);
@@ -69,6 +70,7 @@ typedef void (GLAPIENTRY *glDeleteFramebuffersType) (GLsizei n, const GLuint*);
 typedef void (GLAPIENTRY *glDeleteProgramType) (GLuint);
 typedef void (GLAPIENTRY *glDeleteRenderbuffersType) (GLsizei n, const GLuint*);
 typedef void (GLAPIENTRY *glDeleteShaderType) (GLuint);
+typedef void (GLAPIENTRY *glDeleteVertexArraysType) (GLsizei, const GLuint*);
 typedef void (GLAPIENTRY *glDetachShaderType) (GLuint, GLuint);
 typedef void (GLAPIENTRY *glDisableVertexAttribArrayType) (GLuint);
 typedef void (GLAPIENTRY *glEnableVertexAttribArrayType) (GLuint);
@@ -78,6 +80,7 @@ typedef void (GLAPIENTRY *glGenBuffersType) (GLsizei, GLuint*);
 typedef void (GLAPIENTRY *glGenerateMipmapType) (GLenum target);
 typedef void (GLAPIENTRY *glGenFramebuffersType) (GLsizei, GLuint*);
 typedef void (GLAPIENTRY *glGenRenderbuffersType) (GLsizei, GLuint*);
+typedef void (GLAPIENTRY *glGenVertexArraysType) (GLsizei, GLuint*);
 typedef void (GLAPIENTRY *glGetActiveAttribType) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
 typedef void (GLAPIENTRY *glGetActiveUniformType) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
 typedef void (GLAPIENTRY *glGetAttachedShadersType) (GLuint, GLsizei, GLsizei*, GLuint*);
@@ -101,6 +104,7 @@ typedef GLboolean (GLAPIENTRY *glIsFramebufferType) (GLuint);
 typedef GLboolean (GLAPIENTRY *glIsProgramType) (GLuint);
 typedef GLboolean (GLAPIENTRY *glIsRenderbufferType) (GLuint);
 typedef GLboolean (GLAPIENTRY *glIsShaderType) (GLuint);
+typedef GLboolean (GLAPIENTRY *glIsVertexArrayType) (GLuint);
 typedef void (GLAPIENTRY *glLinkProgramType) (GLuint);
 typedef void (GLAPIENTRY *glRenderbufferStorageType) (GLenum, GLenum, GLsizei, GLsizei);
 typedef void (GLAPIENTRY *glRenderbufferStorageMultisampleType) (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
@@ -149,6 +153,7 @@ typedef struct _OpenGLFunctionTable {
     FUNCTION_TABLE_ENTRY(glBindBuffer);
     FUNCTION_TABLE_ENTRY(glBindFramebuffer);
     FUNCTION_TABLE_ENTRY(glBindRenderbuffer);
+    FUNCTION_TABLE_ENTRY(glBindVertexArray);
     FUNCTION_TABLE_ENTRY(glBlendColor);
     FUNCTION_TABLE_ENTRY(glBlendEquation);
     FUNCTION_TABLE_ENTRY(glBlendEquationSeparate);
@@ -165,6 +170,7 @@ typedef struct _OpenGLFunctionTable {
     FUNCTION_TABLE_ENTRY(glDeleteProgram);
     FUNCTION_TABLE_ENTRY(glDeleteRenderbuffers);
     FUNCTION_TABLE_ENTRY(glDeleteShader);
+    FUNCTION_TABLE_ENTRY(glDeleteVertexArrays);
     FUNCTION_TABLE_ENTRY(glDetachShader);
     FUNCTION_TABLE_ENTRY(glDisableVertexAttribArray);
     FUNCTION_TABLE_ENTRY(glEnableVertexAttribArray);
@@ -174,6 +180,7 @@ typedef struct _OpenGLFunctionTable {
     FUNCTION_TABLE_ENTRY(glGenerateMipmap);
     FUNCTION_TABLE_ENTRY(glGenFramebuffers);
     FUNCTION_TABLE_ENTRY(glGenRenderbuffers);
+    FUNCTION_TABLE_ENTRY(glGenVertexArrays);
     FUNCTION_TABLE_ENTRY(glGetActiveAttrib);
     FUNCTION_TABLE_ENTRY(glGetActiveUniform);
     FUNCTION_TABLE_ENTRY(glGetAttachedShaders);
@@ -197,6 +204,7 @@ typedef struct _OpenGLFunctionTable {
     FUNCTION_TABLE_ENTRY(glIsProgram);
     FUNCTION_TABLE_ENTRY(glIsRenderbuffer);
     FUNCTION_TABLE_ENTRY(glIsShader);
+    FUNCTION_TABLE_ENTRY(glIsVertexArray);
     FUNCTION_TABLE_ENTRY(glLinkProgram);
     FUNCTION_TABLE_ENTRY(glRenderbufferStorage);
     FUNCTION_TABLE_ENTRY(glRenderbufferStorageMultisample);
@@ -248,6 +256,7 @@ typedef struct _OpenGLFunctionTable {
 #define glBindFramebuffer                      LOOKUP_GL_FUNCTION(glBindFramebuffer)
 #define glBindRenderbufferEXT                  glBindRenderbuffer
 #define glBindRenderbuffer                     LOOKUP_GL_FUNCTION(glBindRenderbuffer)
+#define glBindVertexArray                      LOOKUP_GL_FUNCTION(glBindVertexArray)
 #define glBlendColor                           LOOKUP_GL_FUNCTION(glBlendColor)
 #define glBlendEquation                        LOOKUP_GL_FUNCTION(glBlendEquation)
 #define glBlendEquationSeparate                LOOKUP_GL_FUNCTION(glBlendEquationSeparate)
@@ -268,6 +277,7 @@ typedef struct _OpenGLFunctionTable {
 #define glDeleteRenderbuffersEXT               glDeleteRenderbuffers
 #define glDeleteRenderbuffers                  LOOKUP_GL_FUNCTION(glDeleteRenderbuffers)
 #define glDeleteShader                         LOOKUP_GL_FUNCTION(glDeleteShader)
+#define glDeleteVertexArrays                   LOOKUP_GL_FUNCTION(glDeleteVertexArrays)
 #define glDetachShader                         LOOKUP_GL_FUNCTION(glDetachShader)
 #define glDisableVertexAttribArray             LOOKUP_GL_FUNCTION(glDisableVertexAttribArray)
 #define glEnableVertexAttribArray              LOOKUP_GL_FUNCTION(glEnableVertexAttribArray)
@@ -282,6 +292,7 @@ typedef struct _OpenGLFunctionTable {
 #define glGenFramebuffers                      LOOKUP_GL_FUNCTION(glGenFramebuffers)
 #define glGenRenderbuffersEXT                  glGenRenderbuffers
 #define glGenRenderbuffers                     LOOKUP_GL_FUNCTION(glGenRenderbuffers)
+#define glGenVertexArrays                      LOOKUP_GL_FUNCTION(glGenVertexArrays)
 #define glGetActiveAttrib                      LOOKUP_GL_FUNCTION(glGetActiveAttrib)
 #define glGetActiveUniform                     LOOKUP_GL_FUNCTION(glGetActiveUniform)
 #define glGetAttachedShaders                   LOOKUP_GL_FUNCTION(glGetAttachedShaders)
@@ -310,6 +321,7 @@ typedef struct _OpenGLFunctionTable {
 #define glIsRenderbufferEXT                    glIsRenderbuffer
 #define glIsRenderbuffer                       LOOKUP_GL_FUNCTION(glIsRenderbuffer)
 #define glIsShader                             LOOKUP_GL_FUNCTION(glIsShader)
+#define glIsVertexArray                        LOOKUP_GL_FUNCTION(glIsVertexArray)
 #define glLinkProgram                          LOOKUP_GL_FUNCTION(glLinkProgram)
 #define glRenderbufferStorageEXT               glRenderbufferStorage
 #define glRenderbufferStorage                  LOOKUP_GL_FUNCTION(glRenderbufferStorage)
index 6ccf4b26c664e1a827aa841736c0e9434c973925..d062fc0fe1e467c8c40f249ff611e8e4c7a6eb8c 100644 (file)
@@ -64,22 +64,26 @@ void Extensions3DOpenGL::renderbufferStorageMultisample(unsigned long target, un
 Platform3DObject Extensions3DOpenGL::createVertexArrayOES()
 {
     m_context->makeContextCurrent();
-#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
     GLuint array = 0;
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+    if (isVertexArrayObjectSupported())
+        glGenVertexArrays(1, &array);
+#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
     glGenVertexArraysAPPLE(1, &array);
-    return array;
-#else
-    return 0;
 #endif
+    return array;
 }
 
 void Extensions3DOpenGL::deleteVertexArrayOES(Platform3DObject array)
 {
     if (!array)
         return;
-    
+
     m_context->makeContextCurrent();
-#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+    if (isVertexArrayObjectSupported())
+        glDeleteVertexArrays(1, &array);
+#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
     glDeleteVertexArraysAPPLE(1, &array);
 #endif
 }
@@ -88,19 +92,24 @@ GC3Dboolean Extensions3DOpenGL::isVertexArrayOES(Platform3DObject array)
 {
     if (!array)
         return GL_FALSE;
-    
+
     m_context->makeContextCurrent();
-#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+    if (isVertexArrayObjectSupported())
+        return glIsVertexArray(array);
+#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
     return glIsVertexArrayAPPLE(array);
-#else
-    return GL_FALSE;
 #endif
+    return GL_FALSE;
 }
 
 void Extensions3DOpenGL::bindVertexArrayOES(Platform3DObject array)
 {
     m_context->makeContextCurrent();
-#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+    if (isVertexArrayObjectSupported())
+        glBindVertexArray(array);
+#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
     glBindVertexArrayAPPLE(array);
 #else
     UNUSED_PARAM(array);
@@ -150,8 +159,13 @@ bool Extensions3DOpenGL::supportsExtension(const String& name)
         return m_availableExtensions.contains("GL_ARB_texture_float");
 
     // GL_OES_vertex_array_object
-    if (name == "GL_OES_vertex_array_object")
+    if (name == "GL_OES_vertex_array_object") {
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+        return m_availableExtensions.contains("GL_ARB_vertex_array_object");
+#else
         return m_availableExtensions.contains("GL_APPLE_vertex_array_object");
+#endif
+    }
 
     // Desktop GL always supports the standard derivative functions
     if (name == "GL_OES_standard_derivatives")
@@ -172,6 +186,14 @@ String Extensions3DOpenGL::getExtensions()
     return String(reinterpret_cast<const char*>(::glGetString(GL_EXTENSIONS)));
 }
 
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+bool Extensions3DOpenGL::isVertexArrayObjectSupported()
+{
+    static const bool supportsVertexArrayObject = supports("GL_OES_vertex_array_object");
+    return supportsVertexArrayObject;
+}
+#endif
+
 } // namespace WebCore
 
 #endif // USE(3D_GRAPHICS)
index 3bec8965628f8945cbf516530c0cd226ebfc7712..66791a49ff15673d289e28872693067845a34075 100644 (file)
@@ -59,6 +59,10 @@ protected:
 
     virtual bool supportsExtension(const WTF::String&);
     virtual String getExtensions();
+#if (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL))
+private:
+    bool isVertexArrayObjectSupported();
+#endif
 };
 
 } // namespace WebCore