Beatmup
parallelism.cpp
Go to the documentation of this file.
1 /*
2  Beatmup image and signal processing library
3  Copyright (C) 2019, lnstadrum
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include "parallelism.h"
20 #include "exception.h"
21 
22 using namespace Beatmup;
23 
25  // nothing to do by default
26 }
27 
28 
30  // nothing to do by default
31 }
32 
33 
35  // nothing to do by default
36  return true;
37 }
38 
39 
41  return 1;
42 }
43 
44 
46  if (number < 1)
47  return 1;
48  if (number > MAX_THREAD_INDEX)
49  return MAX_THREAD_INDEX;
50  return number;
51 }
52 
53 
56 }
static ThreadIndex validThreadCount(int number)
Valid thread count from a given integer value.
Definition: parallelism.cpp:45
TaskDeviceRequirement
Specifies which device (CPU and/or GPU) is used to run the task.
Definition: parallelism.h:95
@ CPU_ONLY
this task does not use GPU
virtual TaskDeviceRequirement getUsedDevices() const
Communicates devices (CPU and/or GPU) the task is run on.
Definition: parallelism.cpp:54
virtual void beforeProcessing(ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu)
Instruction called before the task is executed.
Definition: parallelism.cpp:24
virtual bool processOnGPU(GraphicPipeline &gpu, TaskThread &thread)
Executes the task on GPU.
Definition: parallelism.cpp:34
virtual ThreadIndex getMaxThreads() const
Gives the upper limint on the number of threads the task may be performed by.
Definition: parallelism.cpp:40
virtual void afterProcessing(ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted)
Instruction called after the task is executed.
Definition: parallelism.cpp:29
Internal low-level GPU control API.
Definition: pipeline.h:33
Thread executing tasks.
Definition: parallelism.h:154
unsigned char ThreadIndex
number of threads / thread index
Definition: parallelism.h:68
static const ThreadIndex MAX_THREAD_INDEX
maximum possible thread index value
Definition: parallelism.h:71
ProcessingTarget
Definition: basic_types.h:55