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

Changeset 294892 in webkit


Ignore:
Timestamp:
May 26, 2022, 1:06:56 PM (4 years ago)
Author:
Alan Coon
Message:

Cherry-pick r294877. rdar://problem/93834054

Uniform buffer reuse causes flush, creates invalid state
​https://bugs.webkit.org/show_bug.cgi?id=240896

Patch by Kimmo Kinnunen <​kkinnunen@apple.com> on 2022-05-26
Patch by Kyle Piddington.

Reviewed by Kimmo Kinnunen.

A flush during draw setup would leave the render command encoder
not started and render pipeline unset. This would assert in debug
and leak memory with corrupted draws in release.

This would happen for example when uniform buffer pool would run
out of uniform memory. If the pool is maxed out, we flush the
existing rendering to obtain free buffers. After the flush,
we need to re-run the setup.

Test is tracked in bug 240948.

  • Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm: (rx::ContextMtl::setupDraw): (rx::ContextMtl::setupDrawImpl):

Canonical link: ​https://commits.webkit.org/251007@main

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-7614.1.14.1-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm

    r293513 r294892  
    22232223                                    bool xfbPass)
    22242224{
     2225    ANGLE_TRY(setupDrawImpl(context, mode, firstVertex, vertexOrIndexCount, instances,
     2226                            indexTypeOrNone, indices, xfbPass));
     2227    if (!mRenderEncoder.valid())
     2228    {
     2229        // Flush occurred during setup, due to running out of memory while setting up the render
     2230        // pass state. This would happen for example when there is no more space in the uniform
     2231        // buffers in the uniform buffer pool. The rendering would be flushed to free the uniform
     2232        // buffer memory for new usage. In this case, re-run the setup.
     2233        ANGLE_TRY(setupDrawImpl(context, mode, firstVertex, vertexOrIndexCount, instances,
     2234                                indexTypeOrNone, indices, xfbPass));
     2235        // Setup with flushed state should either produce a working encoder or fail with an error
     2236        // result.
     2237        ASSERT(mRenderEncoder.valid());
     2238    }
     2239    return angle::Result::Continue;
     2240}
     2241
     2242angle::Result ContextMtl::setupDrawImpl(const gl::Context *context,
     2243                                        gl::PrimitiveMode mode,
     2244                                        GLint firstVertex,
     2245                                        GLsizei vertexOrIndexCount,
     2246                                        GLsizei instances,
     2247                                        gl::DrawElementsType indexTypeOrNone,
     2248                                        const void *indices,
     2249                                        bool xfbPass)
     2250{
    22252251    ASSERT(mProgram);
    22262252
Note: See TracChangeset for help on using the changeset viewer.