Changeset 264691 in webkit
- Timestamp:
- Jul 21, 2020 9:07:58 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r264690 r264691 1 2020-07-21 Kenneth Russell <kbr@chromium.org> 2 3 [WebGL2] Implement multiple render target entry points 4 https://bugs.webkit.org/show_bug.cgi?id=211156 5 6 Reviewed by Myles C. Maxfield. 7 8 Rebaseline one layout test which is now fully passing, and another 9 which now properly detects errors. 10 11 * fast/canvas/webgl/webgl2/sequences-expected.txt: 12 * webgl/2.0.0/conformance2/reading/read-pixels-from-fbo-test-expected.txt: 13 1 14 2020-07-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 15 -
trunk/LayoutTests/fast/canvas/webgl/webgl2/sequences-expected.txt
r264381 r264691 3 3 CONSOLE MESSAGE: WebGL: INVALID_VALUE: vertexAttribI4uiv: array too small 4 4 CONSOLE MESSAGE: WebGL: INVALID_VALUE: vertexAttribI4uiv: array too small 5 CONSOLE MESSAGE: WebGL: INVALID_VALUE: clearBufferiv: invalid array size / srcOffset 6 CONSOLE MESSAGE: WebGL: INVALID_VALUE: clearBufferiv: invalid array size / srcOffset 7 CONSOLE MESSAGE: WebGL: INVALID_VALUE: clearBufferuiv: invalid array size / srcOffset 8 CONSOLE MESSAGE: WebGL: INVALID_VALUE: clearBufferuiv: invalid array size / srcOffset 9 CONSOLE MESSAGE: WebGL: INVALID_VALUE: clearBufferfv: invalid array size / srcOffset 10 CONSOLE MESSAGE: WebGL: INVALID_VALUE: clearBufferfv: invalid array size / srcOffset 5 11 6 12 PASS uniform1uiv data with typed array of type ui -
trunk/LayoutTests/webgl/2.0.0/conformance2/reading/read-pixels-from-fbo-test-expected.txt
r259139 r264691 2 2 3 3 Test: ../../resources/webgl_test_files/conformance2/reading/read-pixels-from-fbo-test.html 4 [ 1: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 5 [ 2: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 6 [ 3: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 7 [ 4: PASS ] Color read back as expected 8 [ 5: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 9 [ 6: PASS ] Color read back as expected 10 [ 7: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 11 [ 8: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 12 [ 9: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 13 [ 10: FAIL ] Expected color = 250,0,0,0, was = 0,0,0,1 14 [ 11: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 15 [ 12: FAIL ] Expected color = 250,0,0,0, was = 0 16 [ 13: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 17 [ 14: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 18 [ 15: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 19 [ 16: FAIL ] Expected color = -126,0,0,0, was = 0,0,0,1 20 [ 17: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 21 [ 18: FAIL ] Expected color = -126,0,0,0, was = 0 22 [ 19: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 23 [ 20: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 24 [ 21: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 25 [ 22: FAIL ] Expected color = 30001,0,0,0, was = 0,0,0,1 26 [ 23: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 27 [ 24: FAIL ] Expected color = 30001,0,0,0, was = 0 28 [ 25: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 29 [ 26: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 30 [ 27: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 31 [ 28: FAIL ] Expected color = -14189,0,0,0, was = 0,0,0,1 32 [ 29: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 33 [ 30: FAIL ] Expected color = -14189,0,0,0, was = 0 34 [ 31: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 35 [ 32: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 36 [ 33: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 37 [ 34: FAIL ] Expected color = 126726,0,0,0, was = 0,0,0,1 38 [ 35: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 39 [ 36: FAIL ] Expected color = 126726,0,0,0, was = 0 40 [ 37: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 41 [ 38: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 42 [ 39: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 43 [ 40: FAIL ] Expected color = -126726,0,0,0, was = 0,0,0,1 44 [ 41: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 45 [ 42: FAIL ] Expected color = -126726,0,0,0, was = 0 46 [ 43: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 47 [ 44: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 48 [ 45: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 49 [ 46: PASS ] Color read back as expected 50 [ 47: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 51 [ 48: PASS ] Color read back as expected 52 [ 49: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 53 [ 50: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 54 [ 51: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 55 [ 52: PASS ] Color read back as expected 56 [ 53: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 57 [ 54: PASS ] Color read back as expected 58 [ 55: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 59 [ 56: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 60 [ 57: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 61 [ 58: PASS ] Color read back as expected 62 [ 59: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 63 [ 60: PASS ] Color read back as expected 64 [ 61: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 65 [ 62: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 66 [ 63: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 67 [ 64: PASS ] Color read back as expected 68 [ 65: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 69 [ 66: PASS ] Color read back as expected 70 [ 67: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 71 [ 68: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 72 [ 69: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 73 [ 70: PASS ] Color read back as expected 74 [ 71: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 75 [ 72: PASS ] Color read back as expected 76 [ 73: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 77 [ 74: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 78 [ 75: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 79 [ 76: PASS ] Color read back as expected 80 [ 77: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 81 [ 78: PASS ] Color read back as expected 82 [ 79: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 83 [ 80: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 84 [ 81: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 85 [ 82: PASS ] Color read back as expected 86 [ 83: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 87 [ 84: PASS ] Color read back as expected 88 [ 85: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 89 [ 86: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 90 [ 87: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 91 [ 88: PASS ] Color read back as expected 92 [ 89: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 93 [ 90: PASS ] Color read back as expected 94 [ 91: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 95 [ 92: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 96 [ 93: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 97 [ 94: PASS ] Color read back as expected 98 [ 95: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 99 [ 96: PASS ] Color read back as expected 100 [ 97: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 101 [ 98: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 102 [ 99: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 103 [ 100: PASS ] Color read back as expected 104 [ 101: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 105 [ 102: PASS ] Color read back as expected 106 [ 103: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 107 [ 104: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 108 [ 105: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 109 [ 106: PASS ] Color read back as expected 110 [ 107: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 111 [ 108: PASS ] Color read back as expected 112 [ 109: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 113 [ 110: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 114 [ 111: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 115 [ 112: PASS ] Color read back as expected 116 [ 113: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 117 [ 114: PASS ] Color read back as expected 118 [ 115: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 119 [ 116: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 120 [ 117: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 121 [ 118: PASS ] Color read back as expected 122 [ 119: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 123 [ 120: PASS ] Color read back as expected 124 [ 121: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 125 [ 122: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 126 [ 123: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 127 [ 124: PASS ] Color read back as expected 128 [ 125: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 129 [ 126: PASS ] Color read back as expected 130 [ 127: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 131 [ 128: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 132 [ 129: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 133 [ 130: PASS ] Color read back as expected 134 [ 131: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 135 [ 132: PASS ] Color read back as expected 136 [ 133: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 137 [ 134: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 138 [ 135: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 139 [ 136: PASS ] Color read back as expected 140 [ 137: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 141 [ 138: PASS ] Color read back as expected 142 [ 139: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 143 [ 140: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 144 [ 141: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 145 [ 142: PASS ] Color read back as expected 146 [ 143: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 147 [ 144: PASS ] Color read back as expected 148 [ 145: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 149 [ 146: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 150 [ 147: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 151 [ 148: FAIL ] Expected color = 127,0,255,178, was = 0,0,0,0 152 [ 149: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 153 [ 150: FAIL ] Expected color = 127,0,255,178, was = 0,0,0,0 154 [ 151: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 155 [ 152: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 156 [ 153: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 157 [ 154: FAIL ] Expected color = -55,56,80,127, was = 0,0,0,0 158 [ 155: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 159 [ 156: FAIL ] Expected color = -55,56,80,127, was = 0,0,0,0 160 [ 157: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 161 [ 158: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 162 [ 159: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 163 [ 160: FAIL ] Expected color = 178,0,127,3, was = 0,0,0,0 164 [ 161: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 165 [ 162: FAIL ] Expected color = 178,0,127,3, was = 0,0,0,0 166 [ 163: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 167 [ 164: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 168 [ 165: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 169 [ 166: FAIL ] Expected color = 14189,6735,0,19, was = 0,0,0,0 170 [ 167: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 171 [ 168: FAIL ] Expected color = 14189,6735,0,19, was = 0,0,0,0 172 [ 169: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 173 [ 170: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 174 [ 171: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 175 [ 172: FAIL ] Expected color = 14189,-6735,0,19, was = 0,0,0,0 176 [ 173: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 177 [ 174: FAIL ] Expected color = 14189,-6735,0,19, was = 0,0,0,0 178 [ 175: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 179 [ 176: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 180 [ 177: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 181 [ 178: FAIL ] Expected color = 126726,6726,98765,2015, was = 0,0,0,0 182 [ 179: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 183 [ 180: FAIL ] Expected color = 126726,6726,98765,2015, was = 0,0,0,0 184 [ 181: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 185 [ 182: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 186 [ 183: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 187 [ 184: FAIL ] Expected color = 126726,-6726,-98765,2015, was = 0,0,0,0 188 [ 185: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 189 [ 186: FAIL ] Expected color = 126726,-6726,-98765,2015, was = 0,0,0,0 190 [ 187: PASS ] getError was expected value: NO_ERROR : Setting up fbo should generate no error 191 [ 188: PASS ] getError was expected value: NO_ERROR : Clear color should generate no error 192 [ 189: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 193 [ 190: PASS ] Color read back as expected 194 [ 191: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 195 [ 192: PASS ] Color read back as expected 196 [ 193: PASS ] getError was expected value: NO_ERROR : readPixels should generate no error 197 [ 194: PASS ] Color read back as expected 198 [ 195: PASS ] successfullyParsed is true 199 [ FAIL ] 26 failures reported 4 [ PASS ] All tests passed 200 5 -
trunk/Source/WebCore/ChangeLog
r264690 r264691 1 2020-07-21 Kenneth Russell <kbr@chromium.org> 2 3 [WebGL2] Implement multiple render target entry points 4 https://bugs.webkit.org/show_bug.cgi?id=211156 5 6 Reviewed by Myles C. Maxfield. 7 8 Implement the drawBuffers and clearBuffer entry points. Integrate 9 the clearBuffer APIs with preserveDrawingBuffer:false's 10 auto-clearing. 11 12 Covered by existing WebGL conformance tests. 13 14 * html/canvas/WebGL2RenderingContext.cpp: 15 (WebCore::WebGL2RenderingContext::drawBuffers): 16 (WebCore::WebGL2RenderingContext::clearBufferiv): 17 (WebCore::WebGL2RenderingContext::clearBufferuiv): 18 (WebCore::WebGL2RenderingContext::clearBufferfv): 19 (WebCore::WebGL2RenderingContext::clearBufferfi): 20 (WebCore::WebGL2RenderingContext::validateClearBuffer): 21 (WebCore::WebGL2RenderingContext::updateBuffersToAutoClear): 22 * html/canvas/WebGL2RenderingContext.h: 23 * html/canvas/WebGLFramebuffer.cpp: 24 (WebCore::WebGLFramebuffer::drawBuffersIfNecessary): 25 * html/canvas/WebGLRenderingContextBase.cpp: 26 (WebCore::WebGLRenderingContextBase::clearIfComposited): 27 * platform/graphics/GraphicsContextGL.h: 28 * platform/graphics/angle/GraphicsContextGLANGLE.cpp: 29 (WebCore::GraphicsContextGLOpenGL::markLayerComposited): 30 (WebCore::GraphicsContextGLOpenGL::drawBuffers): 31 (WebCore::GraphicsContextGLOpenGL::clearBufferiv): 32 (WebCore::GraphicsContextGLOpenGL::clearBufferuiv): 33 (WebCore::GraphicsContextGLOpenGL::clearBufferfv): 34 (WebCore::GraphicsContextGLOpenGL::clearBufferfi): 35 * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: 36 (WebCore::GraphicsContextGLOpenGL::resetBuffersToAutoClear): 37 (WebCore::GraphicsContextGLOpenGL::setBuffersToAutoClear): 38 (WebCore::GraphicsContextGLOpenGL::getBuffersToAutoClear const): 39 * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 40 * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: 41 (WebCore::GraphicsContextGLOpenGL::markLayerComposited): 42 (WebCore::GraphicsContextGLOpenGL::drawBuffers): 43 1 44 2020-07-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 45 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r264662 r264691 1760 1760 // Because the backbuffer is simulated on all current WebKit ports, we need to change BACK to COLOR_ATTACHMENT0. 1761 1761 GCGLenum value = (bufs[0] == GraphicsContextGL::BACK) ? GraphicsContextGL::COLOR_ATTACHMENT0 : GraphicsContextGL::NONE; 1762 graphicsContextGL()->getExtensions().drawBuffersEXT(1, &value);1762 m_context->drawBuffers(1, &value); 1763 1763 setBackDrawBuffer(bufs[0]); 1764 1764 } else { … … 1777 1777 } 1778 1778 1779 void WebGL2RenderingContext::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, Int32List&&, GCGLuint) 1780 { 1781 switch (buffer) { 1782 case GraphicsContextGL::COLOR: 1783 if (drawbuffer < 0 || drawbuffer >= getMaxDrawBuffers()) { 1784 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "clearBufferiv", "buffer index out of range"); 1785 return; 1786 } 1787 // TODO: Call clearBufferiv, requires gl3.h and ES3/gl.h 1788 break; 1789 case GraphicsContextGL::STENCIL: 1790 if (drawbuffer) { 1791 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "clearBufferiv", "buffer index must be 0"); 1792 return; 1793 } 1794 // TODO: Call clearBufferiv, requires gl3.h and ES3/gl.h 1795 break; 1796 case GraphicsContextGL::DEPTH: 1797 case GraphicsContextGL::DEPTH_STENCIL: 1798 default: 1799 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "clearBufferiv", "buffer argument must be COLOR or STENCIL"); 1800 break; 1801 } 1802 } 1803 1804 void WebGL2RenderingContext::clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, Uint32List&&, GCGLuint) 1805 { 1806 switch (buffer) { 1807 case GraphicsContextGL::COLOR: 1808 if (drawbuffer < 0 || drawbuffer >= getMaxDrawBuffers()) { 1809 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "clearBufferuiv", "buffer index out of range"); 1810 return; 1811 } 1812 // TODO: Call clearBufferuiv, requires gl3.h and ES3/gl.h 1813 break; 1814 case GraphicsContextGL::DEPTH: 1815 case GraphicsContextGL::STENCIL: 1816 case GraphicsContextGL::DEPTH_STENCIL: 1817 default: 1818 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "clearBufferuiv", "buffer argument must be COLOR"); 1819 break; 1820 } 1821 } 1822 1823 void WebGL2RenderingContext::clearBufferfv(GCGLenum buffer, GCGLint drawbuffer, Float32List&&, GCGLuint) 1824 { 1825 switch (buffer) { 1826 case GraphicsContextGL::COLOR: 1827 if (drawbuffer < 0 || drawbuffer >= getMaxDrawBuffers()) { 1828 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "clearBufferfv", "buffer index out of range"); 1829 return; 1830 } 1831 // TODO: Call clearBufferfv, requires gl3.h and ES3/gl.h 1832 break; 1833 case GraphicsContextGL::DEPTH: 1834 if (drawbuffer) { 1835 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "clearBufferfv", "buffer index must be 0"); 1836 return; 1837 } 1838 // TODO: Call clearBufferfv, requires gl3.h and ES3/gl.h 1839 break; 1840 case GraphicsContextGL::STENCIL: 1841 case GraphicsContextGL::DEPTH_STENCIL: 1842 default: 1843 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "clearBufferfv", "buffer argument must be COLOR OR DEPTH"); 1844 break; 1845 } 1846 } 1847 1848 void WebGL2RenderingContext::clearBufferfi(GCGLenum buffer, GCGLint drawbuffer, GCGLfloat, GCGLint) 1849 { 1850 switch (buffer) { 1851 case GraphicsContextGL::DEPTH_STENCIL: 1852 if (drawbuffer) { 1853 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "clearBufferfv", "buffer index must be 0"); 1854 return; 1855 } 1856 // TODO: Call clearBufferfi, requires gl3.h and ES3/gl.h 1857 break; 1858 case GraphicsContextGL::COLOR: 1859 case GraphicsContextGL::DEPTH: 1860 case GraphicsContextGL::STENCIL: 1861 default: 1862 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "clearBufferfv", "buffer argument must be DEPTH_STENCIL"); 1863 break; 1864 } 1779 void WebGL2RenderingContext::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, Int32List&& values, GCGLuint srcOffset) 1780 { 1781 if (isContextLostOrPending() || !validateClearBuffer("clearBufferiv", buffer, values.length(), srcOffset)) 1782 return; 1783 1784 m_context->clearBufferiv(buffer, drawbuffer, values.data(), srcOffset); 1785 updateBuffersToAutoClear(ClearBufferCaller::ClearBufferiv, buffer, drawbuffer); 1786 } 1787 1788 void WebGL2RenderingContext::clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, Uint32List&& values, GCGLuint srcOffset) 1789 { 1790 if (isContextLostOrPending() || !validateClearBuffer("clearBufferuiv", buffer, values.length(), srcOffset)) 1791 return; 1792 1793 m_context->clearBufferuiv(buffer, drawbuffer, values.data(), srcOffset); 1794 updateBuffersToAutoClear(ClearBufferCaller::ClearBufferuiv, buffer, drawbuffer); 1795 } 1796 1797 void WebGL2RenderingContext::clearBufferfv(GCGLenum buffer, GCGLint drawbuffer, Float32List&& values, GCGLuint srcOffset) 1798 { 1799 if (isContextLostOrPending() || !validateClearBuffer("clearBufferfv", buffer, values.length(), srcOffset)) 1800 return; 1801 1802 m_context->clearBufferfv(buffer, drawbuffer, values.data(), srcOffset); 1803 // clearBufferiv and clearBufferuiv will currently generate an error 1804 // if they're called against the default back buffer. If support for 1805 // extended canvas color spaces is added, this call might need to be 1806 // added to the other versions. 1807 markContextChanged(); 1808 updateBuffersToAutoClear(ClearBufferCaller::ClearBufferfv, buffer, drawbuffer); 1809 } 1810 1811 void WebGL2RenderingContext::clearBufferfi(GCGLenum buffer, GCGLint drawbuffer, GCGLfloat depth, GCGLint stencil) 1812 { 1813 if (isContextLostOrPending()) 1814 return; 1815 1816 m_context->clearBufferfi(buffer, drawbuffer, depth, stencil); 1817 // This might have been used to clear the depth and stencil buffers 1818 // of the default back buffer. 1819 markContextChanged(); 1820 updateBuffersToAutoClear(ClearBufferCaller::ClearBufferfi, buffer, drawbuffer); 1865 1821 } 1866 1822 … … 3308 3264 } 3309 3265 3266 bool WebGL2RenderingContext::validateClearBuffer(const char* functionName, GCGLenum buffer, size_t size, GCGLuint srcOffset) 3267 { 3268 Checked<GLsizei, RecordOverflow> checkedSize(size); 3269 checkedSize -= srcOffset; 3270 if (checkedSize.hasOverflowed()) { 3271 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid array size / srcOffset"); 3272 return false; 3273 } 3274 switch (buffer) { 3275 case GraphicsContextGL::COLOR: 3276 if (checkedSize.unsafeGet() < 4) { 3277 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid array size / srcOffset"); 3278 return false; 3279 } 3280 break; 3281 case GraphicsContextGL::DEPTH: 3282 case GraphicsContextGL::STENCIL: 3283 if (checkedSize.unsafeGet() < 1) { 3284 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid array size / srcOffset"); 3285 return false; 3286 } 3287 break; 3288 default: 3289 synthesizeGLError(GraphicsContextGL::INVALID_ENUM, functionName, "invalid buffer"); 3290 return false; 3291 } 3292 return true; 3293 } 3294 3310 3295 void WebGL2RenderingContext::uniform1fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength) 3311 3296 { … … 3465 3450 #undef REMOVE_BUFFER_FROM_BINDING 3466 3451 3452 void WebGL2RenderingContext::updateBuffersToAutoClear(ClearBufferCaller caller, GCGLenum buffer, GCGLint drawbuffer) 3453 { 3454 // This method makes sure that we don't auto-clear any buffers which the 3455 // user has manually cleared using the new ES 3.0 clearBuffer* APIs. 3456 3457 // If the user has a framebuffer bound, don't update the auto-clear 3458 // state of the built-in back buffer. 3459 if (m_framebufferBinding) 3460 return; 3461 3462 // If the scissor test is on, assume that we can't short-circuit 3463 // these clears. 3464 if (m_scissorEnabled) 3465 return; 3466 3467 // The default back buffer only has one color attachment. 3468 if (drawbuffer) 3469 return; 3470 3471 // If the call to the driver generated an error, don't claim that 3472 // we've auto-cleared these buffers. The early returns below are for 3473 // cases where errors will be produced. 3474 3475 // The default back buffer is currently always RGB(A)8, which 3476 // restricts the variants which can legally be used to clear the 3477 // color buffer. TODO(crbug.com/829632): this needs to be 3478 // generalized. 3479 switch (caller) { 3480 case ClearBufferCaller::ClearBufferiv: 3481 if (buffer != GraphicsContextGL::STENCIL) 3482 return; 3483 break; 3484 case ClearBufferCaller::ClearBufferfv: 3485 if (buffer != GraphicsContextGL::COLOR && buffer != GraphicsContextGL::DEPTH) 3486 return; 3487 break; 3488 case ClearBufferCaller::ClearBufferuiv: 3489 return; 3490 case ClearBufferCaller::ClearBufferfi: 3491 if (buffer != GraphicsContextGL::DEPTH_STENCIL) 3492 return; 3493 break; 3494 } 3495 3496 GCGLbitfield buffersToClear = 0; 3497 3498 // Turn it into a bitfield and mask it off. 3499 switch (buffer) { 3500 case GraphicsContextGL::COLOR: 3501 buffersToClear = GraphicsContextGL::COLOR_BUFFER_BIT; 3502 break; 3503 case GraphicsContextGL::DEPTH: 3504 buffersToClear = GraphicsContextGL::DEPTH_BUFFER_BIT; 3505 break; 3506 case GraphicsContextGL::STENCIL: 3507 buffersToClear = GraphicsContextGL::STENCIL_BUFFER_BIT; 3508 break; 3509 case GraphicsContextGL::DEPTH_STENCIL: 3510 buffersToClear = GraphicsContextGL::DEPTH_BUFFER_BIT | GraphicsContextGL::STENCIL_BUFFER_BIT; 3511 break; 3512 default: 3513 // Illegal value. 3514 return; 3515 } 3516 3517 m_context->setBuffersToAutoClear(m_context->getBuffersToAutoClear() & (~buffersToClear)); 3518 } 3519 3467 3520 } // namespace WebCore 3468 3521 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h
r264536 r264691 292 292 bool validateBlendEquation(const char* functionName, GCGLenum mode) final; 293 293 bool validateCapability(const char* functionName, GCGLenum cap) final; 294 bool validateClearBuffer(const char* functionName, GCGLenum buffer, size_t, GCGLuint srcOffset); 294 295 bool validateFramebufferTarget(GCGLenum target) final; 295 296 WebGLFramebuffer* getFramebufferBinding(GCGLenum target) final; … … 317 318 318 319 void uncacheDeletedBuffer(WebGLBuffer*) final; 320 321 enum class ClearBufferCaller : uint8_t { 322 ClearBufferiv, 323 ClearBufferuiv, 324 ClearBufferfv, 325 ClearBufferfi 326 }; 327 void updateBuffersToAutoClear(ClearBufferCaller, GCGLenum buffer, GCGLint drawbuffer); 319 328 320 329 RefPtr<WebGLFramebuffer> m_readFramebufferBinding; -
trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
r261413 r264691 622 622 void WebGLFramebuffer::drawBuffersIfNecessary(bool force) 623 623 { 624 #if ENABLE(WEBGL2) 625 // FIXME: The logic here seems wrong. If we don't have WebGL 2 enabled at all, then626 // we skip the m_webglDrawBuffers check. But if we do have WebGL 2 enabled, then we627 // perform this check, for WebGL 1 contexts only.628 if (!context()->m_webglDrawBuffers && !context()->isWebGL2())629 return;630 #endif 631 bool reset = force;632 // This filtering works around graphics driver bugs on Mac OS X.633 for (size_t i = 0; i < m_drawBuffers.size(); ++i){634 if (m_drawBuffers[i] != GraphicsContextGL::NONE && getAttachment(m_drawBuffers[i])) {635 if (m_filteredDrawBuffers[i] != m_drawBuffers[i]) {636 m_filteredDrawBuffers[i] = m_drawBuffers[i];637 reset = true;624 if (context()->isWebGL2() || context()->m_webglDrawBuffers) { 625 bool reset = force; 626 // This filtering works around graphics driver bugs on Mac OS X. 627 for (size_t i = 0; i < m_drawBuffers.size(); ++i) { 628 if (m_drawBuffers[i] != GraphicsContextGL::NONE && getAttachment(m_drawBuffers[i])) { 629 if (m_filteredDrawBuffers[i] != m_drawBuffers[i]) { 630 m_filteredDrawBuffers[i] = m_drawBuffers[i]; 631 reset = true; 632 } 633 } else { 634 if (m_filteredDrawBuffers[i] != GraphicsContextGL::NONE) { 635 m_filteredDrawBuffers[i] = GraphicsContextGL::NONE; 636 reset = true; 637 } 638 638 } 639 } else { 640 if (m_filteredDrawBuffers[i] != GraphicsContextGL::NONE) { 641 m_filteredDrawBuffers[i] = GraphicsContextGL::NONE; 642 reset = true; 639 } 640 if (reset) { 641 if (context()->isWebGL2()) { 642 context()->graphicsContextGL()->drawBuffers( 643 m_filteredDrawBuffers.size(), m_filteredDrawBuffers.data()); 644 } else { 645 context()->graphicsContextGL()->getExtensions().drawBuffersEXT( 646 m_filteredDrawBuffers.size(), m_filteredDrawBuffers.data()); 643 647 } 644 648 } 645 }646 if (reset) {647 context()->graphicsContextGL()->getExtensions().drawBuffersEXT(648 m_filteredDrawBuffers.size(), m_filteredDrawBuffers.data());649 649 } 650 650 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r264536 r264691 1101 1101 return false; 1102 1102 1103 if (!m_context->layerComposited() || m_layerCleared 1104 || m_attributes.preserveDrawingBuffer || (mask && m_framebufferBinding) 1105 || m_preventBufferClearForInspector) 1106 return false; 1107 1108 auto contextAttributes = getContextAttributes(); 1109 ASSERT(contextAttributes); 1103 if (!m_context->layerComposited() || m_layerCleared || m_preventBufferClearForInspector) 1104 return false; 1105 1106 GCGLbitfield buffersNeedingClearing = m_context->getBuffersToAutoClear(); 1107 1108 if (!buffersNeedingClearing || (mask && m_framebufferBinding)) 1109 return false; 1110 1111 // Use the underlying GraphicsContext3D's attributes to take into 1112 // account (for example) packed depth/stencil buffers. 1113 auto contextAttributes = m_context->contextAttributes(); 1110 1114 1111 1115 // Determine if it's possible to combine the clear the user asked for and this clear. … … 1122 1126 m_context->colorMask(true, true, true, true); 1123 1127 GCGLbitfield clearMask = GraphicsContextGL::COLOR_BUFFER_BIT; 1124 if (contextAttributes ->depth) {1128 if (contextAttributes.depth) { 1125 1129 if (!combinedClear || !m_depthMask || !(mask & GraphicsContextGL::DEPTH_BUFFER_BIT)) 1126 1130 m_context->clearDepth(1.0f); … … 1128 1132 m_context->depthMask(true); 1129 1133 } 1130 if (contextAttributes ->stencil) {1134 if (contextAttributes.stencil) { 1131 1135 if (combinedClear && (mask & GraphicsContextGL::STENCIL_BUFFER_BIT)) 1132 1136 m_context->clearStencil(m_clearStencil & m_stencilMask); … … 1136 1140 m_context->stencilMaskSeparate(GraphicsContextGL::FRONT, 0xFFFFFFFF); 1137 1141 } 1138 1142 1139 1143 GCGLenum bindingPoint = isWebGL2() ? GraphicsContextGL::DRAW_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER; 1140 1144 if (m_framebufferBinding) 1141 1145 m_context->bindFramebuffer(bindingPoint, 0); 1142 m_context->clear(clearMask); 1146 // If the WebGL 2.0 clearBuffer APIs already have been used to 1147 // selectively clear some of the buffers, don't destroy those 1148 // results. 1149 m_context->clear(clearMask & buffersNeedingClearing); 1150 m_context->setBuffersToAutoClear(0); 1143 1151 1144 1152 restoreStateAfterClear(); -
trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h
r264536 r264691 1187 1187 virtual void drawRangeElements(GCGLenum mode, GCGLuint start, GCGLuint end, GCGLsizei count, GCGLenum type, GCGLintptr offset) = 0; 1188 1188 1189 virtual void drawBuffers( const Vector<GCGLenum>& buffers) = 0;1189 virtual void drawBuffers(GCGLsizei n, const GCGLenum* bufs) = 0; 1190 1190 virtual void clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLint* values, GCGLuint srcOffset) = 0; 1191 1191 virtual void clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLuint* values, GCGLuint srcOffset) = 0; -
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
r264662 r264691 1900 1900 { 1901 1901 m_layerComposited = true; 1902 resetBuffersToAutoClear(); 1902 1903 1903 1904 for (auto* client : copyToVector(m_clients)) … … 2308 2309 } 2309 2310 2310 void GraphicsContextGLOpenGL::drawBuffers( const Vector<GCGLenum>& buffers)2311 { 2312 UNUSED_PARAM(buffers);2311 void GraphicsContextGLOpenGL::drawBuffers(GCGLsizei n, const GCGLenum* bufs) 2312 { 2313 gl::DrawBuffers(n, bufs); 2313 2314 } 2314 2315 2315 2316 void GraphicsContextGLOpenGL::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLint* values, GCGLuint srcOffset) 2316 2317 { 2317 UNUSED_PARAM(buffer); 2318 UNUSED_PARAM(drawbuffer); 2319 UNUSED_PARAM(values); 2320 UNUSED_PARAM(srcOffset); 2318 gl::ClearBufferiv(buffer, drawbuffer, values + srcOffset); 2321 2319 } 2322 2320 2323 2321 void GraphicsContextGLOpenGL::clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLuint* values, GCGLuint srcOffset) 2324 2322 { 2325 UNUSED_PARAM(buffer); 2326 UNUSED_PARAM(drawbuffer); 2327 UNUSED_PARAM(values); 2328 UNUSED_PARAM(srcOffset); 2323 gl::ClearBufferuiv(buffer, drawbuffer, values + srcOffset); 2329 2324 } 2330 2325 2331 2326 void GraphicsContextGLOpenGL::clearBufferfv(GCGLenum buffer, GCGLint drawbuffer, const GCGLfloat* values, GCGLuint srcOffset) 2332 2327 { 2333 UNUSED_PARAM(buffer); 2334 UNUSED_PARAM(drawbuffer); 2335 UNUSED_PARAM(values); 2336 UNUSED_PARAM(srcOffset); 2328 gl::ClearBufferfv(buffer, drawbuffer, values + srcOffset); 2337 2329 } 2338 2330 2339 2331 void GraphicsContextGLOpenGL::clearBufferfi(GCGLenum buffer, GCGLint drawbuffer, GCGLfloat depth, GCGLint stencil) 2340 2332 { 2341 UNUSED_PARAM(buffer); 2342 UNUSED_PARAM(drawbuffer); 2343 UNUSED_PARAM(depth); 2344 UNUSED_PARAM(stencil); 2333 gl::ClearBufferfi(buffer, drawbuffer, depth, stencil); 2345 2334 } 2346 2335 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp
r262366 r264691 271 271 272 272 } // anonymous namespace 273 274 void GraphicsContextGLOpenGL::resetBuffersToAutoClear() 275 { 276 GCGLuint buffers = GraphicsContextGL::COLOR_BUFFER_BIT; 277 // The GraphicsContextGL's attributes (as opposed to 278 // WebGLRenderingContext's) indicate whether there is an 279 // implicitly-allocated stencil buffer, for example. 280 auto attrs = contextAttributes(); 281 if (attrs.depth) 282 buffers |= GraphicsContextGL::DEPTH_BUFFER_BIT; 283 if (attrs.stencil) 284 buffers |= GraphicsContextGL::STENCIL_BUFFER_BIT; 285 setBuffersToAutoClear(buffers); 286 } 287 288 void GraphicsContextGLOpenGL::setBuffersToAutoClear(GCGLbitfield buffers) 289 { 290 auto attrs = contextAttributes(); 291 if (!attrs.preserveDrawingBuffer) 292 m_buffersToAutoClear = buffers; 293 else 294 ASSERT(!m_buffersToAutoClear); 295 } 296 297 GCGLbitfield GraphicsContextGLOpenGL::getBuffersToAutoClear() const 298 { 299 return m_buffersToAutoClear; 300 } 273 301 274 302 bool GraphicsContextGLOpenGL::texImage2DResourceSafe(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, GCGLint unpackAlignment) -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h
r264536 r264691 434 434 void drawRangeElements(GCGLenum mode, GCGLuint start, GCGLuint end, GCGLsizei count, GCGLenum type, GCGLintptr offset) final; 435 435 436 void drawBuffers( const Vector<GCGLenum>& buffers) final;436 void drawBuffers(GCGLsizei n, const GCGLenum* bufs) final; 437 437 void clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLint* values, GCGLuint srcOffset) final; 438 438 void clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLuint* values, GCGLuint srcOffset) final; … … 523 523 void forceContextLost(); 524 524 void recycleContext(); 525 526 // Maintenance of auto-clearing of color/depth/stencil buffers. The 527 // reset method is present to keep calling code simpler, so it 528 // doesn't have to know which buffers were allocated. 529 void resetBuffersToAutoClear(); 530 void setBuffersToAutoClear(GCGLbitfield); 531 GCGLbitfield getBuffersToAutoClear() const; 525 532 526 533 void dispatchContextChangedNotification(); … … 865 872 #endif 866 873 874 // A bitmask of GL buffer bits (GL_COLOR_BUFFER_BIT, 875 // GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT) which need to be 876 // auto-cleared. 877 GCGLbitfield m_buffersToAutoClear { 0 }; 878 867 879 // Errors raised by synthesizeGLError(). 868 880 ListHashSet<GCGLenum> m_syntheticErrors; -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp
r264536 r264691 2020 2020 { 2021 2021 m_layerComposited = true; 2022 resetBuffersToAutoClear(); 2022 2023 2023 2024 for (auto* client : copyToVector(m_clients)) … … 2425 2426 } 2426 2427 2427 void GraphicsContextGLOpenGL::drawBuffers(const Vector<GCGLenum>& buffers) 2428 { 2429 UNUSED_PARAM(buffers); 2428 void GraphicsContextGLOpenGL::drawBuffers(GCGLsizei n, const GCGLenum* bufs) 2429 { 2430 UNUSED_PARAM(n); 2431 UNUSED_PARAM(bufs); 2430 2432 } 2431 2433
Note: See TracChangeset
for help on using the changeset viewer.