Title: [258875] trunk
Revision
258875
Author
[email protected]
Date
2020-03-23 14:28:16 -0700 (Mon, 23 Mar 2020)

Log Message

[WebGL] Skip vertexAttrib0 simulation when using ANGLE
https://bugs.webkit.org/show_bug.cgi?id=209416
<rdar://problem/60765734>

Reviewed by Antoine Quint.

Source/WebCore:

When using ANGLE as a backend, we do not need to simulate a
missing vertexAttrib0 at the WebGL layer, since ANGLE will
handle it for us.

This causes a couple of tests to begin passing (they were marked as
failures). It also allows us to re-land r258025, which was rolled
out in r258226.

* html/canvas/WebGL2RenderingContext.cpp: Wrap any code that does vertexAttrib0
simulation in a !USE(ANGLE).
(WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::initializeVertexArrayObjects):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
(WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
(WebCore::WebGLRenderingContextBase::validateDrawArrays):
(WebCore::WebGLRenderingContextBase::validateDrawElements):
(WebCore::WebGLRenderingContextBase::drawArrays):
(WebCore::WebGLRenderingContextBase::drawElements):
(WebCore::WebGLRenderingContextBase::getActiveUniform):
(WebCore::WebGLRenderingContextBase::getVertexAttrib):
(WebCore::WebGLRenderingContextBase::vertexAttribfImpl):
(WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
* html/canvas/WebGLRenderingContextBase.h:
* html/canvas/WebGLVertexArrayObjectBase.cpp:
(WebCore::WebGLVertexArrayObjectBase::unbindBuffer):

LayoutTests:

Remove the console logging that is no longer output when using ANGLE.
Remove failing expectations for some tests.

* fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt:
* fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (258874 => 258875)


--- trunk/LayoutTests/ChangeLog	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/LayoutTests/ChangeLog	2020-03-23 21:28:16 UTC (rev 258875)
@@ -1,3 +1,18 @@
+2020-03-23  Dean Jackson  <[email protected]>
+
+        [WebGL] Skip vertexAttrib0 simulation when using ANGLE
+        https://bugs.webkit.org/show_bug.cgi?id=209416
+        <rdar://problem/60765734>
+
+        Reviewed by Antoine Quint.
+
+        Remove the console logging that is no longer output when using ANGLE.
+        Remove failing expectations for some tests.
+
+        * fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt:
+        * fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt:
+        * platform/mac/TestExpectations:
+
 2020-03-23  Darin Adler  <[email protected]>
 
         Change TextIterator::rangeLength to not require a live range

Modified: trunk/LayoutTests/fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt (258874 => 258875)


--- trunk/LayoutTests/fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/LayoutTests/fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt	2020-03-23 21:28:16 UTC (rev 258875)
@@ -1,3 +1 @@
-CONSOLE MESSAGE: line 50: WebGL: INVALID_OPERATION: drawElements: unable to simulate vertexAttrib0 array
-CONSOLE MESSAGE: line 56: WebGL: INVALID_OPERATION: drawElements: unable to simulate vertexAttrib0 array
 

Modified: trunk/LayoutTests/fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt (258874 => 258875)


--- trunk/LayoutTests/fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/LayoutTests/fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt	2020-03-23 21:28:16 UTC (rev 258875)
@@ -1,2 +1 @@
-CONSOLE MESSAGE: line 30: WebGL: INVALID_OPERATION: drawArrays: attempt to access outside the bounds of the simulated vertexAttrib0 array
 

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (258874 => 258875)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2020-03-23 21:28:16 UTC (rev 258875)
@@ -118,6 +118,10 @@
 # Crashes
 webkit.org/b/189686 webgl/2.0.0/conformance2/buffers/one-large-uniform-buffer.html [ Skip ]
 
+# This test takes a long time to execute in the simulator, since it creates a huge (empty) buffer
+# to draw lots of nothing.
+webkit.org/b/209416 fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays.html [ Pass Timeout ]
+
 imported/w3c/web-platform-tests/css/css-lists/content-property/marker-text-matches-georgian.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-lists/content-property/marker-text-matches-lower-greek.html [ Pass ]
 imported/w3c/web-platform-tests/css/css-lists/list-and-writing-mode-001.html [ Failure ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (258874 => 258875)


--- trunk/LayoutTests/platform/mac/TestExpectations	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-03-23 21:28:16 UTC (rev 258875)
@@ -1978,9 +1978,6 @@
 webkit.org/b/207859 fast/images/slower-decoding-than-animation-image.html [ Pass Failure ]
 
 webkit.org/b/207858 fast/canvas/webgl/program-test.html [ Failure ]
-webkit.org/b/207858 fast/canvas/webgl/readPixels-float.html [ Failure ]
-webkit.org/b/207858 fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html [ Failure ]
-webkit.org/b/207858 fast/canvas/webgl/webgl2-texture-upload-enums.html [ Failure ]
 webkit.org/b/207858 webgl/1.0.3/conformance/programs/program-test.html [ Failure ]
 
 webkit.org/b/207971 css3/selectors3/xml/css3-modsel-d1.xml [ Pass Failure ]

Modified: trunk/Source/WebCore/ChangeLog (258874 => 258875)


--- trunk/Source/WebCore/ChangeLog	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/Source/WebCore/ChangeLog	2020-03-23 21:28:16 UTC (rev 258875)
@@ -1,3 +1,39 @@
+2020-03-23  Dean Jackson  <[email protected]>
+
+        [WebGL] Skip vertexAttrib0 simulation when using ANGLE
+        https://bugs.webkit.org/show_bug.cgi?id=209416
+        <rdar://problem/60765734>
+
+        Reviewed by Antoine Quint.
+
+        When using ANGLE as a backend, we do not need to simulate a
+        missing vertexAttrib0 at the WebGL layer, since ANGLE will
+        handle it for us.
+
+        This causes a couple of tests to begin passing (they were marked as
+        failures). It also allows us to re-land r258025, which was rolled
+        out in r258226.
+
+        * html/canvas/WebGL2RenderingContext.cpp: Wrap any code that does vertexAttrib0
+        simulation in a !USE(ANGLE).
+        (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::initializeVertexArrayObjects):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
+        (WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
+        (WebCore::WebGLRenderingContextBase::validateDrawArrays):
+        (WebCore::WebGLRenderingContextBase::validateDrawElements):
+        (WebCore::WebGLRenderingContextBase::drawArrays):
+        (WebCore::WebGLRenderingContextBase::drawElements):
+        (WebCore::WebGLRenderingContextBase::getActiveUniform):
+        (WebCore::WebGLRenderingContextBase::getVertexAttrib):
+        (WebCore::WebGLRenderingContextBase::vertexAttribfImpl):
+        (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * html/canvas/WebGLVertexArrayObjectBase.cpp:
+        (WebCore::WebGLVertexArrayObjectBase::unbindBuffer):
+
 2020-03-23  Darin Adler  <[email protected]>
 
         Change TextIterator::rangeLength to not require a live range

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (258874 => 258875)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-03-23 21:28:16 UTC (rev 258875)
@@ -120,8 +120,10 @@
 #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 !USE(ANGLE)
     if (!isGLES2Compliant())
         initVertexAttrib0();
+#endif
 }
 
 void WebGL2RenderingContext::initializeShaderExtensions()

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (258874 => 258875)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-03-23 21:28:16 UTC (rev 258875)
@@ -107,8 +107,10 @@
     m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(*this, WebGLVertexArrayObjectOES::Type::Default);
     addContextObject(*m_defaultVertexArrayObject);
     m_boundVertexArrayObject = m_defaultVertexArrayObject;
+#if !USE(ANGLE)
     if (!isGLES2Compliant())
         initVertexAttrib0();
+#endif
 }
 
 WebGLExtension* WebGLRenderingContext::getExtension(const String& name)

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (258874 => 258875)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-03-23 21:28:16 UTC (rev 258875)
@@ -858,7 +858,9 @@
     m_boundArrayBuffer = nullptr;
     m_defaultVertexArrayObject = nullptr;
     m_boundVertexArrayObject = nullptr;
+#if !USE(ANGLE)
     m_vertexAttrib0Buffer = nullptr;
+#endif
     m_currentProgram = nullptr;
     m_framebufferBinding = nullptr;
     m_readFramebufferBinding = nullptr;
@@ -1962,7 +1964,9 @@
     WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index);
     state.enabled = false;
 
+#if !USE(ANGLE)
     if (index > 0 || isGLES2Compliant())
+#endif
         m_context->disableVertexAttribArray(index);
 }
 
@@ -2176,10 +2180,12 @@
         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
         return false;
     }
