WebGL 2 conformance: vertex_arrays/vertex_array_object.html
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Aug 2018 00:11:49 +0000 (00:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Aug 2018 00:11:49 +0000 (00:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188291
<rdar://problem/42792709>

Source/WebCore:

Patch by Justin Fan <justin_fan@apple.com> on 2018-08-03
Reviewed by Dean Jackson.

Get https://www.khronos.org/registry/webgl/conformance-suites/2.0.0/conformance2/vertex_arrays/vertex-array-object.html
working on Mac OS and iOS, and check in the new test expectations.

Existing test: webgl/2.0.0/conformance2/vertex_arrays/vertex-array-object.html

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
(WebCore::WebGL2RenderingContext::deleteVertexArray):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::deleteObject):
* html/canvas/WebGLVertexArrayObject.cpp:
(WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::checkVaryingsPacking const):
(WebCore::GraphicsContext3D::createVertexArray):
(WebCore::GraphicsContext3D::deleteVertexArray):
(WebCore::GraphicsContext3D::isVertexArray):
(WebCore::GraphicsContext3D::bindVertexArray):

LayoutTests:

Get https://www.khronos.org/registry/webgl/conformance-suites/2.0.0/conformance2/vertex_arrays/vertex-array-object.html
working on Mac OS and iOS, and check in the new test expectations.

Patch by Justin Fan <justin_fan@apple.com> on 2018-08-03
Reviewed by Dean Jackson.

* TestExpectations: No longer skipping vertex_arrays tests.
The following FAILed before this patch but are now expecting PASSes.
* webgl/2.0.0/conformance2/glsl3/array-as-return-value-expected.txt:
* webgl/2.0.0/conformance2/glsl3/array-assign-constructor-expected.txt:
* webgl/2.0.0/conformance2/glsl3/array-assign-expected.txt:
* webgl/2.0.0/conformance2/glsl3/array-complex-indexing-expected.txt:
* webgl/2.0.0/conformance2/glsl3/array-element-increment-expected.txt:
* webgl/2.0.0/conformance2/glsl3/array-equality-expected.txt:
* webgl/2.0.0/conformance2/glsl3/array-in-complex-expression-expected.txt:
* webgl/2.0.0/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec-expected.txt:
* webgl/2.0.0/conformance2/glsl3/compare-structs-containing-arrays-expected.txt:
* webgl/2.0.0/conformance2/glsl3/const-array-init-expected.txt:
* webgl/2.0.0/conformance2/glsl3/frag-depth-expected.txt:
* webgl/2.0.0/conformance2/glsl3/loops-with-side-effects-expected.txt:
* webgl/2.0.0/conformance2/glsl3/no-attribute-vertex-shader-expected.txt:
* webgl/2.0.0/conformance2/glsl3/short-circuiting-in-loop-condition-expected.txt:
* webgl/2.0.0/conformance2/glsl3/tricky-loop-conditions-expected.txt:
* webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-expected.txt:
* webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-nv-driver-bug-expected.txt:

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

24 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-as-return-value-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-assign-constructor-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-assign-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-complex-indexing-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-element-increment-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-equality-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/array-in-complex-expression-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/compare-structs-containing-arrays-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/const-array-init-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/frag-depth-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/loops-with-side-effects-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/no-attribute-vertex-shader-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/short-circuiting-in-loop-condition-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/tricky-loop-conditions-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-expected.txt
LayoutTests/webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-nv-driver-bug-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/html/canvas/WebGLVertexArrayObject.cpp
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

index 6555a96..23404ce 100644 (file)
@@ -1,3 +1,34 @@
+2018-08-03  Justin Fan  <justin_fan@apple.com>
+
+        WebGL 2 conformance: vertex_arrays/vertex_array_object.html
+        https://bugs.webkit.org/show_bug.cgi?id=188291
+        <rdar://problem/42792709>
+
+        Get https://www.khronos.org/registry/webgl/conformance-suites/2.0.0/conformance2/vertex_arrays/vertex-array-object.html 
+        working on Mac OS and iOS, and check in the new test expectations.
+
+        Reviewed by Dean Jackson.
+
+        * TestExpectations: No longer skipping vertex_arrays tests.
+        The following FAILed before this patch but are now expecting PASSes.
+        * webgl/2.0.0/conformance2/glsl3/array-as-return-value-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/array-assign-constructor-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/array-assign-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/array-complex-indexing-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/array-element-increment-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/array-equality-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/array-in-complex-expression-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/compare-structs-containing-arrays-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/const-array-init-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/frag-depth-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/loops-with-side-effects-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/no-attribute-vertex-shader-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/short-circuiting-in-loop-condition-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/tricky-loop-conditions-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-nv-driver-bug-expected.txt:
+
 2018-08-03  Ryan Haddad  <ryanhaddad@apple.com>
 
         Skip imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_abort.html.
index 9e0aaea..12a66bc 100644 (file)
@@ -2054,6 +2054,7 @@ webkit.org/b/186574 media/video-buffering-allowed.html [ Pass Failure ]
 # All WebGL 1 and 2 tests for now
 webgl/2.0.0 [ Skip ]
 webgl/2.0.0/conformance2/glsl3 [ Pass ]
+webgl/2.0.0/conformance2/vertex_arrays [ Pass ]
 
 imported/w3c/web-platform-tests/css/css-display/run-in/run-in-contains-table-row-001.xht [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-text-decor/text-emphasis-style-008.html [ ImageOnlyFailure ]
index 31c073c..221b91a 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-as-return-value.html
-FAIL
+PASS
 
index 4471c3c..0611499 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-assign-constructor.html
-FAIL
+PASS
 
index d8d2d39..1ea955c 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-assign.html
-FAIL
+PASS
 
index 55cdbb4..bd1431f 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-complex-indexing.html
-FAIL
+PASS
 
index 37f4a3c..956f396 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-element-increment.html
-FAIL
+PASS
 
index 5e12641..1c3cc92 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-equality.html
-FAIL
+PASS
 
index 4e589cd..50395b1 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/array-in-complex-expression.html
-FAIL
+PASS
 
index 4ba21c5..dd842ae 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec.html
-FAIL
+PASS
 
index 6046dda..23472cd 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/compare-structs-containing-arrays.html
-FAIL
+PASS
 
index 41feea6..a0e726e 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/const-array-init.html
-FAIL
+PASS
 
index 43b7376..7361710 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/frag-depth.html
-FAIL
+PASS
 
index fe9a0ea..de6a500 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/loops-with-side-effects.html
-FAIL
+PASS
 
index 5e556af..dfb6896 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/no-attribute-vertex-shader.html
-FAIL
+PASS
 
index f21c486..496d8e8 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/short-circuiting-in-loop-condition.html
-FAIL
+PASS
 
index 76f8d81..9a723a6 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/tricky-loop-conditions.html
-FAIL
+PASS
 
index e234abe..4372fc3 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/vector-dynamic-indexing.html
-FAIL
+PASS
 
index 921ba2a..a2a0b5e 100644 (file)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/vector-dynamic-indexing-nv-driver-bug.html
-FAIL
+PASS
 
index ec1e99b..bd925f1 100644 (file)
@@ -1,3 +1,30 @@
+2018-08-03  Justin Fan  <justin_fan@apple.com>
+
+        WebGL 2 conformance: vertex_arrays/vertex_array_object.html
+        https://bugs.webkit.org/show_bug.cgi?id=188291
+        <rdar://problem/42792709>
+
+        Reviewed by Dean Jackson.
+
+        Get https://www.khronos.org/registry/webgl/conformance-suites/2.0.0/conformance2/vertex_arrays/vertex-array-object.html 
+        working on Mac OS and iOS, and check in the new test expectations.
+
+        Existing test: webgl/2.0.0/conformance2/vertex_arrays/vertex-array-object.html
+
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
+        (WebCore::WebGL2RenderingContext::deleteVertexArray):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::deleteObject):
+        * html/canvas/WebGLVertexArrayObject.cpp:
+        (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::checkVaryingsPacking const):
+        (WebCore::GraphicsContext3D::createVertexArray):
+        (WebCore::GraphicsContext3D::deleteVertexArray):
+        (WebCore::GraphicsContext3D::isVertexArray):
+        (WebCore::GraphicsContext3D::bindVertexArray):
+
 2018-08-03  Sam Weinig  <sam@webkit.org>
 
         Remove WebGPUObject
index ba82dab..b87f9fd 100644 (file)
@@ -95,7 +95,11 @@ void WebGL2RenderingContext::initializeVertexArrayObjects()
 {
     m_defaultVertexArrayObject = WebGLVertexArrayObject::create(*this, WebGLVertexArrayObject::Type::Default);
     addContextObject(*m_defaultVertexArrayObject);
+#if USE(OPENGL_ES)
     m_boundVertexArrayObject = m_defaultVertexArrayObject;
+#else
+    bindVertexArray(nullptr); // The default VAO was removed in OpenGL 3.3 but not from WebGL 2; bind the default for WebGL to use.
+#endif
     if (!isGLES2Compliant())
         initVertexAttrib0();
 }
@@ -1063,7 +1067,11 @@ void WebGL2RenderingContext::deleteVertexArray(WebGLVertexArrayObject* arrayObje
         return;
     
     if (!arrayObject->isDefaultObject() && arrayObject == m_boundVertexArrayObject)
+#if USE(OPENGL_ES)
         setBoundVertexArrayObject(nullptr);
+#else
+        bindVertexArray(nullptr); // The default VAO was removed in OpenGL 3.3 but not from WebGL 2; bind the default for WebGL to use.
+#endif
     
     arrayObject->deleteObject(graphicsContext3D());
 }
index fe8375b..a63c2c5 100644 (file)
@@ -1768,6 +1768,8 @@ bool WebGLRenderingContextBase::deleteObject(WebGLObject* object)
         synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "delete", "object does not belong to this context");
         return false;
     }
