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 19 // The GLES driver type determines what shared object we use to load the GLES entry points. 20 // AngleEGL loads from ANGLE's version of libEGL, libGLESv2, and libGLESv1_CM. 21 // SystemEGL uses the system copies of libEGL, libGLESv2, and libGLESv1_CM. 22 // SystemWGL loads Windows GL with the GLES compatiblity extensions. See util/WGLWindow.h. 23 enum class GLESDriverType 24 { 25 AngleEGL, 26 SystemEGL, 27 SystemWGL, 28 }; 29 } // namespace angle 30 31 struct EGLPlatformParameters 32 { 33 EGLPlatformParameters() = default; 34 EGLPlatformParametersEGLPlatformParameters35 explicit EGLPlatformParameters(EGLint renderer) : renderer(renderer) {} 36 EGLPlatformParametersEGLPlatformParameters37 EGLPlatformParameters(EGLint renderer, 38 EGLint majorVersion, 39 EGLint minorVersion, 40 EGLint deviceType) 41 : renderer(renderer), 42 majorVersion(majorVersion), 43 minorVersion(minorVersion), 44 deviceType(deviceType) 45 {} 46 EGLPlatformParametersEGLPlatformParameters47 EGLPlatformParameters(EGLint renderer, 48 EGLint majorVersion, 49 EGLint minorVersion, 50 EGLint deviceType, 51 EGLint presentPath) 52 : renderer(renderer), 53 majorVersion(majorVersion), 54 minorVersion(minorVersion), 55 deviceType(deviceType), 56 presentPath(presentPath) 57 {} 58 tieEGLPlatformParameters59 auto tie() const 60 { 61 return std::tie(renderer, majorVersion, minorVersion, deviceType, presentPath, 62 debugLayersEnabled, contextVirtualization, transformFeedbackFeature, 63 allocateNonZeroMemoryFeature, emulateCopyTexImage2DFromRenderbuffers, 64 platformMethods, robustness); 65 } 66 67 EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; 68 EGLint majorVersion = EGL_DONT_CARE; 69 EGLint minorVersion = EGL_DONT_CARE; 70 EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE; 71 EGLint presentPath = EGL_DONT_CARE; 72 EGLint debugLayersEnabled = EGL_DONT_CARE; 73 EGLint contextVirtualization = EGL_DONT_CARE; 74 EGLint robustness = EGL_DONT_CARE; 75 EGLint transformFeedbackFeature = EGL_DONT_CARE; 76 EGLint allocateNonZeroMemoryFeature = EGL_DONT_CARE; 77 EGLint emulateCopyTexImage2DFromRenderbuffers = EGL_DONT_CARE; 78 angle::PlatformMethods *platformMethods = nullptr; 79 }; 80 81 inline bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 82 { 83 return a.tie() < b.tie(); 84 } 85 86 inline bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 87 { 88 return a.tie() == b.tie(); 89 } 90 91 inline bool operator!=(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 92 { 93 return a.tie() != b.tie(); 94 } 95 96 #endif // UTIL_EGLPLATFORMPARAMETERS_H_ 97