Changeset 208747 in webkit
- Timestamp:
- Nov 15, 2016, 12:55:29 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r208745 r208747 1 2016-11-15 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [WebGL] Remove unused Chromium-specific OpenGL extensions 4 https://bugs.webkit.org/show_bug.cgi?id=164782 5 6 Reviewed by Dean Jackson. 7 8 No new tests because there is no behavior change. 9 10 * html/canvas/WebGL2RenderingContext.cpp: 11 (WebCore::WebGL2RenderingContext::copyBufferSubData): 12 (WebCore::WebGL2RenderingContext::clear): 13 (WebCore::WebGL2RenderingContext::getExtension): 14 * html/canvas/WebGLCompressedTextureS3TC.cpp: 15 (WebCore::WebGLCompressedTextureS3TC::supported): 16 * html/canvas/WebGLDepthTexture.cpp: 17 (WebCore::WebGLDepthTexture::supported): 18 * html/canvas/WebGLDrawBuffers.cpp: 19 (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements): 20 * html/canvas/WebGLFramebuffer.cpp: 21 (WebCore::WebGLFramebuffer::onAccess): 22 * html/canvas/WebGLFramebuffer.h: 23 * html/canvas/WebGLRenderingContext.cpp: 24 (WebCore::WebGLRenderingContext::getExtension): 25 (WebCore::WebGLRenderingContext::clear): 26 * html/canvas/WebGLRenderingContextBase.cpp: 27 (WebCore::WebGLRenderingContextBase::setupFlags): 28 (WebCore::WebGLRenderingContextBase::bufferData): 29 (WebCore::WebGLRenderingContextBase::bufferSubData): 30 (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): 31 (WebCore::WebGLRenderingContextBase::validateDrawArrays): 32 (WebCore::WebGLRenderingContextBase::validateDrawElements): 33 (WebCore::WebGLRenderingContextBase::readPixels): 34 (WebCore::WebGLRenderingContextBase::texImage2DBase): 35 (WebCore::WebGLRenderingContextBase::copyTexImage2D): 36 * html/canvas/WebGLRenderingContextBase.h: 37 (WebCore::WebGLRenderingContextBase::isGLES2NPOTStrict): 38 (WebCore::WebGLRenderingContextBase::isErrorGeneratedOnOutOfBoundsAccesses): Deleted. 39 (WebCore::WebGLRenderingContextBase::isResourceSafe): Deleted. 40 * platform/graphics/GraphicsContext3D.cpp: 41 (WebCore::GraphicsContext3D::texImage2DResourceSafe): 42 * platform/graphics/GraphicsContext3D.h: 43 * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: 44 (WebCore::GraphicsContext3D::isResourceSafe): Deleted. 45 1 46 2016-11-14 Brent Fulgham <bfulgham@apple.com> 2 47 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r208740 r208747 199 199 } 200 200 201 if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) { 202 if (!writeBuffer->associateCopyBufferSubData(*readBuffer, checkedReadOffset.unsafeGet(), checkedWriteOffset.unsafeGet(), checkedSize.unsafeGet())) { 203 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyBufferSubData", "offset out of range"); 204 return; 205 } 201 if (!writeBuffer->associateCopyBufferSubData(*readBuffer, checkedReadOffset.unsafeGet(), checkedWriteOffset.unsafeGet(), checkedSize.unsafeGet())) { 202 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyBufferSubData", "offset out of range"); 203 return; 206 204 } 207 205 … … 441 439 } 442 440 const char* reason = "framebuffer incomplete"; 443 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {441 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 444 442 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason); 445 443 return; … … 915 913 if (equalIgnoringASCIICase(name, "WEBGL_depth_texture") 916 914 && WebGLDepthTexture::supported(*graphicsContext3D())) { 917 if (!m_webglDepthTexture) { 918 m_context->getExtensions().ensureEnabled("GL_CHROMIUM_depth_texture"); 915 if (!m_webglDepthTexture) 919 916 m_webglDepthTexture = std::make_unique<WebGLDepthTexture>(*this); 920 }921 917 return m_webglDepthTexture.get(); 922 918 } -
trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp
r208740 r208747 57 57 auto& extensions = context.graphicsContext3D()->getExtensions(); 58 58 return extensions.supports("GL_EXT_texture_compression_s3tc") 59 || (extensions.supports("GL_EXT_texture_compression_dxt1") 60 && extensions.supports("GL_CHROMIUM_texture_compression_dxt3") 61 && extensions.supports("GL_CHROMIUM_texture_compression_dxt5")); 59 || extensions.supports("GL_EXT_texture_compression_dxt1"); 62 60 } 63 61 -
trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp
r208740 r208747 51 51 { 52 52 Extensions3D& extensions = context.getExtensions(); 53 return extensions.supports("GL_CHROMIUM_depth_texture") 54 || extensions.supports("GL_OES_depth_texture") 53 return extensions.supports("GL_OES_depth_texture") 55 54 || extensions.supports("GL_ARB_depth_texture"); 56 55 } -
trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp
r208740 r208747 104 104 105 105 const unsigned char buffer[4] = { 0, 0, 0, 0 }; // textures are required to be initialized for other ports. 106 bool supportsDepth = (context->getExtensions().supports("GL_CHROMIUM_depth_texture") 107 || context->getExtensions().supports("GL_OES_depth_texture") 108 || context->getExtensions().supports("GL_ARB_depth_texture")); 106 bool supportsDepth = context->getExtensions().supports("GL_OES_depth_texture") 107 || context->getExtensions().supports("GL_ARB_depth_texture"); 109 108 bool supportsDepthStencil = (context->getExtensions().supports("GL_EXT_packed_depth_stencil") 110 109 || context->getExtensions().supports("GL_OES_packed_depth_stencil")); -
trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
r208740 r208747 480 480 } 481 481 482 bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, bool needToInitializeAttachments,const char** reason)482 bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, const char** reason) 483 483 { 484 484 if (checkStatus(reason) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) 485 485 return false; 486 if (needToInitializeAttachments) 487 return initializeAttachments(context3d, reason); 488 return true; 486 return initializeAttachments(context3d, reason); 489 487 } 490 488 -
trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h
r208740 r208747 79 79 // the buffers if they haven't been initialized and 80 80 // needToInitializeAttachments is true. 81 bool onAccess(GraphicsContext3D*, bool needToInitializeAttachments,const char** reason);81 bool onAccess(GraphicsContext3D*, const char** reason); 82 82 83 83 // Software version of glCheckFramebufferStatus(), except that when -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r208740 r208747 211 211 if (equalIgnoringASCIICase(name, "WEBGL_depth_texture") 212 212 && WebGLDepthTexture::supported(*graphicsContext3D())) { 213 if (!m_webglDepthTexture) { 214 m_context->getExtensions().ensureEnabled("GL_CHROMIUM_depth_texture"); 213 if (!m_webglDepthTexture) 215 214 m_webglDepthTexture = std::make_unique<WebGLDepthTexture>(*this); 216 }217 215 return m_webglDepthTexture.get(); 218 216 } … … 457 455 } 458 456 const char* reason = "framebuffer incomplete"; 459 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {457 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 460 458 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason); 461 459 return; -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r208740 r208747 576 576 577 577 m_isGLES2Compliant = m_context->isGLES2Compliant(); 578 m_isErrorGeneratedOnOutOfBoundsAccesses = m_context->getExtensions().isEnabled("GL_CHROMIUM_strict_attribs");579 m_isResourceSafe = m_context->getExtensions().isEnabled("GL_CHROMIUM_resource_safe");580 578 if (m_isGLES2Compliant) { 581 579 m_isGLES2NPOTStrict = !m_context->getExtensions().isEnabled("GL_OES_texture_npot"); … … 1092 1090 return; 1093 1091 } 1094 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1095 if (!buffer->associateBufferData(static_cast<GC3Dsizeiptr>(size))) { 1096 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1097 return; 1098 } 1092 if (!buffer->associateBufferData(static_cast<GC3Dsizeiptr>(size))) { 1093 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1094 return; 1099 1095 } 1100 1096 … … 1120 1116 1121 1117 WTF::visit([&](auto& data) { 1122 if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) { 1123 if (!buffer->associateBufferData(data.get())) { 1124 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1125 return; 1126 } 1118 if (!buffer->associateBufferData(data.get())) { 1119 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer"); 1120 return; 1127 1121 } 1128 1122 … … 1151 1145 1152 1146 WTF::visit([&](auto& data) { 1153 if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) { 1154 if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data.get())) { 1155 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range"); 1156 return; 1157 } 1147 if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data.get())) { 1148 this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range"); 1149 return; 1158 1150 } 1159 1151 … … 1356 1348 } 1357 1349 const char* reason = "framebuffer incomplete"; 1358 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {1350 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 1359 1351 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason); 1360 1352 return; 1361 1353 } 1362 1354 clearIfComposited(); 1363 if (isResourceSafe()) 1364 m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 1365 else { 1366 GC3Dint clippedX, clippedY; 1367 GC3Dsizei clippedWidth, clippedHeight; 1368 if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) { 1369 GC3Denum format; 1370 GC3Denum type; 1371 if (!GraphicsContext3D::possibleFormatAndTypeForInternalFormat(tex->getInternalFormat(target, level), format, type)) { 1372 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "copyTexSubImage2D", "Texture has unknown internal format"); 1355 1356 GC3Dint clippedX, clippedY; 1357 GC3Dsizei clippedWidth, clippedHeight; 1358 if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) { 1359 GC3Denum format; 1360 GC3Denum type; 1361 if (!GraphicsContext3D::possibleFormatAndTypeForInternalFormat(tex->getInternalFormat(target, level), format, type)) { 1362 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "copyTexSubImage2D", "Texture has unknown internal format"); 1363 return; 1364 } 1365 std::unique_ptr<unsigned char[]> zero; 1366 if (width && height) { 1367 unsigned size; 1368 GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_unpackAlignment, &size, 0); 1369 if (error != GraphicsContext3D::NO_ERROR) { 1370 synthesizeGLError(error, "copyTexSubImage2D", "bad dimensions"); 1373 1371 return; 1374 1372 } 1375 std::unique_ptr<unsigned char[]> zero; 1376 if (width && height) { 1377 unsigned int size; 1378 GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_unpackAlignment, &size, 0); 1379 if (error != GraphicsContext3D::NO_ERROR) { 1380 synthesizeGLError(error, "copyTexSubImage2D", "bad dimensions"); 1381 return; 1382 } 1383 zero = std::make_unique<unsigned char[]>(size); 1384 if (!zero) { 1385 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "out of memory"); 1386 return; 1387 } 1388 memset(zero.get(), 0, size); 1373 zero = std::make_unique<unsigned char[]>(size); 1374 if (!zero) { 1375 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "out of memory"); 1376 return; 1389 1377 } 1390 m _context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, zero.get());1391 if (clippedWidth > 0 && clippedHeight > 0)1392 m_context->copyTexSubImage2D(target, level, xoffset + clippedX - x, yoffset + clippedY - y,1393 clippedX, clippedY, clippedWidth, clippedHeight);1394 } else1395 m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);1396 }1378 memset(zero.get(), 0, size); 1379 } 1380 m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, zero.get()); 1381 if (clippedWidth > 0 && clippedHeight > 0) 1382 m_context->copyTexSubImage2D(target, level, xoffset + clippedX - x, yoffset + clippedY - y, clippedX, clippedY, clippedWidth, clippedHeight); 1383 } else 1384 m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 1397 1385 } 1398 1386 … … 1819 1807 } 1820 1808 1821 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1822 // Ensure we have a valid rendering state 1823 Checked<GC3Dint, RecordOverflow> checkedFirst(first); 1824 Checked<GC3Dint, RecordOverflow> checkedCount(count); 1825 Checked<GC3Dint, RecordOverflow> checkedSum = checkedFirst + checkedCount; 1826 Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount); 1827 if (checkedSum.hasOverflowed() || checkedPrimitiveCount.hasOverflowed() || !validateVertexAttributes(checkedSum.unsafeGet(), checkedPrimitiveCount.unsafeGet())) { 1828 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays"); 1829 return false; 1830 } 1831 if (!validateSimulatedVertexAttrib0(checkedSum.unsafeGet() - 1)) { 1832 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array"); 1833 return false; 1834 } 1835 } else { 1836 if (!validateVertexAttributes(0)) { 1837 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly"); 1838 return false; 1839 } 1809 // Ensure we have a valid rendering state. 1810 Checked<GC3Dint, RecordOverflow> checkedFirst(first); 1811 Checked<GC3Dint, RecordOverflow> checkedCount(count); 1812 Checked<GC3Dint, RecordOverflow> checkedSum = checkedFirst + checkedCount; 1813 Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount); 1814 if (checkedSum.hasOverflowed() || checkedPrimitiveCount.hasOverflowed() || !validateVertexAttributes(checkedSum.unsafeGet(), checkedPrimitiveCount.unsafeGet())) { 1815 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays"); 1816 return false; 1817 } 1818 if (!validateSimulatedVertexAttrib0(checkedSum.unsafeGet() - 1)) { 1819 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array"); 1820 return false; 1840 1821 } 1841 1822 1842 1823 const char* reason = "framebuffer incomplete"; 1843 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {1824 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 1844 1825 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason); 1845 1826 return false; … … 1890 1871 return false; 1891 1872 } 1873 1874 // Ensure we have a valid rendering state. 1875 if (!validateElementArraySize(count, type, static_cast<GC3Dintptr>(offset))) { 1876 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "request out of bounds for current ELEMENT_ARRAY_BUFFER"); 1877 return false; 1878 } 1879 if (!count) 1880 return false; 1892 1881 1893 if (!isErrorGeneratedOnOutOfBoundsAccesses()) { 1894 // Ensure we have a valid rendering state 1895 if (!validateElementArraySize(count, type, static_cast<GC3Dintptr>(offset))) { 1896 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "request out of bounds for current ELEMENT_ARRAY_BUFFER"); 1897 return false; 1898 } 1899 if (!count) 1900 return false; 1901 1902 Checked<GC3Dint, RecordOverflow> checkedCount(count); 1903 Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount); 1904 if (checkedCount.hasOverflowed() || checkedPrimitiveCount.hasOverflowed()) { 1882 Checked<GC3Dint, RecordOverflow> checkedCount(count); 1883 Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount); 1884 if (checkedCount.hasOverflowed() || checkedPrimitiveCount.hasOverflowed()) { 1885 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays"); 1886 return false; 1887 } 1888 1889 if (!validateIndexArrayConservative(type, numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) { 1890 if (!validateIndexArrayPrecise(checkedCount.unsafeGet(), type, static_cast<GC3Dintptr>(offset), numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) { 1905 1891 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays"); 1906 1892 return false; 1907 1893 } 1908 1909 if (!validateIndexArrayConservative(type, numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) { 1910 if (!validateIndexArrayPrecise(checkedCount.unsafeGet(), type, static_cast<GC3Dintptr>(offset), numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) { 1911 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays"); 1912 return false; 1913 } 1914 } 1915 1916 if (!validateSimulatedVertexAttrib0(numElements)) { 1917 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array"); 1918 return false; 1919 } 1920 1921 } else { 1922 if (!validateVertexAttributes(0)) { 1923 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly"); 1924 return false; 1925 } 1894 } 1895 1896 if (!validateSimulatedVertexAttrib0(numElements)) { 1897 synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array"); 1898 return false; 1926 1899 } 1927 1900 1928 1901 const char* reason = "framebuffer incomplete"; 1929 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {1902 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 1930 1903 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason); 1931 1904 return false; … … 3015 2988 if (m_framebufferBinding) { 3016 2989 const char* reason = "framebuffer incomplete"; 3017 if (!m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {2990 if (!m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 3018 2991 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason); 3019 2992 return; … … 3284 3257 ASSERT(validateNPOTTextureLevel(width, height, level, "texImage2D")); 3285 3258 if (!pixels) { 3286 // Note: Chromium's OpenGL implementation clears textures and isResourceSafe() is therefore true. 3287 // For other implementations, if they are using ANGLE_depth_texture, ANGLE depth textures 3288 // can not be cleared with texImage2D and must be cleared by binding to an fbo and calling 3289 // clear. 3290 if (isResourceSafe()) 3291 m_context->texImage2D(target, level, internalFormat, width, height, border, format, type, nullptr); 3292 else { 3293 bool succeed = m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, 3294 border, format, type, m_unpackAlignment); 3295 if (!succeed) 3296 return; 3297 } 3259 if (!m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, border, format, type, m_unpackAlignment)) 3260 return; 3298 3261 } else { 3299 3262 ASSERT(validateSettableTexInternalFormat("texImage2D", internalFormat)); … … 3979 3942 } 3980 3943 const char* reason = "framebuffer incomplete"; 3981 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(),&reason)) {3944 if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) { 3982 3945 synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexImage2D", reason); 3983 3946 return; 3984 3947 } 3985 3948 clearIfComposited(); 3986 if (isResourceSafe()) 3949 3950 GC3Dint clippedX, clippedY; 3951 GC3Dsizei clippedWidth, clippedHeight; 3952 if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) { 3953 m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, border, 3954 internalFormat, GraphicsContext3D::UNSIGNED_BYTE, m_unpackAlignment); 3955 if (clippedWidth > 0 && clippedHeight > 0) { 3956 m_context->copyTexSubImage2D(target, level, clippedX - x, clippedY - y, 3957 clippedX, clippedY, clippedWidth, clippedHeight); 3958 } 3959 } else 3987 3960 m_context->copyTexImage2D(target, level, internalFormat, x, y, width, height, border); 3988 else { 3989 GC3Dint clippedX, clippedY; 3990 GC3Dsizei clippedWidth, clippedHeight; 3991 if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) { 3992 m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, border, 3993 internalFormat, GraphicsContext3D::UNSIGNED_BYTE, m_unpackAlignment); 3994 if (clippedWidth > 0 && clippedHeight > 0) { 3995 m_context->copyTexSubImage2D(target, level, clippedX - x, clippedY - y, 3996 clippedX, clippedY, clippedWidth, clippedHeight); 3997 } 3998 } else 3999 m_context->copyTexImage2D(target, level, internalFormat, x, y, width, height, border); 4000 } 3961 4001 3962 // FIXME: if the framebuffer is not complete, none of the below should be executed. 4002 3963 tex->setLevelInfo(target, level, internalFormat, width, height, GraphicsContext3D::UNSIGNED_BYTE); -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r208724 r208747 372 372 // Query if the GL implementation is NPOT strict. 373 373 bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; } 374 // Query if the GL implementation generates errors on out-of-bounds buffer accesses.375 bool isErrorGeneratedOnOutOfBoundsAccesses() { return m_isErrorGeneratedOnOutOfBoundsAccesses; }376 // Query if the GL implementation initializes textures/renderbuffers to 0.377 bool isResourceSafe() { return m_isResourceSafe; }378 374 // Query if depth_stencil buffer is supported. 379 375 bool isDepthStencilSupported() { return m_isDepthStencilSupported; } … … 537 533 bool m_isGLES2Compliant; 538 534 bool m_isGLES2NPOTStrict; 539 bool m_isErrorGeneratedOnOutOfBoundsAccesses;540 bool m_isResourceSafe;541 535 bool m_isDepthStencilSupported; 542 536 bool m_isRobustnessEXTSupported; -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp
r208724 r208747 148 148 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); 149 149 std::unique_ptr<unsigned char[]> zero; 150 if ( !isResourceSafe() &&width > 0 && height > 0) {150 if (width > 0 && height > 0) { 151 151 unsigned int size; 152 152 GC3Denum error = computeImageSizeInBytes(format, type, width, height, unpackAlignment, &size, 0); -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r208740 r208747 1307 1307 1308 1308 int m_currentWidth, m_currentHeight; 1309 bool isResourceSafe();1310 1309 1311 1310 #if PLATFORM(COCOA) -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
r208740 r208747 157 157 } 158 158 159 bool GraphicsContext3D::isResourceSafe()160 {161 return false;162 }163 164 159 void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer) 165 160 {
Note:
See TracChangeset
for help on using the changeset viewer.