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 shaderStencilOutputFeature, genMultipleMipsPerPassFeature, platformMethods, 65 robustness, emulatedPrerotation, asyncCommandQueueFeatureVulkan, 66 hasExplicitMemBarrierFeatureMtl, hasCheapRenderPassFeatureMtl, 67 forceBufferGPUStorageFeatureMtl); 68 } 69 70 EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; 71 EGLint majorVersion = EGL_DONT_CARE; 72 EGLint minorVersion = EGL_DONT_CARE; 73 EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE; 74 EGLint presentPath = EGL_DONT_CARE; 75 EGLint debugLayersEnabled = EGL_DONT_CARE; 76 EGLint contextVirtualization = EGL_DONT_CARE; 77 EGLint robustness = EGL_DONT_CARE; 78 EGLint transformFeedbackFeature = EGL_DONT_CARE; 79 EGLint allocateNonZeroMemoryFeature = EGL_DONT_CARE; 80 EGLint emulateCopyTexImage2DFromRenderbuffers = EGL_DONT_CARE; 81 EGLint shaderStencilOutputFeature = EGL_DONT_CARE; 82 EGLint genMultipleMipsPerPassFeature = EGL_DONT_CARE; 83 uint32_t emulatedPrerotation = 0; // Can be 0, 90, 180 or 270 84 EGLint asyncCommandQueueFeatureVulkan = EGL_DONT_CARE; 85 EGLint hasExplicitMemBarrierFeatureMtl = EGL_DONT_CARE; 86 EGLint hasCheapRenderPassFeatureMtl = EGL_DONT_CARE; 87 EGLint forceBufferGPUStorageFeatureMtl = EGL_DONT_CARE; 88 angle::PlatformMethods *platformMethods = nullptr; 89 }; 90 91 inline bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 92 { 93 return a.tie() < b.tie(); 94 } 95 96 inline bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 97 { 98 return a.tie() == b.tie(); 99 } 100 101 inline bool operator!=(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 102 { 103 return a.tie() != b.tie(); 104 } 105 106 #endif // UTIL_EGLPLATFORMPARAMETERS_H_ 107