Changeset 282192 in webkit
- Timestamp:
- Sep 8, 2021, 10:27:51 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/fast/canvas/webgl/drawElements-empty-vertex-data-expected.txt (modified) (1 diff)
-
LayoutTests/fast/canvas/webgl/vertexAttribPointer-with-bad-offset-expected.txt (modified) (1 diff)
-
LayoutTests/fast/canvas/webgl/webgl-drawarrays-crash-2-expected.txt (modified) (1 diff)
-
LayoutTests/platform/ios/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (modified) (3 diffs)
-
Source/WebCore/html/canvas/WebGLRenderingContext.cpp (modified) (1 diff)
-
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (modified) (9 diffs)
-
Source/WebCore/html/canvas/WebGLRenderingContextBase.h (modified) (1 diff)
-
Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp (modified) (4 diffs)
-
Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r282188 r282192 1 2021-09-08 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 webgl/2.0.y/conformance2/vertex_arrays/vertex-array-object.html fails 4 https://bugs.webkit.org/show_bug.cgi?id=223360 5 <rdar://problem/75774546> 6 7 Reviewed by Dean Jackson. 8 9 Test webgl/2.0.y/conformance2/vertex_arrays/vertex-array-object.html explicitly 10 until 2.0.y suite is run by default. Same for 1.0.x. 11 12 * TestExpectations: 13 * fast/canvas/webgl/drawElements-empty-vertex-data-expected.txt: 14 * fast/canvas/webgl/vertexAttribPointer-with-bad-offset-expected.txt: 15 Add console logs for the added errors. 16 * platform/ios/TestExpectations: 17 * platform/mac/TestExpectations: 18 For consistency, remove all skips for vertex-array-object tests. 19 They should now work. 20 1 21 2021-09-08 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 22 -
trunk/LayoutTests/TestExpectations
r282170 r282192 3692 3692 webgl/2.0.y/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ] 3693 3693 webgl/2.0.y/conformance2/context/constants-and-properties-2.html [ Pass ] 3694 webgl/2.0.y/conformance2/vertex_arrays/vertex-array-object.html [ Pass ] 3695 webgl/1.0.x/conformance/extensions/oes-vertex-array-object.html [ Pass ] 3694 3696 3695 3697 # WebGL 1.0.3 and 2.0.0 tests where behavior is obsolete and WebKit contains implementation -
trunk/LayoutTests/fast/canvas/webgl/drawElements-empty-vertex-data-expected.txt
r256784 r282192 1 CONSOLE MESSAGE: WebGL: INVALID_OPERATION: drawElements: no buffer is bound to enabled attribute 1 2 PASS: Unable to draw with invalid vertexAttribArray0 -
trunk/LayoutTests/fast/canvas/webgl/vertexAttribPointer-with-bad-offset-expected.txt
r259900 r282192 1 1 CONSOLE MESSAGE: WebGL: INVALID_VALUE: vertexAttribPointer: bad offset 2 CONSOLE MESSAGE: WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute 2 3 PASS: vertexAttribPointer should have an error. 3 4 -
trunk/LayoutTests/fast/canvas/webgl/webgl-drawarrays-crash-2-expected.txt
r256784 r282192 1 CONSOLE MESSAGE: WebGL: INVALID_OPERATION: drawArrays: no buffer is bound to enabled attribute 1 2 PASS. You didn't crash. 2 3 -
trunk/LayoutTests/platform/ios/TestExpectations
r282092 r282192 3202 3202 webkit.org/b/207858 fast/canvas/webgl/uninitialized-test.html [ Pass Failure ] 3203 3203 webkit.org/b/207858 fast/canvas/webgl/oes-texture-float-linear.html [ Pass Failure ] 3204 webkit.org/b/207858 fast/canvas/webgl/oes-vertex-array-object.html [ Pass Failure ]3205 3204 webkit.org/b/207858 fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html [ Pass Failure ] 3206 3205 webkit.org/b/207858 webgl/1.0.3/conformance/context/context-lost-restored.html [ Pass Failure ] -
trunk/LayoutTests/platform/mac/TestExpectations
r282171 r282192 406 406 # Sending the mouse down event to the scrollbar starts a nested run loop which causes a hang. 407 407 fast/events/mousedown-in-subframe-scrollbar.html [ Skip ] 408 409 webkit.org/b/96828 fast/canvas/webgl/oes-vertex-array-object.html [ Skip ]410 webkit.org/b/96828 webgl/1.0.3/conformance/extensions/oes-vertex-array-object.html [ Skip ]411 408 412 409 http/tests/misc/willCacheResponse-delegate-callback.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r282191 r282192 1 2021-09-08 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 webgl/2.0.y/conformance2/vertex_arrays/vertex-array-object.html fails 4 https://bugs.webkit.org/show_bug.cgi?id=223360 5 <rdar://problem/75774546> 6 7 Reviewed by Dean Jackson. 8 9 Deleting a buffer will remove the buffer from currently active 10 vertex array buffer bindings. This worked. 11 Drawing with a vertex array object that has enabled indexes 12 but missing buffers for those indexes should fail. This 13 WebGL specific constraint is checked by ANGLE. However, WebCore 14 relies on buffer deletion to update the ANGLE VAO. The deletion 15 does not happen due to the buffers in the test being bound to 16 multiple VAOs. 17 Add this check also to WebCore. 18 19 Fixed tests: 20 webgl/1.0.x/conformance/extensions/oes-vertex-array-object.html 21 webgl/2.0.y/conformance2/vertex_arrays/vertex-array-object.html 22 23 * html/canvas/WebGL2RenderingContext.cpp: 24 (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects): 25 (WebCore::WebGL2RenderingContext::drawRangeElements): 26 * html/canvas/WebGLRenderingContext.cpp: 27 (WebCore::WebGLRenderingContext::initializeVertexArrayObjects): 28 * html/canvas/WebGLRenderingContextBase.cpp: 29 (WebCore::WebGLRenderingContextBase::disableVertexAttribArray): 30 (WebCore::WebGLRenderingContextBase::validateVertexArrayObject): 31 (WebCore::WebGLRenderingContextBase::drawArrays): 32 (WebCore::WebGLRenderingContextBase::drawElements): 33 (WebCore::WebGLRenderingContextBase::enableVertexAttribArray): 34 (WebCore::WebGLRenderingContextBase::vertexAttribPointer): 35 (WebCore::WebGLRenderingContextBase::initVertexAttrib0): 36 (WebCore::WebGLRenderingContextBase::drawArraysInstanced): 37 (WebCore::WebGLRenderingContextBase::drawElementsInstanced): 38 * html/canvas/WebGLRenderingContextBase.h: 39 * html/canvas/WebGLVertexArrayObjectBase.cpp: 40 (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase): 41 (WebCore::WebGLVertexArrayObjectBase::setVertexAttribEnabled): 42 (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState): 43 (WebCore::WebGLVertexArrayObjectBase::unbindBuffer): 44 (WebCore::WebGLVertexArrayObjectBase::updateVertexAttrib0): 45 (WebCore::WebGLVertexArrayObjectBase::areAllEnabledAttribBuffersBound): 46 * html/canvas/WebGLVertexArrayObjectBase.h: 47 (WebCore::WebGLVertexArrayObjectBase::getVertexAttribState): 48 Make VertexAttribState& a const so that we can maintain confidence 49 that the cached value of "all enabled attrib buffers are bound" 50 is maintained, e.g. that the callers cannot modify enabled or bound 51 buffer status. 52 1 53 2021-09-08 Ryosuke Niwa <rniwa@webkit.org> 2 54 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r282160 r282192 224 224 void WebGL2RenderingContext::initializeVertexArrayObjects() 225 225 { 226 #if !USE(ANGLE) 227 if (!isGLES2Compliant()) 228 initVertexAttrib0(); 229 #endif 226 230 m_defaultVertexArrayObject = WebGLVertexArrayObject::create(*this, WebGLVertexArrayObject::Type::Default); 227 231 addContextObject(*m_defaultVertexArrayObject); … … 231 235 bindVertexArray(nullptr); // The default VAO was removed in OpenGL 3.3 but not from WebGL 2; bind the default for WebGL to use. 232 236 #endif 233 #if !USE(ANGLE) 234 if (!isGLES2Compliant()) 235 initVertexAttrib0(); 236 #endif 237 237 238 } 238 239 … … 1798 1799 if (isContextLostOrPending()) 1799 1800 return; 1800 1801 if (!validateVertexArrayObject("drawRangeElements")) 1802 return; 1801 1803 m_context->drawRangeElements(mode, start, end, count, type, offset); 1802 1804 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r278253 r282192 125 125 void WebGLRenderingContext::initializeVertexArrayObjects() 126 126 { 127 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(*this, WebGLVertexArrayObjectOES::Type::Default);128 addContextObject(*m_defaultVertexArrayObject);129 m_boundVertexArrayObject = m_defaultVertexArrayObject;130 127 #if !USE(ANGLE) 131 128 if (!isGLES2Compliant()) 132 129 initVertexAttrib0(); 133 130 #endif 131 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(*this, WebGLVertexArrayObjectOES::Type::Default); 132 addContextObject(*m_defaultVertexArrayObject); 133 m_boundVertexArrayObject = m_defaultVertexArrayObject; 134 134 } 135 135 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r282160 r282192 2338 2338 return; 2339 2339 } 2340 2341 WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 2342 state.enabled = false; 2343 2340 m_boundVertexArrayObject->setVertexAttribEnabled(index, false); 2344 2341 #if !USE(ANGLE) 2345 2342 if (index > 0 || isGLES2Compliant()) … … 2359 2356 } 2360 2357 #endif 2358 2359 bool WebGLRenderingContextBase::validateVertexArrayObject(const char* functionName) 2360 { 2361 if (!m_boundVertexArrayObject->areAllEnabledAttribBuffersBound()) { 2362 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "no buffer is bound to enabled attribute"); 2363 return false; 2364 } 2365 return true; 2366 } 2361 2367 2362 2368 bool WebGLRenderingContextBase::validateElementArraySize(GCGLsizei count, GCGLenum type, GCGLintptr offset) … … 2701 2707 return; 2702 2708 #endif 2709 if (!validateVertexArrayObject("drawArrays")) 2710 return; 2703 2711 2704 2712 if (m_currentProgram && InspectorInstrumentation::isWebGLProgramDisabled(*this, *m_currentProgram)) … … 2764 2772 return; 2765 2773 #endif 2774 if (!validateVertexArrayObject("drawElements")) 2775 return; 2766 2776 2767 2777 if (m_currentProgram && InspectorInstrumentation::isWebGLProgramDisabled(*this, *m_currentProgram)) … … 2832 2842 return; 2833 2843 } 2834 2835 WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 2836 state.enabled = true; 2837 2844 m_boundVertexArrayObject->setVertexAttribEnabled(index, true); 2838 2845 m_context->enableVertexAttribArray(index); 2839 2846 } … … 6335 6342 } 6336 6343 GCGLsizei bytesPerElement = size * typeSize; 6337 6338 6344 m_boundVertexArrayObject->setVertexAttribState(locker, index, bytesPerElement, size, type, normalized, stride, static_cast<GCGLintptr>(offset), false, m_boundArrayBuffer.get()); 6339 6345 m_context->vertexAttribPointer(index, size, type, normalized, stride, static_cast<GCGLintptr>(offset)); … … 7538 7544 void WebGLRenderingContextBase::initVertexAttrib0() 7539 7545 { 7540 WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0);7541 7542 7546 m_vertexAttrib0Buffer = createBuffer(); 7543 7547 m_context->bindBuffer(GraphicsContextGL::ARRAY_BUFFER, m_vertexAttrib0Buffer->object()); 7544 7548 m_context->bufferData(GraphicsContextGL::ARRAY_BUFFER, 0, GraphicsContextGL::DYNAMIC_DRAW); 7545 7549 m_context->vertexAttribPointer(0, 4, GraphicsContextGL::FLOAT, false, 0, 0); 7546 state.bufferBinding = m_vertexAttrib0Buffer;7547 7550 m_context->bindBuffer(GraphicsContextGL::ARRAY_BUFFER, 0); 7548 7551 m_context->enableVertexAttribArray(0); … … 7937 7940 return; 7938 7941 #endif // !USE(ANGLE) 7942 if (!validateVertexArrayObject("drawArraysInstanced")) 7943 return; 7939 7944 7940 7945 clearIfComposited(ClearCallerDrawOrClear); … … 7976 7981 return; 7977 7982 #endif // !USE(ANGLE) 7983 if (!validateVertexArrayObject("drawElementsInstanced")) 7984 return; 7978 7985 7979 7986 clearIfComposited(ClearCallerDrawOrClear); -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r282160 r282192 513 513 bool validateNPOTTextureLevel(GCGLsizei width, GCGLsizei height, GCGLint level, const char* functionName); 514 514 #endif 515 bool validateVertexArrayObject(const char* functionName); 515 516 516 517 // Adds a compressed texture format. -
trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp
r273138 r282192 40 40 { 41 41 m_vertexAttribState.resize(context.getMaxVertexAttribs()); 42 #if !USE(ANGLE) 43 updateVertexAttrib0(); 44 #endif 42 45 } 43 46 … … 51 54 52 55 } 56 void WebGLVertexArrayObjectBase::setVertexAttribEnabled(int index, bool flag) 57 { 58 auto& state = m_vertexAttribState[index]; 59 if (state.enabled == flag) 60 return; 61 state.enabled = flag; 62 if (!state.validateBinding()) 63 m_allEnabledAttribBuffersBoundCache = false; 64 else 65 m_allEnabledAttribBuffersBoundCache.reset(); 66 } 53 67 54 68 void WebGLVertexArrayObjectBase::setVertexAttribState(const AbstractLocker& locker, GCGLuint index, GCGLsizei bytesPerElement, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset, bool isInteger, WebGLBuffer* buffer) 55 69 { 56 GCGLsizei validatedStride = stride ? stride : bytesPerElement;57 58 70 auto& state = m_vertexAttribState[index]; 59 71 bool bindingWasValid = state.validateBinding(); 60 72 if (buffer) 61 73 buffer->onAttached(); 62 74 if (state.bufferBinding) 63 75 state.bufferBinding->onDetached(locker, context()->graphicsContextGL()); 64 65 76 state.bufferBinding = buffer; 77 if (!state.validateBinding()) 78 m_allEnabledAttribBuffersBoundCache = false; 79 else if (!bindingWasValid) 80 m_allEnabledAttribBuffersBoundCache.reset(); 66 81 state.bytesPerElement = bytesPerElement; 67 82 state.size = size; 68 83 state.type = type; 69 84 state.normalized = normalized; 70 state.stride = validatedStride;85 state.stride = stride ? stride : bytesPerElement; 71 86 state.originalStride = stride; 72 87 state.offset = offset; … … 81 96 } 82 97 83 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { 84 auto& state = m_vertexAttribState[i]; 98 for (auto& state : m_vertexAttribState) { 85 99 if (state.bufferBinding == &buffer) { 86 100 buffer.onDetached(locker, context()->graphicsContextGL()); 87 88 #if !USE(ANGLE) 89 if (!i && !context()->isGLES2Compliant()) { 90 state.bufferBinding = context()->m_vertexAttrib0Buffer; 91 state.bufferBinding->onAttached(); 92 state.bytesPerElement = 0; 93 state.size = 4; 94 state.type = GraphicsContextGL::FLOAT; 95 state.normalized = false; 96 state.stride = 16; 97 state.originalStride = 0; 98 state.offset = 0; 99 } else 100 #endif 101 state.bufferBinding = nullptr; 101 state.bufferBinding = nullptr; 102 if (!state.validateBinding()) 103 m_allEnabledAttribBuffersBoundCache = false; 102 104 } 103 105 } 106 #if !USE(ANGLE) 107 updateVertexAttrib0(); 108 #endif 104 109 } 110 111 #if !USE(ANGLE) 112 void WebGLVertexArrayObjectBase::updateVertexAttrib0() 113 { 114 auto& state = m_vertexAttribState[0]; 115 if (!state.bufferBinding && !context()->isGLES2Compliant()) { 116 state.bufferBinding = context()->m_vertexAttrib0Buffer; 117 state.bufferBinding->onAttached(); 118 state.bytesPerElement = 0; 119 state.size = 4; 120 state.type = GraphicsContextGL::FLOAT; 121 state.normalized = false; 122 state.stride = 16; 123 state.originalStride = 0; 124 state.offset = 0; 125 m_allEnabledAttribBuffersBoundCache.reset(); 126 } 127 } 128 #endif 105 129 106 130 void WebGLVertexArrayObjectBase::setVertexAttribDivisor(GCGLuint index, GCGLuint divisor) … … 116 140 } 117 141 142 bool WebGLVertexArrayObjectBase::areAllEnabledAttribBuffersBound() 143 { 144 if (!m_allEnabledAttribBuffersBoundCache) { 145 m_allEnabledAttribBuffersBoundCache = [&] { 146 for (auto const& state : m_vertexAttribState) { 147 if (!state.validateBinding()) 148 return false; 149 } 150 return true; 151 }(); 152 } 153 return *m_allEnabledAttribBuffersBoundCache; 154 } 155 118 156 } 119 157 -
trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h
r273138 r282192 31 31 #include "WebGLBuffer.h" 32 32 #include "WebGLContextObject.h" 33 #include <optional> 33 34 34 35 namespace JSC { … … 72 73 void setElementArrayBuffer(const WTF::AbstractLocker&, WebGLBuffer*); 73 74 74 VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribState[index]; } 75 void setVertexAttribEnabled(int index, bool flag); 76 const VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribState[index]; } 75 77 void setVertexAttribState(const WTF::AbstractLocker&, GCGLuint, GCGLsizei, GCGLint, GCGLenum, GCGLboolean, GCGLsizei, GCGLintptr, bool, WebGLBuffer*); 76 78 void unbindBuffer(const WTF::AbstractLocker&, WebGLBuffer&); … … 80 82 void addMembersToOpaqueRoots(const WTF::AbstractLocker&, JSC::AbstractSlotVisitor&); 81 83 84 bool areAllEnabledAttribBuffersBound(); 82 85 protected: 83 86 WebGLVertexArrayObjectBase(WebGLRenderingContextBase&, Type); 84 87 void deleteObjectImpl(const WTF::AbstractLocker&, GraphicsContextGL*, PlatformGLObject) override = 0; 88 #if !USE(ANGLE) 89 void updateVertexAttrib0(); 90 #endif 85 91 86 92 Type m_type; … … 88 94 RefPtr<WebGLBuffer> m_boundElementArrayBuffer; 89 95 Vector<VertexAttribState> m_vertexAttribState; 96 std::optional<bool> m_allEnabledAttribBuffersBoundCache; 90 97 }; 91 98
Note:
See TracChangeset
for help on using the changeset viewer.