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 compatibility 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, transformFeedbackFeature, allocateNonZeroMemoryFeature, 63 emulateCopyTexImage2DFromRenderbuffers, shaderStencilOutputFeature, 64 genMultipleMipsPerPassFeature, platformMethods, robustness, 65 emulatedPrerotation, asyncCommandQueueFeatureVulkan, 66 hasExplicitMemBarrierFeatureMtl, hasCheapRenderPassFeatureMtl, 67 forceBufferGPUStorageFeatureMtl, supportsVulkanViewportFlip, 68 supportsVulkanMultiDrawIndirect, emulatedVAOs, generateSPIRVThroughGlslang, 69 captureLimits, forceRobustResourceInit, directMetalGeneration, 70 forceInitShaderVariables, forceVulkanFallbackFormat, 71 displayPowerPreference); 72 } 73 74 EGLint renderer = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; 75 EGLint majorVersion = EGL_DONT_CARE; 76 EGLint minorVersion = EGL_DONT_CARE; 77 EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE; 78 EGLint presentPath = EGL_DONT_CARE; 79 EGLint debugLayersEnabled = EGL_DONT_CARE; 80 EGLint robustness = EGL_DONT_CARE; 81 EGLint transformFeedbackFeature = EGL_DONT_CARE; 82 EGLint allocateNonZeroMemoryFeature = EGL_DONT_CARE; 83 EGLint emulateCopyTexImage2DFromRenderbuffers = EGL_DONT_CARE; 84 EGLint shaderStencilOutputFeature = EGL_DONT_CARE; 85 EGLint genMultipleMipsPerPassFeature = EGL_DONT_CARE; 86 uint32_t emulatedPrerotation = 0; // Can be 0, 90, 180 or 270 87 EGLint asyncCommandQueueFeatureVulkan = EGL_DONT_CARE; 88 EGLint hasExplicitMemBarrierFeatureMtl = EGL_DONT_CARE; 89 EGLint hasCheapRenderPassFeatureMtl = EGL_DONT_CARE; 90 EGLint forceBufferGPUStorageFeatureMtl = EGL_DONT_CARE; 91 EGLint supportsVulkanViewportFlip = EGL_DONT_CARE; 92 EGLint supportsVulkanMultiDrawIndirect = EGL_DONT_CARE; 93 EGLint emulatedVAOs = EGL_DONT_CARE; 94 EGLint generateSPIRVThroughGlslang = EGL_DONT_CARE; 95 EGLint captureLimits = EGL_DONT_CARE; 96 EGLint forceRobustResourceInit = EGL_DONT_CARE; 97 EGLint directMetalGeneration = EGL_DONT_CARE; 98 EGLint forceInitShaderVariables = EGL_DONT_CARE; 99 EGLint forceVulkanFallbackFormat = EGL_DONT_CARE; 100 EGLint displayPowerPreference = EGL_DONT_CARE; 101 102 angle::PlatformMethods *platformMethods = nullptr; 103 }; 104 105 inline bool operator<(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 106 { 107 return a.tie() < b.tie(); 108 } 109 110 inline bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 111 { 112 return a.tie() == b.tie(); 113 } 114 115 inline bool operator!=(const EGLPlatformParameters &a, const EGLPlatformParameters &b) 116 { 117 return a.tie() != b.tie(); 118 } 119 120 #endif // UTIL_EGLPLATFORMPARAMETERS_H_ 121