forked from smistad/OpenCLUtilityLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceCriteria.hpp
48 lines (37 loc) · 1.82 KB
/
DeviceCriteria.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef DEVICECRITERIA_HPP_
#define DEVICECRITERIA_HPP_
#include <vector>
namespace oul {
enum DeviceType {DEVICE_TYPE_ANY, DEVICE_TYPE_GPU, DEVICE_TYPE_CPU};
enum DevicePlatform {DEVICE_PLATFORM_ANY, DEVICE_PLATFORM_AMD, DEVICE_PLATFORM_NVIDIA, DEVICE_PLATFORM_INTEL, DEVICE_PLATFORM_APPLE};
enum DeviceCapability {DEVICE_CAPABILITY_OPENGL_INTEROP};
enum DevicePreference {DEVICE_PREFERENCE_NONE, DEVICE_PREFERENCE_NOT_CONNECTED_TO_SCREEN, DEVICE_PREFERENCE_COMPUTE_UNITS, DEVICE_PREFERENCE_GLOBAL_MEMORY};
/**
* Class used to set up a set of criteria for choosing devices
*/
class DeviceCriteria {
public:
DeviceCriteria();
void setPlatformCriteria(DevicePlatform platform);
void setCapabilityCriteria(DeviceCapability capability);
void setTypeCriteria(DeviceType typeCriteria);
void setDevicePreference(DevicePreference preference);
void setDeviceCountCriteria(unsigned int min, unsigned int max);
void setDeviceCountCriteria(unsigned int count);
const std::vector<DeviceCapability>& getCapabilityCriteria() const;
DevicePlatform getPlatformCriteria() const;
DeviceType getTypeCriteria() const;
DevicePreference getDevicePreference() const;
unsigned int getDeviceCountMinCriteria() const;
unsigned int getDeviceCountMaxCriteria() const;
bool hasCapabilityCriteria(DeviceCapability capability) const;
private:
DevicePlatform platformCriteria;
DeviceType typeCriteria; // Can only be one
DevicePreference devicePreference; // Currently only support one preference
std::vector<DeviceCapability> capabilityCriteria; // If multiple capabilities are selected, all of them have to be true
unsigned int deviceCountMin;
unsigned int deviceCountMax;
};
};
#endif /* DEVICECRITERIA_HPP_ */