Blender Git Commit Log

Git Commits -> Revision 85f060d

Revision 85f060d by Sergey Sharybin (cycles-x)
September 17, 2021, 08:14 (GMT)
Fix race condition between draw and render threads

Caused crashes like the one William was fixing in the D12498, or the
crash when rendering multiple view layers.

Need to guarantee that the render engine is not freed during drawing,
and that the external engine is not in the middle of re-allocation due
to `update()` which might cause session reset (happens in Cycles).

Had to introduce a separate lock. The reason for this comes from the
fact that we need to acquire the engine early on in the draw manager,
and release it only when drawing is done. However, some other engines
(like overlay) might be requesting ImBuf for the image space, so that
they know dimensions. Such acquisition is guarded by the resultmutex.
This means reusing `resultmutex` for the `RenderEngine::draw()` would
cause a recursive lock.

Not entirely happy with implicit release in the external engine code,
but not sure there is an existing way of making it explicit without
introducing new draw engine callback.

Differential Revision: https://developer.blender.org/D12521

Commit Details:

Full Hash: 85f060dc94f141c195ec01fe68725807f4eb7908
Parent Commit: ca9ece3
Lines Changed: +59, -47

7 Modified Paths:

/source/blender/draw/engines/external/external_engine.c (+15, -40) (Diff)
/source/blender/draw/engines/external/external_engine.h (+6, -2) (Diff)
/source/blender/draw/intern/draw_manager.c (+1, -1) (Diff)
/source/blender/render/intern/engine.c (+22, -3) (Diff)
/source/blender/render/intern/pipeline.c (+2, -0) (Diff)
/source/blender/render/intern/render_types.h (+3, -0) (Diff)
/source/blender/render/RE_engine.h (+10, -1) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021