Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2013 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup depsgraph
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
*
|
2020-09-09 13:19:50 +10:00
|
|
|
* Evaluation engine entry-points for Depsgraph Engine.
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "intern/eval/deg_eval.h"
|
|
|
|
|
|
|
|
|
|
#include "PIL_time.h"
|
|
|
|
|
|
2019-01-31 19:57:47 +01:00
|
|
|
#include "BLI_compiler_attrs.h"
|
2020-01-07 13:49:42 +01:00
|
|
|
#include "BLI_gsqueue.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_task.h"
|
|
|
|
|
#include "BLI_utildefines.h"
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
2019-01-31 12:56:40 +01:00
|
|
|
#include "BKE_global.h"
|
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_node_types.h"
|
2017-07-21 11:53:13 +02:00
|
|
|
#include "DNA_object_types.h"
|
2018-04-25 15:02:22 +02:00
|
|
|
#include "DNA_scene_types.h"
|
2017-07-21 11:53:13 +02:00
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
2017-07-21 11:53:13 +02:00
|
|
|
#include "DEG_depsgraph_query.h"
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
|
|
|
|
#include "atomic_ops.h"
|
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "intern/depsgraph.h"
|
|
|
|
|
#include "intern/depsgraph_relation.h"
|
2018-04-25 15:02:22 +02:00
|
|
|
#include "intern/eval/deg_eval_copy_on_write.h"
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
#include "intern/eval/deg_eval_flush.h"
|
2017-12-21 16:14:15 +01:00
|
|
|
#include "intern/eval/deg_eval_stats.h"
|
2019-01-31 12:56:40 +01:00
|
|
|
#include "intern/node/deg_node.h"
|
|
|
|
|
#include "intern/node/deg_node_component.h"
|
|
|
|
|
#include "intern/node/deg_node_id.h"
|
|
|
|
|
#include "intern/node/deg_node_operation.h"
|
|
|
|
|
#include "intern/node/deg_node_time.h"
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
2020-06-29 15:19:56 +02:00
|
|
|
namespace blender::deg {
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
namespace {
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
2020-01-07 13:49:42 +01:00
|
|
|
struct DepsgraphEvalState;
|
|
|
|
|
|
2020-04-30 07:59:23 +02:00
|
|
|
void deg_task_run_func(TaskPool *pool, void *taskdata);
|
2020-01-07 13:49:42 +01:00
|
|
|
|
|
|
|
|
template<typename ScheduleFunction, typename... ScheduleFunctionArgs>
|
|
|
|
|
void schedule_children(DepsgraphEvalState *state,
|
|
|
|
|
OperationNode *node,
|
|
|
|
|
ScheduleFunction *schedule_function,
|
|
|
|
|
ScheduleFunctionArgs... schedule_function_args);
|
|
|
|
|
|
2020-04-30 07:59:23 +02:00
|
|
|
void schedule_node_to_pool(OperationNode *node, const int UNUSED(thread_id), TaskPool *pool)
|
2020-01-07 13:49:42 +01:00
|
|
|
{
|
2020-04-30 07:59:23 +02:00
|
|
|
BLI_task_pool_push(pool, deg_task_run_func, node, false, nullptr);
|
2020-01-07 13:49:42 +01:00
|
|
|
}
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
|
2020-01-07 12:04:26 +01:00
|
|
|
/* Denotes which part of dependency graph is being evaluated. */
|
|
|
|
|
enum class EvaluationStage {
|
|
|
|
|
/* Stage 1: Only Copy-on-Write operations are to be evaluated, prior to anything else.
|
|
|
|
|
* This allows other operations to access its dependencies when there is a dependency cycle
|
|
|
|
|
* involved. */
|
|
|
|
|
COPY_ON_WRITE,
|
|
|
|
|
|
2020-01-07 12:25:16 +01:00
|
|
|
/* Threaded evaluation of all possible operations. */
|
2020-01-07 12:04:26 +01:00
|
|
|
THREADED_EVALUATION,
|
2020-01-07 13:49:42 +01:00
|
|
|
|
|
|
|
|
/* Workaround for areas which can not be evaluated in threads.
|
|
|
|
|
*
|
2020-08-19 11:42:12 +10:00
|
|
|
* For example, meta-balls, which are iterating over all bases and are requesting dupli-lists
|
|
|
|
|
* to see whether there are meta-balls inside. */
|
2020-01-07 13:49:42 +01:00
|
|
|
SINGLE_THREADED_WORKAROUND,
|
2020-01-07 12:04:26 +01:00
|
|
|
};
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
struct DepsgraphEvalState {
|
|
|
|
|
Depsgraph *graph;
|
2017-12-21 16:14:15 +01:00
|
|
|
bool do_stats;
|
2020-01-07 12:04:26 +01:00
|
|
|
EvaluationStage stage;
|
2020-01-07 13:49:42 +01:00
|
|
|
bool need_single_thread_pass;
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
};
|
|
|
|
|
|
2020-01-07 13:49:42 +01:00
|
|
|
void evaluate_node(const DepsgraphEvalState *state, OperationNode *operation_node)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
2020-01-07 13:49:42 +01:00
|
|
|
::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph *>(state->graph);
|
|
|
|
|
|
2017-12-21 12:24:51 +01:00
|
|
|
/* Sanity checks. */
|
2020-01-07 13:49:42 +01:00
|
|
|
BLI_assert(!operation_node->is_noop() && "NOOP nodes should not actually be scheduled");
|
2017-12-21 12:24:51 +01:00
|
|
|
/* Perform operation. */
|
2017-12-21 16:14:15 +01:00
|
|
|
if (state->do_stats) {
|
|
|
|
|
const double start_time = PIL_check_seconds_timer();
|
2020-01-07 13:49:42 +01:00
|
|
|
operation_node->evaluate(depsgraph);
|
|
|
|
|
operation_node->stats.current_time += PIL_check_seconds_timer() - start_time;
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
2017-12-21 16:14:15 +01:00
|
|
|
else {
|
2020-01-07 13:49:42 +01:00
|
|
|
operation_node->evaluate(depsgraph);
|
2017-12-21 16:14:15 +01:00
|
|
|
}
|
2020-01-07 13:49:42 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-30 07:59:23 +02:00
|
|
|
void deg_task_run_func(TaskPool *pool, void *taskdata)
|
2020-01-07 13:49:42 +01:00
|
|
|
{
|
2020-04-21 15:36:35 +02:00
|
|
|
void *userdata_v = BLI_task_pool_user_data(pool);
|
2020-01-07 13:49:42 +01:00
|
|
|
DepsgraphEvalState *state = (DepsgraphEvalState *)userdata_v;
|
|
|
|
|
|
|
|
|
|
/* Evaluate node. */
|
|
|
|
|
OperationNode *operation_node = reinterpret_cast<OperationNode *>(taskdata);
|
|
|
|
|
evaluate_node(state, operation_node);
|
|
|
|
|
|
2017-12-21 12:24:51 +01:00
|
|
|
/* Schedule children. */
|
2020-04-30 07:59:23 +02:00
|
|
|
schedule_children(state, operation_node, schedule_node_to_pool, pool);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
bool check_operation_node_visible(OperationNode *op_node)
|
2018-08-23 16:17:06 +02:00
|
|
|
{
|
2019-01-31 12:56:40 +01:00
|
|
|
const ComponentNode *comp_node = op_node->owner;
|
2018-08-23 16:17:06 +02:00
|
|
|
/* Special exception, copy on write component is to be always evaluated,
|
2019-01-31 12:56:40 +01:00
|
|
|
* to keep copied "database" in a consistent state. */
|
|
|
|
|
if (comp_node->type == NodeType::COPY_ON_WRITE) {
|
2018-08-23 16:17:06 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2018-09-19 15:21:51 +02:00
|
|
|
return comp_node->affects_directly_visible;
|
2018-08-23 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
void calculate_pending_parents_for_node(OperationNode *node)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
2018-08-23 16:17:06 +02:00
|
|
|
/* Update counters, applies for both visible and invisible IDs. */
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
node->num_links_pending = 0;
|
|
|
|
|
node->scheduled = false;
|
2018-08-23 16:17:06 +02:00
|
|
|
/* Invisible IDs requires no pending operations. */
|
|
|
|
|
if (!check_operation_node_visible(node)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* No need to bother with anything if node is not tagged for update. */
|
|
|
|
|
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-01-31 12:56:40 +01:00
|
|
|
for (Relation *rel : node->inlinks) {
|
|
|
|
|
if (rel->from->type == NodeType::OPERATION && (rel->flag & RELATION_FLAG_CYCLIC) == 0) {
|
|
|
|
|
OperationNode *from = (OperationNode *)rel->from;
|
2018-08-23 16:17:06 +02:00
|
|
|
/* TODO(sergey): This is how old layer system was checking for the
|
|
|
|
|
* calculation, but how is it possible that visible object depends
|
|
|
|
|
* on an invisible? This is something what is prohibited after
|
2019-01-31 12:56:40 +01:00
|
|
|
* deg_graph_build_flush_layers(). */
|
2018-08-23 16:17:06 +02:00
|
|
|
if (!check_operation_node_visible(from)) {
|
|
|
|
|
continue;
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
2019-10-08 11:12:30 +02:00
|
|
|
/* No need to wait for operation which is up to date. */
|
2018-08-23 16:17:06 +02:00
|
|
|
if ((from->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
++node->num_links_pending;
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
void calculate_pending_parents(Depsgraph *graph)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
2019-10-08 11:34:07 +02:00
|
|
|
for (OperationNode *node : graph->operations) {
|
|
|
|
|
calculate_pending_parents_for_node(node);
|
|
|
|
|
}
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph)
|
2017-12-21 12:32:32 +01:00
|
|
|
{
|
2017-12-21 16:14:15 +01:00
|
|
|
const bool do_stats = state->do_stats;
|
2017-12-21 16:36:02 +01:00
|
|
|
calculate_pending_parents(graph);
|
2017-12-21 12:32:32 +01:00
|
|
|
/* Clear tags and other things which needs to be clear. */
|
2019-01-31 12:56:40 +01:00
|
|
|
for (OperationNode *node : graph->operations) {
|
2017-12-21 16:14:15 +01:00
|
|
|
if (do_stats) {
|
|
|
|
|
node->stats.reset_current();
|
|
|
|
|
}
|
2017-12-21 12:32:32 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-07 13:49:42 +01:00
|
|
|
bool is_metaball_object_operation(const OperationNode *operation_node)
|
|
|
|
|
{
|
|
|
|
|
const ComponentNode *component_node = operation_node->owner;
|
|
|
|
|
const IDNode *id_node = component_node->owner;
|
|
|
|
|
if (GS(id_node->id_cow->name) != ID_OB) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const Object *object = reinterpret_cast<const Object *>(id_node->id_cow);
|
|
|
|
|
return object->type == OB_MBALL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool need_evaluate_operation_at_stage(DepsgraphEvalState *state,
|
2020-01-07 12:04:26 +01:00
|
|
|
const OperationNode *operation_node)
|
|
|
|
|
{
|
|
|
|
|
const ComponentNode *component_node = operation_node->owner;
|
|
|
|
|
switch (state->stage) {
|
|
|
|
|
case EvaluationStage::COPY_ON_WRITE:
|
|
|
|
|
return (component_node->type == NodeType::COPY_ON_WRITE);
|
|
|
|
|
|
|
|
|
|
case EvaluationStage::THREADED_EVALUATION:
|
|
|
|
|
/* Sanity check: copy-on-write node should be evaluated already. This will be indicated by
|
|
|
|
|
* scheduled flag (we assume that scheduled operations have been actually handled by previous
|
|
|
|
|
* stage). */
|
|
|
|
|
BLI_assert(operation_node->scheduled || component_node->type != NodeType::COPY_ON_WRITE);
|
2020-01-07 13:49:42 +01:00
|
|
|
if (is_metaball_object_operation(operation_node)) {
|
|
|
|
|
state->need_single_thread_pass = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case EvaluationStage::SINGLE_THREADED_WORKAROUND:
|
2020-01-07 12:04:26 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
BLI_assert(!"Unhandled evaluation stage, should never happen.");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
/* Schedule a node if it needs evaluation.
|
|
|
|
|
* dec_parents: Decrement pending parents count, true when child nodes are
|
|
|
|
|
* scheduled after a task has been completed.
|
|
|
|
|
*/
|
2020-01-07 13:49:42 +01:00
|
|
|
template<typename ScheduleFunction, typename... ScheduleFunctionArgs>
|
|
|
|
|
void schedule_node(DepsgraphEvalState *state,
|
|
|
|
|
OperationNode *node,
|
|
|
|
|
bool dec_parents,
|
|
|
|
|
ScheduleFunction *schedule_function,
|
|
|
|
|
ScheduleFunctionArgs... schedule_function_args)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
2018-08-23 16:17:06 +02:00
|
|
|
/* No need to schedule nodes of invisible ID. */
|
|
|
|
|
if (!check_operation_node_visible(node)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* No need to schedule operations which are not tagged for update, they are
|
2019-01-31 12:56:40 +01:00
|
|
|
* considered to be up to date. */
|
2018-08-23 16:17:06 +02:00
|
|
|
if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* TODO(sergey): This is not strictly speaking safe to read
|
2019-01-31 12:56:40 +01:00
|
|
|
* num_links_pending. */
|
2018-08-23 16:17:06 +02:00
|
|
|
if (dec_parents) {
|
|
|
|
|
BLI_assert(node->num_links_pending > 0);
|
|
|
|
|
atomic_sub_and_fetch_uint32(&node->num_links_pending, 1);
|
|
|
|
|
}
|
|
|
|
|
/* Cal not schedule operation while its dependencies are not yet
|
2019-01-31 12:56:40 +01:00
|
|
|
* evaluated. */
|
2018-08-23 16:17:06 +02:00
|
|
|
if (node->num_links_pending != 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-12-04 13:58:29 +03:00
|
|
|
/* During the COW stage only schedule COW nodes. */
|
2020-01-07 12:04:26 +01:00
|
|
|
if (!need_evaluate_operation_at_stage(state, node)) {
|
|
|
|
|
return;
|
2018-12-04 13:58:29 +03:00
|
|
|
}
|
|
|
|
|
/* Actually schedule the node. */
|
2018-08-23 16:17:06 +02:00
|
|
|
bool is_scheduled = atomic_fetch_and_or_uint8((uint8_t *)&node->scheduled, (uint8_t) true);
|
|
|
|
|
if (!is_scheduled) {
|
|
|
|
|
if (node->is_noop()) {
|
|
|
|
|
/* skip NOOP node, schedule children right away */
|
2020-04-30 07:59:23 +02:00
|
|
|
schedule_children(state, node, schedule_function, schedule_function_args...);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
2018-08-23 16:17:06 +02:00
|
|
|
else {
|
|
|
|
|
/* children are scheduled once this task is completed */
|
2020-04-30 07:59:23 +02:00
|
|
|
schedule_function(node, 0, schedule_function_args...);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-07 13:49:42 +01:00
|
|
|
template<typename ScheduleFunction, typename... ScheduleFunctionArgs>
|
|
|
|
|
void schedule_graph(DepsgraphEvalState *state,
|
|
|
|
|
ScheduleFunction *schedule_function,
|
|
|
|
|
ScheduleFunctionArgs... schedule_function_args)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
2020-01-07 13:49:42 +01:00
|
|
|
for (OperationNode *node : state->graph->operations) {
|
2020-04-30 07:59:23 +02:00
|
|
|
schedule_node(state, node, false, schedule_function, schedule_function_args...);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-07 13:49:42 +01:00
|
|
|
template<typename ScheduleFunction, typename... ScheduleFunctionArgs>
|
|
|
|
|
void schedule_children(DepsgraphEvalState *state,
|
|
|
|
|
OperationNode *node,
|
|
|
|
|
ScheduleFunction *schedule_function,
|
|
|
|
|
ScheduleFunctionArgs... schedule_function_args)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
2019-01-31 12:56:40 +01:00
|
|
|
for (Relation *rel : node->outlinks) {
|
|
|
|
|
OperationNode *child = (OperationNode *)rel->to;
|
|
|
|
|
BLI_assert(child->type == NodeType::OPERATION);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
if (child->scheduled) {
|
|
|
|
|
/* Happens when having cyclic dependencies. */
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2020-01-07 13:49:42 +01:00
|
|
|
schedule_node(state,
|
|
|
|
|
child,
|
|
|
|
|
(rel->flag & RELATION_FLAG_CYCLIC) == 0,
|
|
|
|
|
schedule_function,
|
|
|
|
|
schedule_function_args...);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void schedule_node_to_queue(OperationNode *node,
|
|
|
|
|
const int /*thread_id*/,
|
|
|
|
|
GSQueue *evaluation_queue)
|
|
|
|
|
{
|
|
|
|
|
BLI_gsqueue_push(evaluation_queue, &node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void evaluate_graph_single_threaded(DepsgraphEvalState *state)
|
|
|
|
|
{
|
|
|
|
|
GSQueue *evaluation_queue = BLI_gsqueue_new(sizeof(OperationNode *));
|
|
|
|
|
schedule_graph(state, schedule_node_to_queue, evaluation_queue);
|
|
|
|
|
|
|
|
|
|
while (!BLI_gsqueue_is_empty(evaluation_queue)) {
|
|
|
|
|
OperationNode *operation_node;
|
|
|
|
|
BLI_gsqueue_pop(evaluation_queue, &operation_node);
|
|
|
|
|
|
|
|
|
|
evaluate_node(state, operation_node);
|
2020-04-30 07:59:23 +02:00
|
|
|
schedule_children(state, operation_node, schedule_node_to_queue, evaluation_queue);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
2020-01-07 13:49:42 +01:00
|
|
|
|
|
|
|
|
BLI_gsqueue_free(evaluation_queue);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
void depsgraph_ensure_view_layer(Depsgraph *graph)
|
2018-04-25 15:02:22 +02:00
|
|
|
{
|
|
|
|
|
/* We update copy-on-write scene in the following cases:
|
|
|
|
|
* - It was not expanded yet.
|
|
|
|
|
* - It was tagged for update of CoW component.
|
2019-01-31 12:56:40 +01:00
|
|
|
* This allows us to have proper view layer pointer. */
|
2018-04-25 15:02:22 +02:00
|
|
|
Scene *scene_cow = graph->scene_cow;
|
2020-03-11 17:25:17 +01:00
|
|
|
if (deg_copy_on_write_is_expanded(&scene_cow->id) &&
|
|
|
|
|
(scene_cow->id.recalc & ID_RECALC_COPY_ON_WRITE) == 0) {
|
|
|
|
|
return;
|
2018-04-25 15:02:22 +02:00
|
|
|
}
|
2020-03-11 17:25:17 +01:00
|
|
|
|
|
|
|
|
const IDNode *scene_id_node = graph->find_id_node(&graph->scene->id);
|
|
|
|
|
deg_update_copy_on_write_datablock(graph, scene_id_node);
|
2018-04-25 15:02:22 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:56:55 +01:00
|
|
|
} // namespace
|
|
|
|
|
|
2020-04-30 07:59:23 +02:00
|
|
|
static TaskPool *deg_evaluate_task_pool_create(DepsgraphEvalState *state)
|
|
|
|
|
{
|
|
|
|
|
if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) {
|
|
|
|
|
return BLI_task_pool_create_no_threads(state);
|
|
|
|
|
}
|
2020-08-07 12:38:42 +02:00
|
|
|
|
|
|
|
|
return BLI_task_pool_create_suspended(state, TASK_PRIORITY_HIGH);
|
2020-04-30 07:59:23 +02:00
|
|
|
}
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
/**
|
|
|
|
|
* Evaluate all nodes tagged for updating,
|
|
|
|
|
* \warning This is usually done as part of main loop, but may also be
|
|
|
|
|
* called from frame-change update.
|
|
|
|
|
*
|
|
|
|
|
* \note Time sources should be all valid!
|
|
|
|
|
*/
|
2018-04-06 11:21:20 +02:00
|
|
|
void deg_evaluate_on_refresh(Depsgraph *graph)
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
{
|
|
|
|
|
/* Nothing to update, early out. */
|
2020-04-28 17:40:23 +02:00
|
|
|
if (graph->entry_tags.is_empty()) {
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2020-01-24 15:14:28 +01:00
|
|
|
|
|
|
|
|
graph->debug.begin_graph_evaluation();
|
|
|
|
|
|
2019-10-10 11:03:58 +02:00
|
|
|
graph->is_evaluating = true;
|
2018-04-25 15:02:22 +02:00
|
|
|
depsgraph_ensure_view_layer(graph);
|
2018-04-06 11:21:20 +02:00
|
|
|
/* Set up evaluation state. */
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
DepsgraphEvalState state;
|
|
|
|
|
state.graph = graph;
|
2020-01-24 15:14:28 +01:00
|
|
|
state.do_stats = graph->debug.do_time_debug();
|
2020-01-07 13:49:42 +01:00
|
|
|
state.need_single_thread_pass = false;
|
2017-12-21 12:32:32 +01:00
|
|
|
/* Prepare all nodes for evaluation. */
|
|
|
|
|
initialize_execution(&state, graph);
|
2020-01-07 12:04:26 +01:00
|
|
|
|
2017-12-21 12:32:32 +01:00
|
|
|
/* Do actual evaluation now. */
|
2018-12-04 13:58:29 +03:00
|
|
|
/* First, process all Copy-On-Write nodes. */
|
2020-01-07 12:04:26 +01:00
|
|
|
state.stage = EvaluationStage::COPY_ON_WRITE;
|
2020-04-30 07:59:23 +02:00
|
|
|
TaskPool *task_pool = deg_evaluate_task_pool_create(&state);
|
2020-01-07 13:49:42 +01:00
|
|
|
schedule_graph(&state, schedule_node_to_pool, task_pool);
|
2020-04-30 07:59:23 +02:00
|
|
|
BLI_task_pool_work_and_wait(task_pool);
|
|
|
|
|
BLI_task_pool_free(task_pool);
|
2020-01-07 12:04:26 +01:00
|
|
|
|
2018-12-04 13:58:29 +03:00
|
|
|
/* After that, process all other nodes. */
|
2020-01-07 12:04:26 +01:00
|
|
|
state.stage = EvaluationStage::THREADED_EVALUATION;
|
2020-04-30 07:59:23 +02:00
|
|
|
task_pool = deg_evaluate_task_pool_create(&state);
|
2020-01-07 13:49:42 +01:00
|
|
|
schedule_graph(&state, schedule_node_to_pool, task_pool);
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
BLI_task_pool_work_and_wait(task_pool);
|
|
|
|
|
BLI_task_pool_free(task_pool);
|
2020-01-07 12:04:26 +01:00
|
|
|
|
2020-01-07 13:49:42 +01:00
|
|
|
if (state.need_single_thread_pass) {
|
|
|
|
|
state.stage = EvaluationStage::SINGLE_THREADED_WORKAROUND;
|
|
|
|
|
evaluate_graph_single_threaded(&state);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 16:14:15 +01:00
|
|
|
/* Finalize statistics gathering. This is because we only gather single
|
|
|
|
|
* operation timing here, without aggregating anything to avoid any extra
|
2019-01-31 12:56:40 +01:00
|
|
|
* synchronization. */
|
2017-12-21 16:14:15 +01:00
|
|
|
if (state.do_stats) {
|
|
|
|
|
deg_eval_stats_aggregate(graph);
|
|
|
|
|
}
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
/* Clear any uncleared tags - just in case. */
|
|
|
|
|
deg_graph_clear_tags(graph);
|
2019-10-10 11:03:58 +02:00
|
|
|
graph->is_evaluating = false;
|
2020-01-24 15:14:28 +01:00
|
|
|
|
|
|
|
|
graph->debug.end_graph_evaluation();
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-29 15:19:56 +02:00
|
|
|
} // namespace blender::deg
|