Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #ifndef INCLUDED_OPENCL_OPENCLCONFIG_HXX
11 : #define INCLUDED_OPENCL_OPENCLCONFIG_HXX
12 :
13 : #include <ostream>
14 : #include <set>
15 :
16 : #include <opencl/opencldllapi.h>
17 : #include <opencl/platforminfo.hxx>
18 : #include <rtl/ustring.hxx>
19 :
20 : #include <com/sun/star/uno/Sequence.hxx>
21 :
22 0 : struct OPENCL_DLLPUBLIC OpenCLConfig
23 : {
24 0 : struct ImplMatcher
25 : {
26 : OUString maOS;
27 : OUString maOSVersion;
28 : OUString maPlatformVendor;
29 : OUString maDevice;
30 : OUString maDriverVersion;
31 :
32 0 : ImplMatcher()
33 0 : {
34 0 : }
35 :
36 0 : ImplMatcher(const OUString& rOS,
37 : const OUString& rOSVersion,
38 : const OUString& rPlatformVendor,
39 : const OUString& rDevice,
40 : const OUString& rDriverVersion)
41 : : maOS(rOS),
42 : maOSVersion(rOSVersion),
43 : maPlatformVendor(rPlatformVendor),
44 : maDevice(rDevice),
45 0 : maDriverVersion(rDriverVersion)
46 : {
47 0 : }
48 :
49 0 : bool operator==(const ImplMatcher& r) const
50 : {
51 0 : return maOS == r.maOS &&
52 0 : maOSVersion == r.maOSVersion &&
53 0 : maPlatformVendor == r.maPlatformVendor &&
54 0 : maDevice == r.maDevice &&
55 0 : maDriverVersion == r.maDriverVersion;
56 : }
57 0 : bool operator!=(const ImplMatcher& r) const
58 : {
59 0 : return !operator==(r);
60 : }
61 0 : bool operator<(const ImplMatcher& r) const
62 : {
63 0 : return (maOS < r.maOS ||
64 0 : (maOS == r.maOS &&
65 0 : (maOSVersion < r.maOSVersion ||
66 0 : (maOSVersion == r.maOSVersion &&
67 0 : (maPlatformVendor < r.maPlatformVendor ||
68 0 : (maPlatformVendor == r.maPlatformVendor &&
69 0 : (maDevice < r.maDevice ||
70 0 : (maDevice == r.maDevice &&
71 0 : (maDriverVersion < r.maDriverVersion)))))))));
72 : }
73 : };
74 :
75 : bool mbUseOpenCL;
76 :
77 : typedef std::set<ImplMatcher> ImplMatcherSet;
78 :
79 : ImplMatcherSet maBlackList;
80 : ImplMatcherSet maWhiteList;
81 :
82 : OpenCLConfig();
83 :
84 : bool operator== (const OpenCLConfig& r) const;
85 : bool operator!= (const OpenCLConfig& r) const;
86 :
87 : static OpenCLConfig get();
88 :
89 : void set();
90 :
91 : bool checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const;
92 : };
93 :
94 : OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig);
95 : OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl);
96 : OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet);
97 :
98 : #endif
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|