+#if !USE(ANGLE)
     if (!validateSimulatedVertexAttrib0(checkedSum.unsafeGet() - 1)) {
         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
         return false;
     }
+#endif
 
     const char* reason = "framebuffer incomplete";
     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContextGL(), &reason)) {
@@ -2254,10 +2260,12 @@
         }
     }
 
+#if !USE(ANGLE)
     if (!validateSimulatedVertexAttrib0(numElements)) {
         synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
         return false;
     }
+#endif
     
     const char* reason = "framebuffer incomplete";
     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContextGL(), &reason)) {
@@ -2278,6 +2286,7 @@
 
     clearIfComposited();
 
+#if !USE(ANGLE)
     bool vertexAttrib0Simulated = false;
     if (!isGLES2Compliant()) {
         auto simulateVertexAttrib0Status = simulateVertexAttrib0(first + count - 1);
@@ -2288,6 +2297,7 @@
         }
         vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
     }
+#endif
     bool usesFallbackTexture = false;
     if (!isGLES2NPOTStrict())
         usesFallbackTexture = checkTextureCompleteness("drawArrays", true);
@@ -2298,8 +2308,10 @@
         m_context->drawArrays(mode, first, count);
     }
 
+#if !USE(ANGLE)
     if (!isGLES2Compliant() && vertexAttrib0Simulated)
         restoreStatesAfterVertexAttrib0Simulation();
