Changeset 258875 in webkit


Ignore:
Timestamp:
Mar 23, 2020 2:28:16 PM (4 years ago)
Author:
dino@apple.com
Message:

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

Reviewed by Antoine Quint.

Source/WebCore:

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

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

  • html/canvas/WebGL2RenderingContext.cpp: Wrap any code that does vertexAttrib0

simulation in a !USE(ANGLE).
(WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore::WebGLRenderingContext::initializeVertexArrayObjects):

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
(WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
(WebCore::WebGLRenderingContextBase::validateDrawArrays):
(WebCore::WebGLRenderingContextBase::validateDrawElements):
(WebCore::WebGLRenderingContextBase::drawArrays):
(WebCore::WebGLRenderingContextBase::drawElements):
(WebCore::WebGLRenderingContextBase::getActiveUniform):
(WebCore::WebGLRenderingContextBase::getVertexAttrib):
(WebCore::WebGLRenderingContextBase::vertexAttribfImpl):
(WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):

  • html/canvas/WebGLRenderingContextBase.h:
  • html/canvas/WebGLVertexArrayObjectBase.cpp:

(WebCore::WebGLVertexArrayObjectBase::unbindBuffer):

LayoutTests:

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

  • fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt:
  • fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt:
  • platform/mac/TestExpectations:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r258871 r258875  
     12020-03-23  Dean Jackson  <dino@apple.com>
     2
     3        [WebGL] Skip vertexAttrib0 simulation when using ANGLE
     4        https://bugs.webkit.org/show_bug.cgi?id=209416
     5        <rdar://problem/60765734>
     6
     7        Reviewed by Antoine Quint.
     8
     9        Remove the console logging that is no longer output when using ANGLE.
     10        Remove failing expectations for some tests.
     11
     12        * fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt:
     13        * fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt:
     14        * platform/mac/TestExpectations:
     15
    1162020-03-23  Darin Adler  <darin@apple.com>
    217
  • trunk/LayoutTests/fast/canvas/webgl/index-validation-with-subsequent-draws-expected.txt

    r231441 r258875  
    1 CONSOLE MESSAGE: line 50: WebGL: INVALID_OPERATION: drawElements: unable to simulate vertexAttrib0 array
    2 CONSOLE MESSAGE: line 56: WebGL: INVALID_OPERATION: drawElements: unable to simulate vertexAttrib0 array
    31
  • trunk/LayoutTests/fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays-expected.txt

    r198091 r258875  
    1 CONSOLE MESSAGE: line 30: WebGL: INVALID_OPERATION: drawArrays: attempt to access outside the bounds of the simulated vertexAttrib0 array
    21
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r258514 r258875  
    119119webkit.org/b/189686 webgl/2.0.0/conformance2/buffers/one-large-uniform-buffer.html [ Skip ]
    120120
     121# This test takes a long time to execute in the simulator, since it creates a huge (empty) buffer
     122# to draw lots of nothing.
     123webkit.org/b/209416 fast/canvas/webgl/out-of-bounds-simulated-vertexAttrib0-drawArrays.html [ Pass Timeout ]
     124
    121125imported/w3c/web-platform-tests/css/css-lists/content-property/marker-text-matches-georgian.html [ ImageOnlyFailure ]
    122126imported/w3c/web-platform-tests/css/css-lists/content-property/marker-text-matches-lower-greek.html [ Pass ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r258823 r258875  
    19791979
    19801980webkit.org/b/207858 fast/canvas/webgl/program-test.html [ Failure ]
    1981 webkit.org/b/207858 fast/canvas/webgl/readPixels-float.html [ Failure ]
    1982 webkit.org/b/207858 fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html [ Failure ]
    1983 webkit.org/b/207858 fast/canvas/webgl/webgl2-texture-upload-enums.html [ Failure ]
    19841981webkit.org/b/207858 webgl/1.0.3/conformance/programs/program-test.html [ Failure ]
    19851982
  • trunk/Source/WebCore/ChangeLog

    r258871 r258875  
     12020-03-23  Dean Jackson  <dino@apple.com>
     2
     3        [WebGL] Skip vertexAttrib0 simulation when using ANGLE
     4        https://bugs.webkit.org/show_bug.cgi?id=209416
     5        <rdar://problem/60765734>
     6
     7        Reviewed by Antoine Quint.
     8
     9        When using ANGLE as a backend, we do not need to simulate a
     10        missing vertexAttrib0 at the WebGL layer, since ANGLE will
     11        handle it for us.
     12
     13        This causes a couple of tests to begin passing (they were marked as
     14        failures). It also allows us to re-land r258025, which was rolled
     15        out in r258226.
     16
     17        * html/canvas/WebGL2RenderingContext.cpp: Wrap any code that does vertexAttrib0
     18        simulation in a !USE(ANGLE).
     19        (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
     20        * html/canvas/WebGLRenderingContext.cpp:
     21        (WebCore::WebGLRenderingContext::initializeVertexArrayObjects):
     22        * html/canvas/WebGLRenderingContextBase.cpp:
     23        (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
     24        (WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
     25        (WebCore::WebGLRenderingContextBase::validateDrawArrays):
     26        (WebCore::WebGLRenderingContextBase::validateDrawElements):
     27        (WebCore::WebGLRenderingContextBase::drawArrays):
     28        (WebCore::WebGLRenderingContextBase::drawElements):
     29        (WebCore::WebGLRenderingContextBase::getActiveUniform):
     30        (WebCore::WebGLRenderingContextBase::getVertexAttrib):
     31        (WebCore::WebGLRenderingContextBase::vertexAttribfImpl):
     32        (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
     33        * html/canvas/WebGLRenderingContextBase.h:
     34        * html/canvas/WebGLVertexArrayObjectBase.cpp:
     35        (WebCore::WebGLVertexArrayObjectBase::unbindBuffer):
     36
    1372020-03-23  Darin Adler  <darin@apple.com>
    238
  • trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp

    r258478 r258875  
    121121    bindVertexArray(nullptr); // The default VAO was removed in OpenGL 3.3 but not from WebGL 2; bind the default for WebGL to use.
    122122#endif
     123#if !USE(ANGLE)
    123124    if (!isGLES2Compliant())
    124125        initVertexAttrib0();
     126#endif
    125127}
    126128
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r256697 r258875  
    108108    addContextObject(*m_defaultVertexArrayObject);
    109109    m_boundVertexArrayObject = m_defaultVertexArrayObject;
     110#if !USE(ANGLE)
    110111    if (!isGLES2Compliant())
    111112        initVertexAttrib0();
     113#endif
    112114}
    113115
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r257799 r258875  
    859859    m_defaultVertexArrayObject = nullptr;
    860860    m_boundVertexArrayObject = nullptr;
     861#if !USE(ANGLE)
    861862    m_vertexAttrib0Buffer = nullptr;
     863#endif
    862864    m_currentProgram = nullptr;
    863865    m_framebufferBinding = nullptr;
     
    19631965    state.enabled = false;
    19641966
     1967#if !USE(ANGLE)
    19651968    if (index > 0 || isGLES2Compliant())
     1969#endif
    19661970        m_context->disableVertexAttribArray(index);
    19671971}
     
    21772181        return false;
    21782182    }
     2183#if !USE(ANGLE)
    21792184    if (!validateSimulatedVertexAttrib0(checkedSum.unsafeGet() - 1)) {
    21802185        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
    21812186        return false;
    21822187    }
     2188#endif
    21832189
    21842190    const char* reason = "framebuffer incomplete";
     
    22552261    }
    22562262
     2263#if !USE(ANGLE)
    22572264    if (!validateSimulatedVertexAttrib0(numElements)) {
    22582265        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
    22592266        return false;
    22602267    }
     2268#endif
    22612269   
    22622270    const char* reason = "framebuffer incomplete";
     
    22792287    clearIfComposited();
    22802288
     2289#if !USE(ANGLE)
    22812290    bool vertexAttrib0Simulated = false;
    22822291    if (!isGLES2Compliant()) {
     
    22892298        vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
    22902299    }
     2300#endif
    22912301    bool usesFallbackTexture = false;
    22922302    if (!isGLES2NPOTStrict())
     
    22992309    }
    23002310
     2311#if !USE(ANGLE)
    23012312    if (!isGLES2Compliant() && vertexAttrib0Simulated)
    23022313        restoreStatesAfterVertexAttrib0Simulation();
     2314#endif
    23032315    if (usesFallbackTexture)
    23042316        checkTextureCompleteness("drawArrays", false);
     
    23372349        if (!numElements)
    23382350            validateIndexArrayPrecise(count, type, static_cast<GCGLintptr>(offset), numElements);
     2351#if !USE(ANGLE)
    23392352        auto simulateVertexAttrib0Status = simulateVertexAttrib0(numElements);
    23402353        if (!simulateVertexAttrib0Status) {
     
    23442357        }
    23452358        vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
     2359#endif
    23462360    }
    23472361
     
    23612375    }
    23622376
     2377#if !USE(ANGLE)
    23632378    if (!isGLES2Compliant() && vertexAttrib0Simulated)
    23642379        restoreStatesAfterVertexAttrib0Simulation();
     2380#else
     2381    UNUSED_VARIABLE(vertexAttrib0Simulated);
     2382#endif
    23652383    if (usesFallbackTexture)
    23662384        checkTextureCompleteness("drawElements", false);
     
    25482566    if (!m_context->getActiveUniform(objectOrZero(program), index, info))
    25492567        return nullptr;
     2568    // FIXME: Do we still need this for the ANGLE backend?
    25502569    if (!isGLES2Compliant())
    25512570        if (info.size > 1 && !info.name.endsWith("[0]"))
     
    30503069    switch (pname) {
    30513070    case GraphicsContextGL::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
     3071#if !USE(ANGLE)
    30523072        if ((!isGLES2Compliant() && !index && m_boundVertexArrayObject->getVertexAttribState(0).bufferBinding == m_vertexAttrib0Buffer)
    30533073            || !state.bufferBinding
    30543074            || !state.bufferBinding->object())
    30553075            return nullptr;
     3076#endif
    30563077        return state.bufferBinding;
    30573078    case GraphicsContextGL::VERTEX_ATTRIB_ARRAY_ENABLED:
     
    61106131        return;
    61116132    }
     6133#if !USE(ANGLE)
    61126134    // In GL, we skip setting vertexAttrib0 values.
    6113     if (index || isGLES2Compliant()) {
     6135    if (index || isGLES2Compliant())
     6136#endif
     6137    {
    61146138        switch (expectedSize) {
    61156139        case 1:
     
    61546178        return;
    61556179    }
     6180#if !USE(ANGLE)
    61566181    // In GL, we skip setting vertexAttrib0 values.
    6157     if (index || isGLES2Compliant()) {
     6182    if (index || isGLES2Compliant())
     6183#endif
     6184    {
    61586185        switch (expectedSize) {
    61596186        case 1:
     
    61776204}
    61786205
     6206#if !USE(ANGLE)
    61796207void WebGLRenderingContextBase::initVertexAttrib0()
    61806208{
     
    62896317    m_context->bindBuffer(GraphicsContextGL::ARRAY_BUFFER, objectOrZero(m_boundArrayBuffer.get()));
    62906318}
     6319#endif
    62916320
    62926321void WebGLRenderingContextBase::dispatchContextLostEvent()
     
    65596588    clearIfComposited();
    65606589
     6590#if !USE(ANGLE)
    65616591    bool vertexAttrib0Simulated = false;
    65626592    if (!isGLES2Compliant()) {
     
    65696599        vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
    65706600    }
     6601#endif
    65716602    if (!isGLES2NPOTStrict())
    65726603        checkTextureCompleteness("drawArraysInstanced", true);
     
    65746605    m_context->drawArraysInstanced(mode, first, count, primcount);
    65756606
     6607#if !USE(ANGLE)
    65766608    if (!isGLES2Compliant() && vertexAttrib0Simulated)
    65776609        restoreStatesAfterVertexAttrib0Simulation();
     6610#endif
    65786611    if (!isGLES2NPOTStrict())
    65796612        checkTextureCompleteness("drawArraysInstanced", false);
     
    65986631        if (!numElements)
    65996632            validateIndexArrayPrecise(count, type, static_cast<GCGLintptr>(offset), numElements);
     6633#if !USE(ANGLE)
    66006634        auto simulateVertexAttrib0Status = simulateVertexAttrib0(numElements);
    66016635        if (!simulateVertexAttrib0Status) {
     
    66056639        }
    66066640        vertexAttrib0Simulated = simulateVertexAttrib0Status.value();
     6641#endif
    66076642    }
    66086643    if (!isGLES2NPOTStrict())
     
    66166651    m_context->drawElementsInstanced(mode, count, type, static_cast<GCGLintptr>(offset), primcount);
    66176652
     6653#if !USE(ANGLE)
    66186654    if (!isGLES2Compliant() && vertexAttrib0Simulated)
    66196655        restoreStatesAfterVertexAttrib0Simulation();
     6656#else
     6657    UNUSED_VARIABLE(vertexAttrib0Simulated);
     6658#endif
    66206659    if (!isGLES2NPOTStrict())
    66216660        checkTextureCompleteness("drawElementsInstanced", false);
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h

    r257799 r258875  
    513513    Vector<VertexAttribValue> m_vertexAttribValue;
    514514    unsigned m_maxVertexAttribs;
     515#if !USE(ANGLE)
    515516    RefPtr<WebGLBuffer> m_vertexAttrib0Buffer;
    516517    long m_vertexAttrib0BufferSize { 0 };
     
    518519    bool m_forceAttrib0BufferRefill { true };
    519520    bool m_vertexAttrib0UsedBefore { false };
     521#endif
    520522
    521523    RefPtr<WebGLProgram> m_currentProgram;
     
    821823    bool validateAndCacheBufferBinding(const char* functionName, GCGLenum target, WebGLBuffer*);
    822824
     825#if !USE(ANGLE)
    823826    // Helpers for simulating vertexAttrib0.
    824827    void initVertexAttrib0();
     
    826829    bool validateSimulatedVertexAttrib0(GCGLuint numVertex);
    827830    void restoreStatesAfterVertexAttrib0Simulation();
     831#endif
    828832
    829833    // Wrapper for GraphicsContextGLOpenGL::synthesizeGLError that sends a message to the JavaScript console.
  • trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp

    r254214 r258875  
    8383            buffer.onDetached(context()->graphicsContextGL());
    8484           
     85#if !USE(ANGLE)
    8586            if (!i && !context()->isGLES2Compliant()) {
    8687                state.bufferBinding = context()->m_vertexAttrib0Buffer;
     
    9495                state.offset = 0;
    9596            } else
     97#endif
    9698                state.bufferBinding = nullptr;
    9799        }
Note: See TracChangeset for help on using the changeset viewer.