Changeset 208747 in webkit


Ignore:
Timestamp:
Nov 15, 2016, 12:55:29 PM (9 years ago)
Author:
mmaxfield@apple.com
Message:

[WebGL] Remove unused Chromium-specific OpenGL extensions
https://bugs.webkit.org/show_bug.cgi?id=164782

Reviewed by Dean Jackson.

No new tests because there is no behavior change.

  • html/canvas/WebGL2RenderingContext.cpp:

(WebCore::WebGL2RenderingContext::copyBufferSubData):
(WebCore::WebGL2RenderingContext::clear):
(WebCore::WebGL2RenderingContext::getExtension):

  • html/canvas/WebGLCompressedTextureS3TC.cpp:

(WebCore::WebGLCompressedTextureS3TC::supported):

  • html/canvas/WebGLDepthTexture.cpp:

(WebCore::WebGLDepthTexture::supported):

  • html/canvas/WebGLDrawBuffers.cpp:

(WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements):

  • html/canvas/WebGLFramebuffer.cpp:

(WebCore::WebGLFramebuffer::onAccess):

  • html/canvas/WebGLFramebuffer.h:
  • html/canvas/WebGLRenderingContext.cpp:

(WebCore::WebGLRenderingContext::getExtension):
(WebCore::WebGLRenderingContext::clear):

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::setupFlags):
(WebCore::WebGLRenderingContextBase::bufferData):
(WebCore::WebGLRenderingContextBase::bufferSubData):
(WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
(WebCore::WebGLRenderingContextBase::validateDrawArrays):
(WebCore::WebGLRenderingContextBase::validateDrawElements):
(WebCore::WebGLRenderingContextBase::readPixels):
(WebCore::WebGLRenderingContextBase::texImage2DBase):
(WebCore::WebGLRenderingContextBase::copyTexImage2D):

  • html/canvas/WebGLRenderingContextBase.h:

(WebCore::WebGLRenderingContextBase::isGLES2NPOTStrict):
(WebCore::WebGLRenderingContextBase::isErrorGeneratedOnOutOfBoundsAccesses): Deleted.
(WebCore::WebGLRenderingContextBase::isResourceSafe): Deleted.

  • platform/graphics/GraphicsContext3D.cpp:

(WebCore::GraphicsContext3D::texImage2DResourceSafe):

  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:

(WebCore::GraphicsContext3D::isResourceSafe): Deleted.

Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r208745 r208747  
     12016-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
    1462016-11-14  Brent Fulgham  <bfulgham@apple.com>
    247
  • trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp

    r208740 r208747  
    199199    }
    200200
    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;
    206204    }
    207205
     
    441439    }
    442440    const char* reason = "framebuffer incomplete";
    443     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     441    if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    444442        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
    445443        return;
     
    915913    if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")
    916914        && WebGLDepthTexture::supported(*graphicsContext3D())) {
    917         if (!m_webglDepthTexture) {
    918             m_context->getExtensions().ensureEnabled("GL_CHROMIUM_depth_texture");
     915        if (!m_webglDepthTexture)
    919916            m_webglDepthTexture = std::make_unique<WebGLDepthTexture>(*this);
    920         }
    921917        return m_webglDepthTexture.get();
    922918    }
  • trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp

    r208740 r208747  
    5757    auto& extensions = context.graphicsContext3D()->getExtensions();
    5858    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");
    6260}
    6361
  • trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp

    r208740 r208747  
    5151{
    5252    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")
    5554        || extensions.supports("GL_ARB_depth_texture");
    5655}
  • trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp

    r208740 r208747  
    104104
    105105    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");
    109108    bool supportsDepthStencil = (context->getExtensions().supports("GL_EXT_packed_depth_stencil")
    110109        || context->getExtensions().supports("GL_OES_packed_depth_stencil"));
  • trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp

    r208740 r208747  
    480480}
    481481
    482 bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, bool needToInitializeAttachments, const char** reason)
     482bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, const char** reason)
    483483{
    484484    if (checkStatus(reason) != GraphicsContext3D::FRAMEBUFFER_COMPLETE)
    485485        return false;
    486     if (needToInitializeAttachments)
    487         return initializeAttachments(context3d, reason);
    488     return true;
     486    return initializeAttachments(context3d, reason);
    489487}
    490488
  • trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h

    r208740 r208747  
    7979    // the buffers if they haven't been initialized and
    8080    // needToInitializeAttachments is true.
    81     bool onAccess(GraphicsContext3D*, bool needToInitializeAttachments, const char** reason);
     81    bool onAccess(GraphicsContext3D*, const char** reason);
    8282
    8383    // Software version of glCheckFramebufferStatus(), except that when
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r208740 r208747  
    211211    if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")
    212212        && WebGLDepthTexture::supported(*graphicsContext3D())) {
    213         if (!m_webglDepthTexture) {
    214             m_context->getExtensions().ensureEnabled("GL_CHROMIUM_depth_texture");
     213        if (!m_webglDepthTexture)
    215214            m_webglDepthTexture = std::make_unique<WebGLDepthTexture>(*this);
    216         }
    217215        return m_webglDepthTexture.get();
    218216    }
     
    457455    }
    458456    const char* reason = "framebuffer incomplete";
    459     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     457    if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    460458        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
    461459        return;
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r208740 r208747  
    576576
    577577    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");
    580578    if (m_isGLES2Compliant) {
    581579        m_isGLES2NPOTStrict = !m_context->getExtensions().isEnabled("GL_OES_texture_npot");
     
    10921090        return;
    10931091    }
    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;
    10991095    }
    11001096
     
    11201116
    11211117    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;
    11271121        }
    11281122
     
    11511145
    11521146    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;
    11581150        }
    11591151
     
    13561348    }
    13571349    const char* reason = "framebuffer incomplete";
    1358     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     1350    if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    13591351        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason);
    13601352        return;
    13611353    }
    13621354    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");
    13731371                return;
    13741372            }
    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;
    13891377            }
    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         } else
    1395             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);
    13971385}
    13981386
     
    18191807    }
    18201808
    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;
    18401821    }
    18411822
    18421823    const char* reason = "framebuffer incomplete";
    1843     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     1824    if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    18441825        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
    18451826        return false;
     
    18901871        return false;
    18911872    }
     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;
    18921881   
    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())) {
    19051891            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
    19061892            return false;
    19071893        }
    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;
    19261899    }
    19271900   
    19281901    const char* reason = "framebuffer incomplete";
    1929     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     1902    if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    19301903        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
    19311904        return false;
     
    30152988    if (m_framebufferBinding) {
    30162989        const char* reason = "framebuffer incomplete";
    3017         if (!m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     2990        if (!m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    30182991            synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason);
    30192992            return;
     
    32843257    ASSERT(validateNPOTTextureLevel(width, height, level, "texImage2D"));
    32853258    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;
    32983261    } else {
    32993262        ASSERT(validateSettableTexInternalFormat("texImage2D", internalFormat));
     
    39793942    }
    39803943    const char* reason = "framebuffer incomplete";
    3981     if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
     3944    if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
    39823945        synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexImage2D", reason);
    39833946        return;
    39843947    }
    39853948    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
    39873960        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
    40013962    // FIXME: if the framebuffer is not complete, none of the below should be executed.
    40023963    tex->setLevelInfo(target, level, internalFormat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h

    r208724 r208747  
    372372    // Query if the GL implementation is NPOT strict.
    373373    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; }
    378374    // Query if depth_stencil buffer is supported.
    379375    bool isDepthStencilSupported() { return m_isDepthStencilSupported; }
     
    537533    bool m_isGLES2Compliant;
    538534    bool m_isGLES2NPOTStrict;
    539     bool m_isErrorGeneratedOnOutOfBoundsAccesses;
    540     bool m_isResourceSafe;
    541535    bool m_isDepthStencilSupported;
    542536    bool m_isRobustnessEXTSupported;
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp

    r208724 r208747  
    148148    ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
    149149    std::unique_ptr<unsigned char[]> zero;
    150     if (!isResourceSafe() && width > 0 && height > 0) {
     150    if (width > 0 && height > 0) {
    151151        unsigned int size;
    152152        GC3Denum error = computeImageSizeInBytes(format, type, width, height, unpackAlignment, &size, 0);
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r208740 r208747  
    13071307
    13081308    int m_currentWidth, m_currentHeight;
    1309     bool isResourceSafe();
    13101309
    13111310#if PLATFORM(COCOA)
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp

    r208740 r208747  
    157157}
    158158
    159 bool GraphicsContext3D::isResourceSafe()
    160 {
    161     return false;
    162 }
    163 
    164159void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer)
    165160{
Note: See TracChangeset for help on using the changeset viewer.