Blender  V2.93
COM_CPUDevice.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2011, Blender Foundation.
17  */
18 
19 #include "COM_CPUDevice.h"
20 
21 #include "COM_ExecutionGroup.h"
22 
23 #include "BLI_rect.h"
24 
25 namespace blender::compositor {
26 
27 CPUDevice::CPUDevice(int thread_id) : m_thread_id(thread_id)
28 {
29 }
30 
31 void CPUDevice::execute(WorkPackage *work_package)
32 {
33  const unsigned int chunkNumber = work_package->chunk_number;
34  ExecutionGroup *executionGroup = work_package->execution_group;
35 
36  executionGroup->getOutputOperation()->executeRegion(&work_package->rect, chunkNumber);
37  executionGroup->finalizeChunkExecution(chunkNumber, nullptr);
38 }
39 
40 } // namespace blender::compositor
void execute(WorkPackage *work) override
execute a WorkPackage
Class ExecutionGroup is a group of Operations that are executed as one. This grouping is used to comb...
NodeOperation * getOutputOperation() const
get the output operation of this ExecutionGroup
void finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers)
after a chunk is executed the needed resources can be freed or unlocked.
virtual void executeRegion(rcti *, unsigned int)
when a chunk is executed by a CPUDevice, this method is called
contains data about work that can be scheduled
unsigned int chunk_number
number of the chunk to be executed
ExecutionGroup * execution_group
executionGroup with the operations-setup to be evaluated