+#endif
     if (usesFallbackTexture)
         checkTextureCompleteness("drawArrays", false);
     markContextChangedAndNotifyCanvasObserver();
@@ -2336,6 +2348,7 @@
     if (!isGLES2Compliant()) {
         if (!numElements)
             validateIndexArrayPrecise(count, type, static_cast<GCGLintptr>(offset), numElements);
+#if !USE(ANGLE)
         auto simulateVertexAttrib0Status = simulateVertexAttrib0(numElements);
         if (!simulateVertexAttrib0Status) {
             // We were unable to simulate the attribute buffer.
@@ -2343,6 +2356,7 @@
             return;
         }
         vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
+#endif
     }
 
     bool usesFallbackTexture = false;
@@ -2360,8 +2374,12 @@
         m_context->drawElements(mode, count, type, static_cast<GCGLintptr>(offset));
     }
 
+#if !USE(ANGLE)
     if (!isGLES2Compliant() && vertexAttrib0Simulated)
         restoreStatesAfterVertexAttrib0Simulation();
+#else
+    UNUSED_VARIABLE(vertexAttrib0Simulated);
+#endif
     if (usesFallbackTexture)
         checkTextureCompleteness("drawElements", false);
     markContextChangedAndNotifyCanvasObserver();
@@ -2547,6 +2565,7 @@
     GraphicsContextGL::ActiveInfo info;
     if (!m_context->getActiveUniform(objectOrZero(program), index, info))
         return nullptr;
+    // FIXME: Do we still need this for the ANGLE backend?
     if (!isGLES2Compliant())
         if (info.size > 1 && !info.name.endsWith("[0]"))
             info.name.append("[0]");
@@ -3049,10 +3068,12 @@
 
     switch (pname) {
     case GraphicsContextGL::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+#if !USE(ANGLE)
         if ((!isGLES2Compliant() && !index && m_boundVertexArrayObject->getVertexAttribState(0).bufferBinding == m_vertexAttrib0Buffer)
             || !state.bufferBinding
             || !state.bufferBinding->object())
             return nullptr;
+#endif
         return state.bufferBinding;
     case GraphicsContextGL::VERTEX_ATTRIB_ARRAY_ENABLED:
         return state.enabled;
@@ -6109,8 +6130,11 @@
         synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "index out of range");
         return;
     }
+#if !USE(ANGLE)
     // In GL, we skip setting vertexAttrib0 values.
