This adds a new `ParallelMultiFunction` which wraps another multi-function and evaluates it with multiple threads. The speeds up field evaluation quite a bit (the effect is most noticeable when the number of evaluations and the field is large). There are still other single-threaded performance bottlenecks in field evaluation that will need to be solved separately. Most notably here is the process of copying the computed data into the position attribute in the Set Position node. Differential Revision: https://developer.blender.org/D12457
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
/*
|
|
* 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.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup fn
|
|
*/
|
|
|
|
#include "FN_multi_function.hh"
|
|
|
|
namespace blender::fn {
|
|
|
|
class ParallelMultiFunction : public MultiFunction {
|
|
private:
|
|
const MultiFunction &fn_;
|
|
const int64_t grain_size_;
|
|
bool threading_supported_;
|
|
|
|
public:
|
|
ParallelMultiFunction(const MultiFunction &fn, const int64_t grain_size);
|
|
|
|
void call(IndexMask mask, MFParams params, MFContext context) const override;
|
|
};
|
|
|
|
} // namespace blender::fn
|