+    if (object->isDeleted())
+        return false;
     if (object->object())
         // We need to pass in context here because we want
         // things in this context unbound.
index 89ae21f..1b46b7b 100644 (file)
@@ -46,13 +46,13 @@ WebGLVertexArrayObject::~WebGLVertexArrayObject()
 WebGLVertexArrayObject::WebGLVertexArrayObject(WebGLRenderingContextBase& context, Type type)
     : WebGLVertexArrayObjectBase(context, type)
 {
-    switch (m_type) {
-    case Type::Default:
-        break;
-    case Type::User:
-        setObject(this->context()->graphicsContext3D()->createVertexArray());
-        break;
-    }
+#if USE(OPENGL_ES)
+    if (m_type != Type::User)
+        return;
+#else
+    ASSERT(type != Type::Default || !(this->context()->m_defaultVertexArrayObject));
+#endif
+    setObject(this->context()->graphicsContext3D()->createVertexArray());
 }
 
 void WebGLVertexArrayObject::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject object)
index f41236e..cf363b6 100644 (file)
@@ -399,7 +399,9 @@ bool GraphicsContext3D::checkVaryingsPacking(Platform3DObject vertexShader, Plat
         variables.push_back(varyingSymbol);
 
     GC3Dint maxVaryingVectors = 0;
-#if !USE(OPENGL_ES)
+#if USE(OPENGL_ES)
+    ::glGetIntegerv(MAX_VARYING_VECTORS, &maxVaryingVectors);
+#else
     if (m_isForWebGL2)
         ::glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryingVectors);
     else {
@@ -407,8 +409,6 @@ bool GraphicsContext3D::checkVaryingsPacking(Platform3DObject vertexShader, Plat
         ::glGetIntegerv(GL_MAX_VARYING_FLOATS, &maxVaryingFloats);
         maxVaryingVectors = maxVaryingFloats / 4;
     }
-#else
-    ::glGetIntegerv(MAX_VARYING_VECTORS, &maxVaryingVectors);
 #endif
     return sh::CheckVariablesWithinPackingLimits(maxVaryingVectors, variables);
 }