-    if (index || isGLES2Compliant()) {
+    if (index || isGLES2Compliant())
+#endif
+    {
         switch (expectedSize) {
         case 1:
             m_context->vertexAttrib1f(index, v0);
@@ -6153,8 +6177,11 @@
         synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "index out of range");
         return;
     }
+#if !USE(ANGLE)
     // In GL, we skip setting vertexAttrib0 values.
-    if (index || isGLES2Compliant()) {
+    if (index || isGLES2Compliant())
+#endif
+    {
         switch (expectedSize) {
         case 1:
             m_context->vertexAttrib1fv(index, data);
@@ -6176,6 +6203,7 @@
         attribValue.value[ii] = data[ii];
 }
 
+#if !USE(ANGLE)
 void WebGLRenderingContextBase::initVertexAttrib0()
 {
     WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0);
@@ -6288,6 +6316,7 @@
     }
     m_context->bindBuffer(GraphicsContextGL::ARRAY_BUFFER, objectOrZero(m_boundArrayBuffer.get()));
 }
+#endif
 
 void WebGLRenderingContextBase::dispatchContextLostEvent()
 {
@@ -6558,6 +6587,7 @@
 
     clearIfComposited();
 
+#if !USE(ANGLE)
     bool vertexAttrib0Simulated = false;
     if (!isGLES2Compliant()) {
         auto simulateVertexAttrib0Status = simulateVertexAttrib0(first + count - 1);
@@ -6568,13 +6598,16 @@
         }
         vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
     }
+#endif
     if (!isGLES2NPOTStrict())
         checkTextureCompleteness("drawArraysInstanced", true);
 
     m_context->drawArraysInstanced(mode, first, count, primcount);
 
+#if !USE(ANGLE)
     if (!isGLES2Compliant() && vertexAttrib0Simulated)
         restoreStatesAfterVertexAttrib0Simulation();
+#endif
     if (!isGLES2NPOTStrict())
         checkTextureCompleteness("drawArraysInstanced", false);
     markContextChangedAndNotifyCanvasObserver();
@@ -6597,6 +6630,7 @@
     if (!isGLES2Compliant()) {
         if (!numElements)
             validateIndexArrayPrecise(count, type, static_cast<GCGLintptr>(offset), numElements);
+#if !USE(ANGLE)
         auto simulateVertexAttrib0Status = simulateVertexAttrib0(numElements);
         if (!simulateVertexAttrib0Status) {
             // We were unable to simulate the attribute buffer.
@@ -6604,6 +6638,7 @@
             return;
         }
         vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
+#endif
     }
     if (!isGLES2NPOTStrict())
         checkTextureCompleteness("drawElementsInstanced", true);
@@ -6615,8 +6650,12 @@
 
     m_context->drawElementsInstanced(mode, count, type, static_cast<GCGLintptr>(offset), primcount);
 
+#if !USE(ANGLE)
     if (!isGLES2Compliant() && vertexAttrib0Simulated)
         restoreStatesAfterVertexAttrib0Simulation();
+#else
+    UNUSED_VARIABLE(vertexAttrib0Simulated);
+#endif
     if (!isGLES2NPOTStrict())
         checkTextureCompleteness("drawElementsInstanced", false);
     markContextChangedAndNotifyCanvasObserver();

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (258874 => 258875)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-03-23 21:28:16 UTC (rev 258875)
@@ -512,11 +512,13 @@
     };
     Vector<VertexAttribValue> m_vertexAttribValue;
     unsigned m_maxVertexAttribs;
+#if !USE(ANGLE)
     RefPtr<WebGLBuffer> m_vertexAttrib0Buffer;
     long m_vertexAttrib0BufferSize { 0 };
     GCGLfloat m_vertexAttrib0BufferValue[4];
     bool m_forceAttrib0BufferRefill { true };
     bool m_vertexAttrib0UsedBefore { false };
+#endif
 
     RefPtr<WebGLProgram> m_currentProgram;
     RefPtr<WebGLFramebuffer> m_framebufferBinding;
@@ -820,11 +822,13 @@
 
     bool validateAndCacheBufferBinding(const char* functionName, GCGLenum target, WebGLBuffer*);
 
+#if !USE(ANGLE)
     // Helpers for simulating vertexAttrib0.
     void initVertexAttrib0();
     Optional<bool> simulateVertexAttrib0(GCGLuint numVertex);
     bool validateSimulatedVertexAttrib0(GCGLuint numVertex);
     void restoreStatesAfterVertexAttrib0Simulation();
+#endif
 
     // Wrapper for GraphicsContextGLOpenGL::synthesizeGLError that sends a message to the _javascript_ console.
     enum ConsoleDisplayPreference { DisplayInConsole, DontDisplayInConsole };

Modified: trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp (258874 => 258875)


--- trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp	2020-03-23 21:09:21 UTC (rev 258874)
+++ trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp	2020-03-23 21:28:16 UTC (rev 258875)
@@ -82,6 +82,7 @@
         if (state.bufferBinding == &buffer) {
             buffer.onDetached(context()->graphicsContextGL());
             
+#if !USE(ANGLE)
             if (!i && !context()->isGLES2Compliant()) {
                 state.bufferBinding = context()->m_vertexAttrib0Buffer;
                 state.bufferBinding->onAttached();
@@ -93,6 +94,7 @@
                 state.originalStride = 0;
                 state.offset = 0;
             } else
+#endif
                 state.bufferBinding = nullptr;
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to