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
|
|
|
/*
|
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* Original Author: Joshua Leung
|
|
|
|
|
* Contributor(s): None Yet
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2016-06-19 06:25:54 +10:00
|
|
|
/** \file blender/depsgraph/intern/eval/deg_eval_flush.cc
|
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
|
|
|
* \ingroup depsgraph
|
|
|
|
|
*
|
|
|
|
|
* Core routines for how the Depsgraph works.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "intern/eval/deg_eval_flush.h"
|
|
|
|
|
|
|
|
|
|
// TODO(sergey): Use some sort of wrapper.
|
2016-08-25 15:12:21 +02:00
|
|
|
#include <deque>
|
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 "BLI_utildefines.h"
|
|
|
|
|
#include "BLI_task.h"
|
|
|
|
|
#include "BLI_ghash.h"
|
|
|
|
|
|
2017-06-06 12:14:39 +02:00
|
|
|
extern "C" {
|
|
|
|
|
#include "DNA_object_types.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
|
|
|
} /* extern "C" */
|
|
|
|
|
|
2017-06-06 12:14:39 +02:00
|
|
|
#include "DEG_depsgraph.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/nodes/deg_node.h"
|
|
|
|
|
#include "intern/nodes/deg_node_component.h"
|
2017-12-20 16:35:48 +01:00
|
|
|
#include "intern/nodes/deg_node_id.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/nodes/deg_node_operation.h"
|
|
|
|
|
|
|
|
|
|
#include "intern/depsgraph_intern.h"
|
|
|
|
|
#include "util/deg_util_foreach.h"
|
|
|
|
|
|
|
|
|
|
namespace DEG {
|
|
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
enum {
|
|
|
|
|
ID_STATE_NONE = 0,
|
|
|
|
|
ID_STATE_MODIFIED = 1,
|
|
|
|
|
};
|
|
|
|
|
|
2017-09-18 15:50:27 +05:00
|
|
|
enum {
|
|
|
|
|
COMPONENT_STATE_NONE = 0,
|
|
|
|
|
COMPONENT_STATE_SCHEDULED = 1,
|
|
|
|
|
COMPONENT_STATE_DONE = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
typedef std::deque<OperationDepsNode *> FlushQueue;
|
|
|
|
|
|
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
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
// TODO(sergey): De-duplicate with depsgraph_tag,cc
|
|
|
|
|
void lib_id_recalc_tag(Main *bmain, ID *id)
|
|
|
|
|
{
|
2017-12-15 09:43:18 +01:00
|
|
|
id->recalc |= ID_RECALC;
|
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
|
|
|
DEG_id_type_tag(bmain, GS(id->name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lib_id_recalc_data_tag(Main *bmain, ID *id)
|
|
|
|
|
{
|
2017-12-15 09:43:18 +01:00
|
|
|
id->recalc |= ID_RECALC_DATA;
|
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
|
|
|
DEG_id_type_tag(bmain, GS(id->name));
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-10 12:49:51 +01:00
|
|
|
void flush_init_operation_node_func(
|
|
|
|
|
void *__restrict data_v,
|
2018-01-10 12:53:59 +01:00
|
|
|
const int i,
|
2018-01-10 12:49:51 +01:00
|
|
|
const ParallelRangeTLS *__restrict /*tls*/)
|
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
|
|
|
{
|
|
|
|
|
Depsgraph *graph = (Depsgraph *)data_v;
|
|
|
|
|
OperationDepsNode *node = graph->operations[i];
|
|
|
|
|
node->scheduled = false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-10 12:49:51 +01:00
|
|
|
void flush_init_id_node_func(
|
|
|
|
|
void *__restrict data_v,
|
2018-01-10 12:53:59 +01:00
|
|
|
const int i,
|
2018-01-10 12:49:51 +01:00
|
|
|
const ParallelRangeTLS *__restrict /*tls*/)
|
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-18 16:33:12 +01:00
|
|
|
Depsgraph *graph = (Depsgraph *)data_v;
|
|
|
|
|
IDDepsNode *id_node = graph->id_nodes[i];
|
|
|
|
|
id_node->done = ID_STATE_NONE;
|
|
|
|
|
GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
|
|
|
|
|
comp_node->done = COMPONENT_STATE_NONE;
|
|
|
|
|
GHASH_FOREACH_END();
|
|
|
|
|
}
|
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-18 16:33:12 +01:00
|
|
|
BLI_INLINE void flush_prepare(Depsgraph *graph)
|
|
|
|
|
{
|
2018-01-08 11:35:48 +01:00
|
|
|
{
|
|
|
|
|
const int num_operations = graph->operations.size();
|
|
|
|
|
ParallelRangeSettings settings;
|
|
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
2018-01-11 14:47:12 +01:00
|
|
|
settings.min_iter_per_thread = 1024;
|
2018-01-08 11:35:48 +01:00
|
|
|
BLI_task_parallel_range(0, num_operations,
|
|
|
|
|
graph,
|
|
|
|
|
flush_init_operation_node_func,
|
|
|
|
|
&settings);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
const int num_id_nodes = graph->id_nodes.size();
|
|
|
|
|
ParallelRangeSettings settings;
|
|
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
2018-01-11 14:47:12 +01:00
|
|
|
settings.min_iter_per_thread = 1024;
|
2018-01-08 11:35:48 +01:00
|
|
|
BLI_task_parallel_range(0, num_id_nodes,
|
|
|
|
|
graph,
|
|
|
|
|
flush_init_id_node_func,
|
|
|
|
|
&settings);
|
|
|
|
|
}
|
2017-12-18 16:33:12 +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
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
|
|
|
|
|
{
|
|
|
|
|
GSET_FOREACH_BEGIN(OperationDepsNode *, op_node, graph->entry_tags)
|
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-18 16:33:12 +01:00
|
|
|
queue->push_back(op_node);
|
|
|
|
|
op_node->scheduled = true;
|
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
|
|
|
}
|
|
|
|
|
GSET_FOREACH_END();
|
2017-12-18 16:33:12 +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
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
BLI_INLINE void flush_handle_id_node(IDDepsNode *id_node)
|
|
|
|
|
{
|
|
|
|
|
id_node->done = ID_STATE_MODIFIED;
|
|
|
|
|
}
|
2016-05-30 16:53:04 +02:00
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
/* TODO(sergey): We can reduce number of arguments here. */
|
|
|
|
|
BLI_INLINE void flush_handle_component_node(Depsgraph * /*graph*/,
|
|
|
|
|
IDDepsNode *id_node,
|
|
|
|
|
ComponentDepsNode *comp_node,
|
|
|
|
|
FlushQueue *queue)
|
|
|
|
|
{
|
|
|
|
|
/* We only handle component once. */
|
|
|
|
|
if (comp_node->done == COMPONENT_STATE_DONE) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
comp_node->done = COMPONENT_STATE_DONE;
|
|
|
|
|
/* Tag all required operations in component for update. */
|
|
|
|
|
foreach (OperationDepsNode *op, comp_node->operations) {
|
|
|
|
|
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
|
|
|
|
|
}
|
|
|
|
|
if (GS(id_node->id->name) == ID_OB) {
|
|
|
|
|
Object *object = (Object *)id_node->id;
|
|
|
|
|
/* This code is used to preserve those areas which does
|
|
|
|
|
* direct object update,
|
|
|
|
|
*
|
|
|
|
|
* Plus it ensures visibility changes and relations and
|
|
|
|
|
* layers visibility update has proper flags to work with.
|
|
|
|
|
*/
|
|
|
|
|
switch (comp_node->type) {
|
|
|
|
|
case DEG_NODE_TYPE_UNDEFINED:
|
|
|
|
|
case DEG_NODE_TYPE_OPERATION:
|
|
|
|
|
case DEG_NODE_TYPE_TIMESOURCE:
|
|
|
|
|
case DEG_NODE_TYPE_ID_REF:
|
|
|
|
|
case DEG_NODE_TYPE_SEQUENCER:
|
|
|
|
|
case NUM_DEG_NODE_TYPES:
|
|
|
|
|
/* Ignore, does not translate to object component. */
|
|
|
|
|
BLI_assert(!"This should never happen!");
|
|
|
|
|
break;
|
|
|
|
|
case DEG_NODE_TYPE_ANIMATION:
|
|
|
|
|
object->recalc |= OB_RECALC_TIME;
|
|
|
|
|
break;
|
|
|
|
|
case DEG_NODE_TYPE_TRANSFORM:
|
|
|
|
|
object->recalc |= OB_RECALC_OB;
|
|
|
|
|
break;
|
|
|
|
|
case DEG_NODE_TYPE_GEOMETRY:
|
|
|
|
|
case DEG_NODE_TYPE_EVAL_POSE:
|
|
|
|
|
case DEG_NODE_TYPE_BONE:
|
|
|
|
|
case DEG_NODE_TYPE_EVAL_PARTICLES:
|
|
|
|
|
case DEG_NODE_TYPE_SHADING:
|
|
|
|
|
case DEG_NODE_TYPE_CACHE:
|
|
|
|
|
case DEG_NODE_TYPE_PROXY:
|
|
|
|
|
object->recalc |= OB_RECALC_DATA;
|
|
|
|
|
break;
|
|
|
|
|
case DEG_NODE_TYPE_PARAMETERS:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* When some target changes bone, we might need to re-run the
|
|
|
|
|
* whole IK solver, otherwise result might be unpredictable.
|
|
|
|
|
*/
|
|
|
|
|
if (comp_node->type == DEG_NODE_TYPE_BONE) {
|
|
|
|
|
ComponentDepsNode *pose_comp =
|
|
|
|
|
id_node->find_component(DEG_NODE_TYPE_EVAL_POSE);
|
|
|
|
|
BLI_assert(pose_comp != NULL);
|
|
|
|
|
if (pose_comp->done == COMPONENT_STATE_NONE) {
|
|
|
|
|
queue->push_front(pose_comp->get_entry_operation());
|
|
|
|
|
pose_comp->done = COMPONENT_STATE_SCHEDULED;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-25 15:51:19 +02:00
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
/* Schedule children of the given operation node for traversal.
|
|
|
|
|
*
|
|
|
|
|
* One of the children will by-pass the queue and will be returned as a function
|
|
|
|
|
* return value, so it can start being handled right away, without building too
|
|
|
|
|
* much of a queue.
|
|
|
|
|
*/
|
|
|
|
|
BLI_INLINE OperationDepsNode *flush_schedule_children(
|
|
|
|
|
OperationDepsNode *op_node,
|
|
|
|
|
FlushQueue *queue)
|
|
|
|
|
{
|
|
|
|
|
OperationDepsNode *result = NULL;
|
|
|
|
|
foreach (DepsRelation *rel, op_node->outlinks) {
|
|
|
|
|
OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
|
|
|
|
|
if (to_node->scheduled == false) {
|
|
|
|
|
if (result != NULL) {
|
|
|
|
|
queue->push_front(to_node);
|
2016-08-25 15:51:19 +02:00
|
|
|
}
|
2017-12-18 16:33:12 +01:00
|
|
|
else {
|
|
|
|
|
result = to_node;
|
2016-08-25 15:51:19 +02:00
|
|
|
}
|
2017-12-18 16:33:12 +01:00
|
|
|
to_node->scheduled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2016-08-25 15:51:19 +02:00
|
|
|
|
2017-12-18 16:33:12 +01:00
|
|
|
BLI_INLINE void flush_editors_id_update(Main *bmain,
|
|
|
|
|
Depsgraph *graph)
|
|
|
|
|
{
|
|
|
|
|
foreach (IDDepsNode *id_node, graph->id_nodes) {
|
|
|
|
|
if (id_node->done != ID_STATE_MODIFIED) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
/* TODO(sergey): Do we need to pass original or evaluated ID here? */
|
|
|
|
|
ID *id = id_node->id;
|
|
|
|
|
deg_editors_id_update(bmain, id);
|
|
|
|
|
lib_id_recalc_tag(bmain, id);
|
|
|
|
|
/* TODO(sergey): For until we've got proper data nodes in the graph. */
|
|
|
|
|
lib_id_recalc_data_tag(bmain, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
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-18 16:33:12 +01:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
/* Flush updates from tagged nodes outwards until all affected nodes
|
|
|
|
|
* are tagged.
|
|
|
|
|
*/
|
|
|
|
|
void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
|
|
|
|
|
{
|
|
|
|
|
/* Sanity checks. */
|
|
|
|
|
BLI_assert(bmain != NULL);
|
|
|
|
|
BLI_assert(graph != NULL);
|
|
|
|
|
/* Nothing to update, early out. */
|
2018-02-15 23:36:11 +11:00
|
|
|
if (BLI_gset_len(graph->entry_tags) == 0) {
|
2017-12-18 16:33:12 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Reset all flags, get ready for the flush. */
|
|
|
|
|
flush_prepare(graph);
|
|
|
|
|
/* Starting from the tagged "entry" nodes, flush outwards. */
|
|
|
|
|
FlushQueue queue;
|
|
|
|
|
flush_schedule_entrypoints(graph, &queue);
|
|
|
|
|
/* Do actual flush. */
|
|
|
|
|
while (!queue.empty()) {
|
|
|
|
|
OperationDepsNode *op_node = queue.front();
|
|
|
|
|
queue.pop_front();
|
|
|
|
|
while (op_node != NULL) {
|
|
|
|
|
/* Tag operation as required for update. */
|
|
|
|
|
op_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
|
|
|
|
|
/* Inform corresponding ID and component nodes about the change. */
|
|
|
|
|
ComponentDepsNode *comp_node = op_node->owner;
|
|
|
|
|
IDDepsNode *id_node = comp_node->owner;
|
|
|
|
|
flush_handle_id_node(id_node);
|
|
|
|
|
flush_handle_component_node(graph,
|
|
|
|
|
id_node,
|
|
|
|
|
comp_node,
|
|
|
|
|
&queue);
|
|
|
|
|
/* Flush to nodes along links. */
|
|
|
|
|
op_node = flush_schedule_children(op_node, &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
|
|
|
}
|
|
|
|
|
}
|
2017-12-18 16:33:12 +01:00
|
|
|
/* Inform editors about all changes. */
|
|
|
|
|
flush_editors_id_update(bmain, 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
|
|
|
}
|
|
|
|
|
|
2018-01-10 12:49:51 +01:00
|
|
|
static void graph_clear_func(
|
|
|
|
|
void *__restrict data_v,
|
2018-01-10 12:53:59 +01:00
|
|
|
const int i,
|
2018-01-10 12:49:51 +01:00
|
|
|
const ParallelRangeTLS *__restrict /*tls*/)
|
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
|
|
|
{
|
|
|
|
|
Depsgraph *graph = (Depsgraph *)data_v;
|
|
|
|
|
OperationDepsNode *node = graph->operations[i];
|
|
|
|
|
/* Clear node's "pending update" settings. */
|
|
|
|
|
node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear tags from all operation nodes. */
|
|
|
|
|
void deg_graph_clear_tags(Depsgraph *graph)
|
|
|
|
|
{
|
|
|
|
|
/* Go over all operation nodes, clearing tags. */
|
|
|
|
|
const int num_operations = graph->operations.size();
|
2018-01-08 11:35:48 +01:00
|
|
|
ParallelRangeSettings settings;
|
|
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
2018-01-11 14:47:12 +01:00
|
|
|
settings.min_iter_per_thread = 1024;
|
2018-01-08 11:35:48 +01:00
|
|
|
BLI_task_parallel_range(0, num_operations,
|
|
|
|
|
graph,
|
|
|
|
|
graph_clear_func,
|
|
|
|
|
&settings);
|
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 entry tags which haven't been flushed. */
|
|
|
|
|
BLI_gset_clear(graph->entry_tags, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace DEG
|