@@ -1525,10 +1525,8 @@ Platform3DObject GraphicsContext3D::createVertexArray()
 {
     makeContextCurrent();
     GLuint array = 0;
-#if !USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))
-    glGenVertexArrays(1, &array);
-#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
-    glGenVertexArraysAPPLE(1, &array);
+#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
+    ::glGenVertexArrays(1, &array);
 #endif
     return array;
 }
@@ -1539,10 +1537,8 @@ void GraphicsContext3D::deleteVertexArray(Platform3DObject array)
         return;
     
     makeContextCurrent();
-#if !USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))
-    glDeleteVertexArrays(1, &array);
-#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
-    glDeleteVertexArraysAPPLE(1, &array);
+#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
+    ::glDeleteVertexArrays(1, &array);
 #endif
 }
 
@@ -1552,10 +1548,8 @@ GC3Dboolean GraphicsContext3D::isVertexArray(Platform3DObject array)
         return GL_FALSE;
     
     makeContextCurrent();
-#if !USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))
-    return glIsVertexArray(array);
-#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
-    return glIsVertexArrayAPPLE(array);
+#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
+    return ::glIsVertexArray(array);
 #endif
     return GL_FALSE;
 }
@@ -1563,12 +1557,8 @@ GC3Dboolean GraphicsContext3D::isVertexArray(Platform3DObject array)
 void GraphicsContext3D::bindVertexArray(Platform3DObject array)
 {
     makeContextCurrent();
-#if !USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))
-    glBindVertexArray(array);
-#elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
-    glBindVertexArrayAPPLE(array);
-#else
-    UNUSED_PARAM(array);
+#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
+    ::glBindVertexArray(array);
 #endif
 }