diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-01-05 19:11:16 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-01-05 19:47:10 +0300 |
commit | 8cd6d0fe6876a63b4543bd60da19f1763b663bd8 (patch) | |
tree | 1f0014d492cc615adb12cd3d34c38d53d57a7def /source/blender/render/intern | |
parent | 3c04b44913732665bb607d07b7296b512531eec7 (diff) |
Fix T94169: Missing grease pencil render with tiled rendering
Delay grease pencil for until after the render result is written
to the Blender side.
Differential Revision: https://developer.blender.org/D13740
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/engine.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/render/intern/engine.c b/source/blender/render/intern/engine.c index 797fb79ea47..04f27ff6cbc 100644 --- a/source/blender/render/intern/engine.c +++ b/source/blender/render/intern/engine.c @@ -922,8 +922,10 @@ static void engine_render_view_layer(Render *re, } } - /* Optionally composite grease pencil over render result. */ - if (engine->has_grease_pencil && use_grease_pencil) { + /* Optionally composite grease pencil over render result. + * Only do it if the passes are allocated (and the engine will not override the grease pencil + * when reading its result from EXR file and writing to the Blender side. */ + if (engine->has_grease_pencil && use_grease_pencil && re->result->passes_allocated) { /* NOTE: External engine might have been requested to free its * dependency graph, which is only allowed if there is no grease * pencil (pipeline is taking care of that). */ @@ -1022,10 +1024,18 @@ bool RE_engine_render(Render *re, bool do_all) re->draw_lock(re->dlh, false); } + /* Render view layers. */ + bool delay_grease_pencil = false; + if (type->render) { FOREACH_VIEW_LAYER_TO_RENDER_BEGIN (re, view_layer_iter) { engine_render_view_layer(re, engine, view_layer_iter, true, true); + /* If render passes are not allocated the render engine deferred final pixels write for + * later. Need to defer the grease pencil for until after the engine has written the + * render result to Blender. */ + delay_grease_pencil = engine->has_grease_pencil && !re->result->passes_allocated; + if (RE_engine_test_break(engine)) { break; } @@ -1037,6 +1047,17 @@ bool RE_engine_render(Render *re, bool do_all) type->render_frame_finish(engine); } + /* Perform delayed grease pencil rendering. */ + if (delay_grease_pencil) { + FOREACH_VIEW_LAYER_TO_RENDER_BEGIN (re, view_layer_iter) { + engine_render_view_layer(re, engine, view_layer_iter, false, true); + if (RE_engine_test_break(engine)) { + break; + } + } + FOREACH_VIEW_LAYER_TO_RENDER_END; + } + /* Clear tile data */ engine->flag &= ~RE_ENGINE_RENDERING; |