Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/intern/engine.c
| Show First 20 Lines • Show All 886 Lines • ▼ Show 20 Lines | static void engine_render_view_layer(Render *re, | ||||
| /* Perform render with engine. */ | /* Perform render with engine. */ | ||||
| if (use_engine) { | if (use_engine) { | ||||
| const bool use_gpu_context = (engine->type->flag & RE_USE_GPU_CONTEXT); | const bool use_gpu_context = (engine->type->flag & RE_USE_GPU_CONTEXT); | ||||
| if (use_gpu_context) { | if (use_gpu_context) { | ||||
| DRW_render_context_enable(engine->re); | DRW_render_context_enable(engine->re); | ||||
| } | } | ||||
| BLI_mutex_lock(&engine->re->engine_draw_mutex); | |||||
| re->engine->flag |= RE_ENGINE_CAN_DRAW; | |||||
| BLI_mutex_unlock(&engine->re->engine_draw_mutex); | |||||
| engine->type->render(engine, engine->depsgraph); | engine->type->render(engine, engine->depsgraph); | ||||
| BLI_mutex_lock(&engine->re->engine_draw_mutex); | |||||
| re->engine->flag &= ~RE_ENGINE_CAN_DRAW; | |||||
| BLI_mutex_unlock(&engine->re->engine_draw_mutex); | |||||
| if (use_gpu_context) { | if (use_gpu_context) { | ||||
| DRW_render_context_disable(engine->re); | DRW_render_context_disable(engine->re); | ||||
| } | } | ||||
| } | } | ||||
| /* Optionally composite grease pencil over render result. */ | /* Optionally composite grease pencil over render result. */ | ||||
| if (engine->has_grease_pencil && use_grease_pencil) { | if (engine->has_grease_pencil && use_grease_pencil) { | ||||
| /* NOTE: External engine might have been requested to free its | /* NOTE: External engine might have been requested to free its | ||||
| ▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | void RE_engine_free_blender_memory(RenderEngine *engine) | ||||
| engine_depsgraph_free(engine); | engine_depsgraph_free(engine); | ||||
| } | } | ||||
| struct RenderEngine *RE_engine_get(const Render *re) | struct RenderEngine *RE_engine_get(const Render *re) | ||||
| { | { | ||||
| return re->engine; | return re->engine; | ||||
| } | } | ||||
| bool RE_engine_is_rendering(const Render *re) | bool RE_engine_draw_acquire(Render *re) | ||||
| { | { | ||||
| if (re->engine == NULL) { | BLI_mutex_lock(&re->engine_draw_mutex); | ||||
| RenderEngine *engine = re->engine; | |||||
| if (engine == NULL || engine->type->draw == NULL || (engine->flag & RE_ENGINE_CAN_DRAW) == 0) { | |||||
| BLI_mutex_unlock(&re->engine_draw_mutex); | |||||
| return false; | return false; | ||||
| } | } | ||||
| return re->engine->flag & RE_ENGINE_RENDERING; | |||||
| return true; | |||||
| } | |||||
| void RE_engine_draw_release(Render *re) | |||||
| { | |||||
| BLI_mutex_unlock(&re->engine_draw_mutex); | |||||
| } | } | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name OpenGL context manipulation. | /** \name OpenGL context manipulation. | ||||
| * | * | ||||
| * NOTE: Only used for Cycles's BLenderGPUDisplay integration with the draw manager. A subject | * NOTE: Only used for Cycles's BLenderGPUDisplay integration with the draw manager. A subject | ||||
| * for re-consideration. Do not use this functionality. | * for re-consideration. Do not use this functionality. | ||||
| * \{ */ | * \{ */ | ||||
| Show All 21 Lines | |||||