• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // EGLPlatformParameters: Basic description of an EGL device.
7 
8 #ifndef UTIL_EGLPLATFORMPARAMETERS_H_
9 #define UTIL_EGLPLATFORMPARAMETERS_H_
10 
11 #include "util/util_gl.h"
12 
13 #include <tuple>
14 
15 namespace angle
16 {
17 struct PlatformMethods;
18 }  // namespace angle
19 
20 struct EGLPlatformParameters
21 {
22     EGLPlatformParameters() = default;
23 
EGLPlatformParametersEGLPlatformParameters24     explicit EGLPlatformParameters(EGLint renderer) : renderer(renderer) {}
25 
EGLPlatformParametersEGLPlatformParameters26     EGLPlatformParameters(EGLint renderer,
27                           EGLint majorVersion,
28                           EGLint minorVersion,
29                           EGLint deviceType)
30         : renderer(renderer),
31           majorVersion(majorVersion),
32           minorVersion(minorVersion),
33           deviceType(deviceType)
34     {}
35 
EGLPlatformParametersEGLPlatformParameters36     EGLPlatformParameters(EGLint renderer,
37                           EGLint majorVersion,
38                           EGLint minorVersion,
39                           EGLint deviceType,
40                           EGLint presentPath)
41         : renderer(renderer),
42           majorVersion(majorVersion),
43           minorVersion(minorVersion),
44           deviceType(deviceType),
45           presentPath(presentPath)
46     {}
47 
tieEGLPlatformParameters48     auto tie() const
49     {
50         return std::tie(renderer, majorVersion, minorVersion, deviceType, presentPath,
51                         debugLayersEnabled, contextVirtualization, platformMethods);
52     }
53 
54     EGLint renderer                         = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
55     EGLint majorVersion                     = EGL_DONT_CARE;
56     EGLint minorVersion                     = EGL_DONT_CARE;
57     EGLint deviceType                       = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
58     EGLint presentPath                      = EGL_DONT_CARE;
59     EGLint debugLayersEnabled               = EGL_DONT_CARE;
60     EGLint contextVirtualization            = EGL_DONT_CARE;
61     angle::PlatformMethods *platformMethods = nullptr;
62 };
63 
64 inline bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
65 {
66     return a.tie() < b.tie();
67 }
68 
69 inline bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
70 {
71     return a.tie() == b.tie();
72 }
73 
74 inline bool operator!=(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
75 {
76     return a.tie() != b.tie();
77 }
78 
79 #endif  // UTIL_EGLPLATFORMPARAMETERS_H_
80