⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280929 in webkit


Ignore:
Timestamp:
Aug 11, 2021, 1:35:31 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r280926. rdar://problem/81810533

Avoid infinite recursion when command buffer creation fails
https://bugs.webkit.org/show_bug.cgi?id=228978
<rdar://79224824>

Reviewed by Kenneth Russell.

In cases where the MTLCommandBuffer is not a valid metal object,
we can end up in an infinite recursive loop during draw call setup. Refactor setupDraw to take no more than two attempts through the setup function.

Testing: Ran WebGL tests, use case samples. Set up synthetic
repro forcing bail out path, saw WebGL content fail to render
instead of a web process crash.

  • src/libANGLE/renderer/metal/ContextMtl.h:
  • src/libANGLE/renderer/metal/ContextMtl.mm: (rx::ContextMtl::setupDraw): (rx::ContextMtl::setupDrawImpl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280926 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.1.27.0-branch/Source/ThirdParty/ANGLE
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.1.27.0-branch/Source/ThirdParty/ANGLE/ChangeLog

    r280349 r280929  
     12021-08-11  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r280926. rdar://problem/81810533
     4
     5    Avoid infinite recursion when command buffer creation fails
     6    https://bugs.webkit.org/show_bug.cgi?id=228978
     7    <rdar://79224824>
     8   
     9    Reviewed by Kenneth Russell.
     10   
     11    In cases where the MTLCommandBuffer is not a valid metal object,
     12    we can end up in an infinite recursive loop during draw call setup. Refactor setupDraw to take no more than two attempts through the setup function.
     13   
     14    Testing: Ran WebGL tests, use case samples. Set up synthetic
     15    repro forcing bail out path, saw WebGL content fail to render
     16    instead of a web process crash.
     17   
     18    * src/libANGLE/renderer/metal/ContextMtl.h:
     19    * src/libANGLE/renderer/metal/ContextMtl.mm:
     20    (rx::ContextMtl::setupDraw):
     21    (rx::ContextMtl::setupDrawImpl):
     22   
     23   
     24    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     25
     26    2021-08-11  Kyle Piddington  <kpiddington@apple.com>
     27
     28            Avoid infinite recursion when command buffer creation fails
     29            https://bugs.webkit.org/show_bug.cgi?id=228978
     30            <rdar://79224824>
     31
     32            Reviewed by Kenneth Russell.
     33
     34            In cases where the MTLCommandBuffer is not a valid metal object,
     35            we can end up in an infinite recursive loop during draw call setup. Refactor setupDraw to take no more than two attempts through the setup function.
     36
     37            Testing: Ran WebGL tests, use case samples. Set up synthetic
     38            repro forcing bail out path, saw WebGL content fail to render
     39            instead of a web process crash.
     40
     41            * src/libANGLE/renderer/metal/ContextMtl.h:
     42            * src/libANGLE/renderer/metal/ContextMtl.mm:
     43            (rx::ContextMtl::setupDraw):
     44            (rx::ContextMtl::setupDrawImpl):
     45
    1462021-07-23  Dean Jackson  <dino@apple.com>
    247
  • branches/safari-612.1.27.0-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.h

    r278335 r280929  
    382382                            const void *indices,
    383383                            bool transformFeedbackDraw);
     384    angle::Result setupDrawImpl(const gl::Context *context,
     385                            gl::PrimitiveMode mode,
     386                            GLint firstVertex,
     387                            GLsizei vertexOrIndexCount,
     388                            GLsizei instanceCount,
     389                            gl::DrawElementsType indexTypeOrNone,
     390                            const void *indices,
     391                            bool transformFeedbackDraw);
    384392
    385393    angle::Result drawTriFanArrays(const gl::Context *context,
  • branches/safari-612.1.27.0-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm

    r279251 r280929  
    21212121                                    bool transformFeedbackDraw)
    21222122{
     2123    ANGLE_TRY(setupDrawImpl(context, mode, firstVertex, vertexOrIndexCount, instances, indexTypeOrNone, indices, transformFeedbackDraw));
     2124    // Setting up the draw required us to call a command buffer flush, re-run setupDraw with state invaliated to restart the command buffer from the current draw with previously set state
     2125    if (!mCmdBuffer.valid())
     2126    {
     2127        invalidateState(context);
     2128        ANGLE_TRY(setupDrawImpl(context, mode, firstVertex, vertexOrIndexCount, instances, indexTypeOrNone, indices, transformFeedbackDraw));
     2129    }
     2130    // If the command buffer still isn't valid after a second attempt, we have a problem and should stop the draw call to avoid infinite recursion.
     2131    if(!mCmdBuffer.valid())
     2132    {
     2133        return angle::Result::Stop;
     2134    }
     2135    return angle::Result::Continue;
     2136   
     2137}
     2138angle::Result ContextMtl::setupDrawImpl(const gl::Context *context,
     2139                                    gl::PrimitiveMode mode,
     2140                                    GLint firstVertex,
     2141                                    GLsizei vertexOrIndexCount,
     2142                                    GLsizei instances,
     2143                                    gl::DrawElementsType indexTypeOrNone,
     2144                                    const void *indices,
     2145                                    bool transformFeedbackDraw)
     2146{
    21232147    ASSERT(mProgram);
    21242148
     
    22502274                                  uniformBuffersDirty, transformFeedbackDraw));
    22512275
    2252     // Setting up the draw required us to call a command buffer flush, re-run setupDraw with state invaliated to restart the command buffer from the current draw with previously set state
    2253     if (!mCmdBuffer.valid())
    2254     {
    2255         invalidateState(context);
    2256         ANGLE_TRY(setupDraw(context, mode, firstVertex, vertexOrIndexCount, instances, indexTypeOrNone, indices, transformFeedbackDraw));
    2257     }
     2276 
    22582277    mDirtyBits.reset();
    22592278    return angle::Result::Continue;
Note: See TracChangeset for help on using the changeset viewer.