Fix T87701: debug assert generating scene preview render

This commit is contained in:
Brecht Van Lommel 2021-04-22 15:12:16 +02:00
parent e0852368bc
commit f240b5e5f7
Notes: blender-bot 2023-02-14 09:38:57 +01:00
Referenced by issue #87701, Failed assert when generating scene preview
1 changed files with 3 additions and 6 deletions

View File

@ -143,12 +143,9 @@ RenderEngine *RE_engine_create(RenderEngineType *type)
static void engine_depsgraph_free(RenderEngine *engine)
{
if (engine->depsgraph) {
/* Need GPU context since this might free GPU buffers. This function can
* only be called from a render thread. We do not currently support
* persistent data with GPU contexts for that reason. */
/* Need GPU context since this might free GPU buffers. */
const bool use_gpu_context = (engine->type->flag & RE_USE_GPU_CONTEXT);
if (use_gpu_context) {
BLI_assert(!BLI_thread_is_main());
DRW_render_context_enable(engine->re);
}
@ -623,8 +620,8 @@ RenderData *RE_engine_get_render_data(Render *re)
bool RE_engine_use_persistent_data(RenderEngine *engine)
{
/* See engine_depsgraph_free() for why preserving the depsgraph for
* re-renders is not supported with GPU contexts. */
/* Re-rendering is not supported with GPU contexts, since the GPU context
* is destroyed when the render thread exists. */
return (engine->re->r.mode & R_PERSISTENT_DATA) && !(engine->type->flag & RE_USE_GPU_CONTEXT);
}