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
|
|
|
*
|
|
|
|
|
* 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>
|
2018-06-12 09:59:30 +02:00
|
|
|
#include <cmath>
|
|
|
|
|
|
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"
|
2018-01-29 16:42:04 +01:00
|
|
|
#include "BLI_listbase.h"
|
2018-06-12 09:59:30 +02:00
|
|
|
#include "BLI_math_vector.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 "BLI_task.h"
|
|
|
|
|
#include "BLI_ghash.h"
|
|
|
|
|
|
2019-08-01 19:14:48 +10:00
|
|
|
#include "BKE_object.h"
|
|
|
|
|
#include "BKE_scene.h"
|
|
|
|
|
|
2017-06-06 12:14:39 +02:00
|
|
|
extern "C" {
|
|
|
|
|
#include "DNA_object_types.h"
|
2019-07-24 12:40:33 +02:00
|
|
|
#include "DNA_scene_types.h"
|
2018-07-10 14:14:55 +02:00
|
|
|
|
|
|
|
|
#include "DRW_engine.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"
|
|
|
|
|
|
2019-01-31 12:56:40 +01:00
|
|
|
#include "intern/debug/deg_debug.h"
|
|
|
|
|
#include "intern/depsgraph.h"
|
|
|
|
|
#include "intern/depsgraph_update.h"
|
|
|
|
|
#include "intern/node/deg_node.h"
|
|
|
|
|
#include "intern/node/deg_node_component.h"
|
|
|
|
|
#include "intern/node/deg_node_factory.h"
|
|
|
|
|
#include "intern/node/deg_node_id.h"
|
|
|
|
|
#include "intern/node/deg_node_operation.h"
|
2019-07-24 12:40:33 +02:00
|
|
|
#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
|
|
|
|
2017-08-29 11:26:57 +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
|
|
|
|
2019-06-12 09:04:10 +10:00
|
|
|
// Invalidate data-block data when update is flushed on it.
|
2018-06-12 09:59:30 +02:00
|
|
|
//
|
|
|
|
|
// The idea of this is to help catching cases when area is accessing data which
|
|
|
|
|
// is not yet evaluated, which could happen due to missing relations. The issue
|
|
|
|
|
// is that usually that data will be kept from previous frame, and it looks to
|
|
|
|
|
// be plausible.
|
|
|
|
|
//
|
|
|
|
|
// This ensures that data does not look plausible, making it much easier to
|
|
|
|
|
// catch usage of invalid state.
|
|
|
|
|
#undef INVALIDATE_ON_FLUSH
|
|
|
|
|
|
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 DEG {
|
|
|
|
|
|
2017-12-01 17:56:52 +01:00
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
ID_STATE_NONE = 0,
|
|
|
|
|
ID_STATE_MODIFIED = 1,
|
2017-12-01 17:56:52 +01:00
|
|
|
};
|
|
|
|
|
|
2017-09-18 15:50:27 +05:00
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
COMPONENT_STATE_NONE = 0,
|
|
|
|
|
COMPONENT_STATE_SCHEDULED = 1,
|
|
|
|
|
COMPONENT_STATE_DONE = 2,
|
2017-09-18 15:50:27 +05:00
|
|
|
};
|
|
|
|
|
|
2019-01-31 12:56:40 +01:00
|
|
|
typedef std::deque<OperationNode *> 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
|
|
|
|
2017-12-01 16:02:10 +01:00
|
|
|
namespace {
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void flush_init_operation_node_func(void *__restrict data_v,
|
|
|
|
|
const int i,
|
2019-07-30 14:56:47 +02:00
|
|
|
const TaskParallelTLS *__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
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
Depsgraph *graph = (Depsgraph *)data_v;
|
|
|
|
|
OperationNode *node = graph->operations[i];
|
|
|
|
|
node->scheduled = 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
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void flush_init_id_node_func(void *__restrict data_v,
|
|
|
|
|
const int i,
|
2019-07-30 14:56:47 +02:00
|
|
|
const TaskParallelTLS *__restrict /*tls*/)
|
2017-12-01 17:30:36 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
Depsgraph *graph = (Depsgraph *)data_v;
|
|
|
|
|
IDNode *id_node = graph->id_nodes[i];
|
|
|
|
|
id_node->custom_flags = ID_STATE_NONE;
|
|
|
|
|
GHASH_FOREACH_BEGIN (ComponentNode *, comp_node, id_node->components)
|
|
|
|
|
comp_node->custom_flags = COMPONENT_STATE_NONE;
|
|
|
|
|
GHASH_FOREACH_END();
|
2017-12-01 17:30:36 +01:00
|
|
|
}
|
|
|
|
|
|
2017-12-01 16:02:10 +01:00
|
|
|
BLI_INLINE void flush_prepare(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-04-17 06:17:24 +02:00
|
|
|
{
|
|
|
|
|
const int num_operations = graph->operations.size();
|
2019-07-30 14:56:47 +02:00
|
|
|
TaskParallelSettings settings;
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
|
|
|
|
settings.min_iter_per_thread = 1024;
|
|
|
|
|
BLI_task_parallel_range(0, num_operations, graph, flush_init_operation_node_func, &settings);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
const int num_id_nodes = graph->id_nodes.size();
|
2019-07-30 14:56:47 +02:00
|
|
|
TaskParallelSettings settings;
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
|
|
|
|
settings.min_iter_per_thread = 1024;
|
|
|
|
|
BLI_task_parallel_range(0, num_id_nodes, graph, flush_init_id_node_func, &settings);
|
|
|
|
|
}
|
2017-12-01 16:02:10 +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-01 16:02:10 +01:00
|
|
|
BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
GSET_FOREACH_BEGIN (OperationNode *, op_node, graph->entry_tags) {
|
|
|
|
|
queue->push_back(op_node);
|
|
|
|
|
op_node->scheduled = true;
|
|
|
|
|
DEG_DEBUG_PRINTF((::Depsgraph *)graph,
|
|
|
|
|
EVAL,
|
|
|
|
|
"Operation is entry point for update: %s\n",
|
|
|
|
|
op_node->identifier().c_str());
|
|
|
|
|
}
|
|
|
|
|
GSET_FOREACH_END();
|
2017-12-01 16:02:10 +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
|
|
|
|
2019-01-31 12:56:40 +01:00
|
|
|
BLI_INLINE void flush_handle_id_node(IDNode *id_node)
|
2017-12-01 16:02:10 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
id_node->custom_flags = ID_STATE_MODIFIED;
|
2017-12-01 16:02:10 +01:00
|
|
|
}
|
Depsgraph: Initial groundwork for copy-on-write support
< Dependency graph Copy-on-Write >
--------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
This is an initial commit of Copy-on-write support added to dependency graph.
Main priority for now: get playback (Alt-A) and all operators (selection,
transform etc) to work with the new concept of clear separation between
evaluated data coming from dependency graph and original data coming from
.blend file (and stored in bmain).
= How does this work? =
The idea is to support Copy-on-Write on the ID level. This means, we duplicate
the whole ID before we cann it's evaluaiton function. This is currently done
in the following way:
- At the depsgraph construction time we create "shallow" copy of the ID
datablock, just so we know it's pointer in memory and can use for function
bindings.
- At the evaluaiton time, the copy of ID get's "expanded" (needs a better
name internally, so it does not conflict with expanding datablocks during
library linking), which means the content of the datablock is being
copied over and all IDs are getting remapped to the copied ones.
Currently we do the whole copy, in the future we will support some tricks
here to prevent duplicating geometry arrays (verts, edges, loops, faces
and polys) when we don't need that.
- Evaluation functions are operating on copied datablocks and never touching
original datablock.
- There are some cases when we need to know non-ID pointers for function
bindings. This mainly applies to scene collections and armatures. The
idea of dealing with this is to "expand" copy-on-write datablock at
the dependency graph build time. This might introduce some slowdown to the
dependency graph construction time, but allows us to have minimal changes
in the code and avoid any hash look-up from evaluation function (one of
the ideas to avoid using pointers as function bindings is to pass name
of layer or a bone to the evaluation function and look up actual data based
on that name).
Currently there is a special function in depsgraph which does such a
synchronization, in the future we might want to make it more generic.
At some point we need to synchronize copy-on-write version of datablock with
the original version. This happens, i.e., when we change active object or
change selection. We don't want any actual evaluation of update flush happening
for such thins, so now we have a special update tag:
DEG_id_tag_update((id, DEG_TAG_COPY_ON_WRITE)
- For the render engines we now have special call for the dependency graph to
give evaluated datablock for the given original one. This isn't fully ideal
but allows to have Cycles viewport render.
This is definitely a subject for further investigation / improvement.
This call will tag copy-on-write component tagged for update without causing
updates to be flushed to any other objects, causing chain reaction of updates.
This tag is handy when selection in the scene changes.
This basically summarizes ideas underneath this commit. The code should be
reasonably documented.
Here is a demo of dependency graph with all copy-on-write stuff in it:
https://developer.blender.org/F635468
= What to expect to (not) work? =
- Only meshes are properly-ish aware of copy-on-write currently, Non-mesh
geometry will probably crash or will not work at all.
- Armatures will need similar depsgraph built-time expansion of the copied
datablock.
- There are some extra tags / relations added, to keep things demo-able but
which are slowing things down for evaluation.
- Edit mode works for until click selection is used (due to the selection
code using EditDerivedMesh created ad-hoc).
- Lots of tools will lack tagging synchronization of copied datablock for
sync with original ID.
= How to move forward? =
There is some tedious work related on going over all the tools, checking
whether they need to work with original or final evaluated object and make
the required changes.
Additionally, there need synchronization tag done in fair amount of tools
and operators as well. For example, currently it's not possible to change
render engine without re-opening the file or forcing dependency graph for
re-build via python console.
There is also now some thoughts required about copying evaluated properties
between objects or from collection to a new object. Perhaps easiest way
would be to move base flag flush to Object ID node and tag new objects for
update instead of doing manual copy.
here is some WIP patch which moves such evaluaiton / flush:
https://developer.blender.org/F635479
Lots of TODOs in the code, with possible optimization.
= How to test? =
This is a feature under heavy development, so obviously it is disabled by
default. The only reason it goes to 2.8 branch is to avoid possible merge
hell.
In order to enable this feature use WITH_DEPSGRAPH_COPY_ON_WRITE CMake
configuration option.
2017-06-14 10:26:24 +02:00
|
|
|
|
2017-12-01 16:02:10 +01:00
|
|
|
/* TODO(sergey): We can reduce number of arguments here. */
|
2019-01-31 12:56:40 +01:00
|
|
|
BLI_INLINE void flush_handle_component_node(IDNode *id_node,
|
|
|
|
|
ComponentNode *comp_node,
|
2017-12-01 16:02:10 +01:00
|
|
|
FlushQueue *queue)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* We only handle component once. */
|
|
|
|
|
if (comp_node->custom_flags == COMPONENT_STATE_DONE) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
comp_node->custom_flags = COMPONENT_STATE_DONE;
|
|
|
|
|
/* Tag all required operations in component for update, unless this is a
|
|
|
|
|
* special component where we don't want all operations to be tagged.
|
|
|
|
|
*
|
|
|
|
|
* TODO(sergey): Make this a more generic solution. */
|
|
|
|
|
if (comp_node->type != NodeType::PARTICLE_SETTINGS &&
|
|
|
|
|
comp_node->type != NodeType::PARTICLE_SYSTEM) {
|
|
|
|
|
for (OperationNode *op : comp_node->operations) {
|
|
|
|
|
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* when some target changes bone, we might need to re-run the
|
|
|
|
|
* whole IK solver, otherwise result might be unpredictable. */
|
|
|
|
|
if (comp_node->type == NodeType::BONE) {
|
|
|
|
|
ComponentNode *pose_comp = id_node->find_component(NodeType::EVAL_POSE);
|
|
|
|
|
BLI_assert(pose_comp != NULL);
|
|
|
|
|
if (pose_comp->custom_flags == COMPONENT_STATE_NONE) {
|
|
|
|
|
queue->push_front(pose_comp->get_entry_operation());
|
|
|
|
|
pose_comp->custom_flags = COMPONENT_STATE_SCHEDULED;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-01 16:02:10 +01:00
|
|
|
}
|
2016-08-25 15:51:19 +02:00
|
|
|
|
2017-12-01 16:02:10 +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.
|
|
|
|
|
*/
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_INLINE OperationNode *flush_schedule_children(OperationNode *op_node, FlushQueue *queue)
|
2017-12-01 16:02:10 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
OperationNode *result = NULL;
|
|
|
|
|
for (Relation *rel : op_node->outlinks) {
|
|
|
|
|
/* Flush is forbidden, completely. */
|
|
|
|
|
if (rel->flag & RELATION_FLAG_NO_FLUSH) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2019-06-04 11:33:41 +02:00
|
|
|
if (op_node->flag & DEPSOP_FLAG_USER_MODIFIED) {
|
|
|
|
|
IDNode *id_node = op_node->owner->owner;
|
|
|
|
|
id_node->is_user_modified = true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Relation only allows flushes on user changes, but the node was not
|
|
|
|
|
* affected by user. */
|
|
|
|
|
if ((rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) &&
|
|
|
|
|
(op_node->flag & DEPSOP_FLAG_USER_MODIFIED) == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
OperationNode *to_node = (OperationNode *)rel->to;
|
|
|
|
|
/* Always flush flushable flags, so children always know what happened
|
|
|
|
|
* to their parents. */
|
|
|
|
|
to_node->flag |= (op_node->flag & DEPSOP_FLAG_FLUSH);
|
|
|
|
|
/* Flush update over the relation, if it was not flushed yet. */
|
|
|
|
|
if (to_node->scheduled) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (result != NULL) {
|
|
|
|
|
queue->push_front(to_node);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result = to_node;
|
|
|
|
|
}
|
|
|
|
|
to_node->scheduled = true;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2017-12-01 16:02:10 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-29 16:42:04 +01:00
|
|
|
void flush_engine_data_update(ID *id)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
DrawDataList *draw_data_list = DRW_drawdatalist_from_id(id);
|
|
|
|
|
if (draw_data_list == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
LISTBASE_FOREACH (DrawData *, draw_data, draw_data_list) {
|
|
|
|
|
draw_data->recalc |= id->recalc;
|
|
|
|
|
}
|
2018-01-29 16:42:04 +01:00
|
|
|
}
|
|
|
|
|
|
2017-12-19 11:24:34 +01:00
|
|
|
/* NOTE: It will also accumulate flags from changed components. */
|
2019-04-17 06:17:24 +02:00
|
|
|
void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *update_ctx)
|
2017-12-01 17:56:52 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
for (IDNode *id_node : graph->id_nodes) {
|
|
|
|
|
if (id_node->custom_flags != ID_STATE_MODIFIED) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
DEG_graph_id_type_tag(reinterpret_cast<::Depsgraph *>(graph), GS(id_node->id_orig->name));
|
|
|
|
|
/* TODO(sergey): Do we need to pass original or evaluated ID here? */
|
|
|
|
|
ID *id_orig = id_node->id_orig;
|
|
|
|
|
ID *id_cow = id_node->id_cow;
|
|
|
|
|
/* Gather recalc flags from all changed components. */
|
|
|
|
|
GHASH_FOREACH_BEGIN (ComponentNode *, comp_node, id_node->components) {
|
|
|
|
|
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
DepsNodeFactory *factory = type_get_factory(comp_node->type);
|
|
|
|
|
BLI_assert(factory != NULL);
|
|
|
|
|
id_cow->recalc |= factory->id_recalc_tag();
|
|
|
|
|
}
|
|
|
|
|
GHASH_FOREACH_END();
|
|
|
|
|
DEG_DEBUG_PRINTF((::Depsgraph *)graph,
|
|
|
|
|
EVAL,
|
|
|
|
|
"Accumulated recalc bits for %s: %u\n",
|
|
|
|
|
id_orig->name,
|
|
|
|
|
(unsigned int)id_cow->recalc);
|
|
|
|
|
|
2019-06-12 09:04:10 +10:00
|
|
|
/* Inform editors. Only if the data-block is being evaluated a second
|
2019-04-17 06:17:24 +02:00
|
|
|
* time, to distinguish between user edits and initial evaluation when
|
2019-06-12 09:04:10 +10:00
|
|
|
* the data-block becomes visible.
|
2019-04-17 06:17:24 +02:00
|
|
|
*
|
2019-06-12 09:04:10 +10:00
|
|
|
* TODO: image data-blocks do not use COW, so might not be detected
|
2019-04-17 06:17:24 +02:00
|
|
|
* correctly. */
|
|
|
|
|
if (deg_copy_on_write_is_expanded(id_cow)) {
|
2019-06-04 11:33:41 +02:00
|
|
|
if (graph->is_active && id_node->is_user_modified) {
|
2019-04-17 06:17:24 +02:00
|
|
|
deg_editors_id_update(update_ctx, id_orig);
|
|
|
|
|
}
|
|
|
|
|
/* ID may need to get its auto-override operations refreshed. */
|
2019-06-14 23:16:04 +02:00
|
|
|
if (ID_IS_OVERRIDE_LIBRARY_AUTO(id_orig)) {
|
|
|
|
|
id_orig->tag |= LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
/* Inform draw engines that something was changed. */
|
|
|
|
|
flush_engine_data_update(id_cow);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-01 17:56:52 +01:00
|
|
|
}
|
|
|
|
|
|
2018-06-12 09:59:30 +02:00
|
|
|
#ifdef INVALIDATE_ON_FLUSH
|
|
|
|
|
void invalidate_tagged_evaluated_transform(ID *id)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const ID_Type id_type = GS(id->name);
|
|
|
|
|
switch (id_type) {
|
|
|
|
|
case ID_OB: {
|
|
|
|
|
Object *object = (Object *)id;
|
|
|
|
|
copy_vn_fl((float *)object->obmat, 16, NAN);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-06-12 09:59:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void invalidate_tagged_evaluated_geometry(ID *id)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const ID_Type id_type = GS(id->name);
|
|
|
|
|
switch (id_type) {
|
|
|
|
|
case ID_OB: {
|
|
|
|
|
Object *object = (Object *)id;
|
|
|
|
|
BKE_object_free_derived_caches(object);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-06-12 09:59:30 +02:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void invalidate_tagged_evaluated_data(Depsgraph *graph)
|
|
|
|
|
{
|
|
|
|
|
#ifdef INVALIDATE_ON_FLUSH
|
2019-04-17 06:17:24 +02:00
|
|
|
for (IDNode *id_node : graph->id_nodes) {
|
|
|
|
|
if (id_node->custom_flags != ID_STATE_MODIFIED) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
ID *id_cow = id_node->id_cow;
|
|
|
|
|
if (!deg_copy_on_write_is_expanded(id_cow)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
GHASH_FOREACH_BEGIN (ComponentNode *, comp_node, id_node->components) {
|
|
|
|
|
if (comp_node->custom_flags != COMPONENT_STATE_DONE) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
switch (comp_node->type) {
|
|
|
|
|
case ID_RECALC_TRANSFORM:
|
|
|
|
|
invalidate_tagged_evaluated_transform(id_cow);
|
|
|
|
|
break;
|
|
|
|
|
case ID_RECALC_GEOMETRY:
|
|
|
|
|
invalidate_tagged_evaluated_geometry(id_cow);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GHASH_FOREACH_END();
|
|
|
|
|
}
|
2018-06-12 09:59:30 +02:00
|
|
|
#else
|
2019-04-17 06:17:24 +02:00
|
|
|
(void)graph;
|
2018-06-12 09:59:30 +02:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-01 16:02:10 +01:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
/* Flush updates from tagged nodes outwards until all affected nodes
|
|
|
|
|
* are tagged.
|
|
|
|
|
*/
|
|
|
|
|
void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Sanity checks. */
|
|
|
|
|
BLI_assert(bmain != NULL);
|
|
|
|
|
BLI_assert(graph != NULL);
|
|
|
|
|
/* Nothing to update, early out. */
|
2019-07-24 12:40:33 +02:00
|
|
|
if (BLI_gset_len(graph->entry_tags) == 0 && !graph->need_update_time) {
|
2019-04-17 06:17:24 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2019-07-24 12:40:33 +02:00
|
|
|
if (graph->need_update_time) {
|
|
|
|
|
const Scene *scene_orig = graph->scene;
|
2019-07-31 16:38:04 +02:00
|
|
|
const float ctime = BKE_scene_frame_get(scene_orig);
|
2019-07-24 12:40:33 +02:00
|
|
|
DEG::TimeSourceNode *time_source = graph->find_time_source();
|
|
|
|
|
graph->ctime = ctime;
|
|
|
|
|
time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
/* 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);
|
|
|
|
|
/* Prepare update context for editors. */
|
|
|
|
|
DEGEditorUpdateContext update_ctx;
|
|
|
|
|
update_ctx.bmain = bmain;
|
|
|
|
|
update_ctx.depsgraph = (::Depsgraph *)graph;
|
|
|
|
|
update_ctx.scene = graph->scene;
|
|
|
|
|
update_ctx.view_layer = graph->view_layer;
|
|
|
|
|
/* Do actual flush. */
|
|
|
|
|
while (!queue.empty()) {
|
|
|
|
|
OperationNode *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. */
|
|
|
|
|
ComponentNode *comp_node = op_node->owner;
|
|
|
|
|
IDNode *id_node = comp_node->owner;
|
|
|
|
|
flush_handle_id_node(id_node);
|
|
|
|
|
flush_handle_component_node(id_node, comp_node, &queue);
|
|
|
|
|
/* Flush to nodes along links. */
|
|
|
|
|
op_node = flush_schedule_children(op_node, &queue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Inform editors about all changes. */
|
|
|
|
|
flush_editors_id_update(graph, &update_ctx);
|
|
|
|
|
/* Reset evaluation result tagged which is tagged for update to some state
|
|
|
|
|
* which is obvious to catch. */
|
|
|
|
|
invalidate_tagged_evaluated_data(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-04-17 06:17:24 +02:00
|
|
|
static void graph_clear_operation_func(void *__restrict data_v,
|
|
|
|
|
const int i,
|
2019-07-30 14:56:47 +02:00
|
|
|
const TaskParallelTLS *__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
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
Depsgraph *graph = (Depsgraph *)data_v;
|
|
|
|
|
OperationNode *node = graph->operations[i];
|
|
|
|
|
/* Clear node's "pending update" settings. */
|
|
|
|
|
node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE |
|
|
|
|
|
DEPSOP_FLAG_USER_MODIFIED);
|
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 tags from all operation nodes. */
|
|
|
|
|
void deg_graph_clear_tags(Depsgraph *graph)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Go over all operation nodes, clearing tags. */
|
|
|
|
|
{
|
|
|
|
|
const int num_operations = graph->operations.size();
|
2019-07-30 14:56:47 +02:00
|
|
|
TaskParallelSettings settings;
|
2019-04-17 06:17:24 +02:00
|
|
|
BLI_parallel_range_settings_defaults(&settings);
|
|
|
|
|
settings.min_iter_per_thread = 1024;
|
|
|
|
|
BLI_task_parallel_range(0, num_operations, graph, graph_clear_operation_func, &settings);
|
|
|
|
|
}
|
|
|
|
|
/* Clear any entry tags which haven't been flushed. */
|
|
|
|
|
BLI_gset_clear(graph->entry_tags, NULL);
|
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 DEG
|