Depsgraph: Cleanup, promote is_evaluating query

This way it might be used for sanity checks in RNA API as well.
This commit is contained in:
Sergey Sharybin 2019-10-10 11:03:58 +02:00
parent f9b7f3e930
commit c9d6eb4fb4
6 changed files with 14 additions and 14 deletions

View File

@ -1952,7 +1952,7 @@ Mesh *mesh_get_eval_final(struct Depsgraph *depsgraph,
const CustomData_MeshMasks *dataMask)
{
/* This function isn't thread-safe and can't be used during evaluation. */
BLI_assert(DEG_debug_is_evaluating(depsgraph) == false);
BLI_assert(DEG_is_evaluating(depsgraph) == false);
/* Evaluated meshes aren't supposed to be created on original instances. If you do,
* they aren't cleaned up properly on mode switch, causing crashes, e.g T58150. */
@ -1985,7 +1985,7 @@ Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph,
const CustomData_MeshMasks *dataMask)
{
/* This function isn't thread-safe and can't be used during evaluation. */
BLI_assert(DEG_debug_is_evaluating(depsgraph) == false);
BLI_assert(DEG_is_evaluating(depsgraph) == false);
/* Evaluated meshes aren't supposed to be created on original instances. If you do,
* they aren't cleaned up properly on mode switch, causing crashes, e.g T58150. */

View File

@ -179,14 +179,14 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG_EditorUpdateSce
/* Evaluation ----------------------------------- */
bool DEG_is_evaluating(struct Depsgraph *depsgraph);
bool DEG_is_active(const struct Depsgraph *depsgraph);
void DEG_make_active(struct Depsgraph *depsgraph);
void DEG_make_inactive(struct Depsgraph *depsgraph);
/* Evaluation Debug ------------------------------ */
bool DEG_debug_is_evaluating(struct Depsgraph *depsgraph);
void DEG_debug_print_begin(struct Depsgraph *depsgraph);
void DEG_debug_print_eval(struct Depsgraph *depsgraph,

View File

@ -76,7 +76,7 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati
ctime(BKE_scene_frame_get(scene)),
scene_cow(NULL),
is_active(false),
debug_is_evaluating(false),
is_evaluating(false),
is_render_pipeline_depsgraph(false)
{
BLI_spin_init(&lock);
@ -334,6 +334,12 @@ void DEG_graph_free(Depsgraph *graph)
OBJECT_GUARDED_DELETE(deg_depsgraph, Depsgraph);
}
bool DEG_is_evaluating(struct Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
return deg_graph->is_evaluating;
}
bool DEG_is_active(const struct Depsgraph *depsgraph)
{
if (depsgraph == NULL) {

View File

@ -198,7 +198,7 @@ struct Depsgraph {
int debug_flags;
string debug_name;
bool debug_is_evaluating;
bool is_evaluating;
/* Is set to truth for dependency graph which are used for post-processing (compositor and
* sequencer).

View File

@ -246,12 +246,6 @@ void DEG_stats_simple(const Depsgraph *graph,
}
}
bool DEG_debug_is_evaluating(struct Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
return deg_graph->debug_is_evaluating;
}
static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
{
const char *name = DEG_debug_name_get(depsgraph);

View File

@ -257,7 +257,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph)
}
const bool do_time_debug = ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0);
const double start_time = do_time_debug ? PIL_check_seconds_timer() : 0;
graph->debug_is_evaluating = true;
graph->is_evaluating = true;
depsgraph_ensure_view_layer(graph);
/* Set up evaluation state. */
DepsgraphEvalState state;
@ -298,7 +298,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph)
if (need_free_scheduler) {
BLI_task_scheduler_free(task_scheduler);
}
graph->debug_is_evaluating = false;
graph->is_evaluating = false;
if (do_time_debug) {
printf("Depsgraph updated in %f seconds.\n", PIL_check_seconds_timer() - start_time);
}