• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2014 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 
7 #ifndef ANGLE_TEST_CONFIGS_H_
8 #define ANGLE_TEST_CONFIGS_H_
9 
10 // On Linux EGL/egl.h includes X.h which does defines for some very common
11 // names that are used by gtest (like None and Bool) and causes a lot of
12 // compilation errors. To work around this, even if this file doesn't use it,
13 // we include gtest before EGL so that it compiles fine in other files that
14 // want to use gtest.
15 #include <gtest/gtest.h>
16 
17 #include <EGL/egl.h>
18 #include <EGL/eglext.h>
19 
20 #include "angle_test_instantiate.h"
21 #include "util/EGLPlatformParameters.h"
22 
23 namespace angle
24 {
25 
26 struct PlatformParameters
27 {
28     PlatformParameters();
29     PlatformParameters(EGLenum clientType,
30                        EGLint majorVersion,
31                        EGLint minorVersion,
32                        EGLint profileMask,
33                        const EGLPlatformParameters &eglPlatformParameters);
34     PlatformParameters(EGLenum clientType,
35                        EGLint majorVersion,
36                        EGLint minorVersion,
37                        EGLint profileMask,
38                        GLESDriverType driver);
39 
40     EGLint getRenderer() const;
41     EGLint getDeviceType() const;
42     bool isSwiftshader() const;
43     bool isVulkan() const;
44     bool isANGLE() const;
45     bool isMetal() const;
46     bool isWebGPU() const;
47     bool isDesktopOpenGLFrontend() const;
48 
49     void initDefaultParameters();
50 
tiePlatformParameters51     auto tie() const
52     {
53         return std::tie(driver, noFixture, eglParameters, clientType, majorVersion, minorVersion,
54                         profileMask);
55     }
56 
57     // Helpers to enable and disable ANGLE features.  Expects a Feature::* value from
58     // angle_features_autogen.h.
enablePlatformParameters59     PlatformParameters &enable(Feature feature)
60     {
61         eglParameters.enable(feature);
62         return *this;
63     }
disablePlatformParameters64     PlatformParameters &disable(Feature feature)
65     {
66         eglParameters.disable(feature);
67         return *this;
68     }
69     bool isEnableRequested(Feature feature) const;
70     bool isDisableRequested(Feature feature) const;
71 
72     GLESDriverType driver;
73     bool noFixture;
74     EGLPlatformParameters eglParameters;
75     EGLenum clientType;
76     EGLint majorVersion;
77     EGLint minorVersion;
78     EGLint profileMask;
79 };
80 
81 const char *GetRendererName(EGLint renderer);
82 
83 bool operator<(const PlatformParameters &a, const PlatformParameters &b);
84 bool operator==(const PlatformParameters &a, const PlatformParameters &b);
85 std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp);
86 
87 // EGL platforms
88 namespace egl_platform
89 {
90 
91 EGLPlatformParameters DEFAULT();
92 EGLPlatformParameters DEFAULT_NULL();
93 
94 EGLPlatformParameters D3D9();
95 EGLPlatformParameters D3D9_NULL();
96 EGLPlatformParameters D3D9_REFERENCE();
97 
98 EGLPlatformParameters D3D11();
99 EGLPlatformParameters D3D11_PRESENT_PATH_FAST();
100 EGLPlatformParameters D3D11_FL11_1();
101 EGLPlatformParameters D3D11_FL11_0();
102 EGLPlatformParameters D3D11_FL10_1();
103 EGLPlatformParameters D3D11_FL10_0();
104 
105 EGLPlatformParameters D3D11_NULL();
106 
107 EGLPlatformParameters D3D11_WARP();
108 EGLPlatformParameters D3D11_FL11_1_WARP();
109 EGLPlatformParameters D3D11_FL11_0_WARP();
110 EGLPlatformParameters D3D11_FL10_1_WARP();
111 EGLPlatformParameters D3D11_FL10_0_WARP();
112 
113 EGLPlatformParameters D3D11_REFERENCE();
114 EGLPlatformParameters D3D11_FL11_1_REFERENCE();
115 EGLPlatformParameters D3D11_FL11_0_REFERENCE();
116 EGLPlatformParameters D3D11_FL10_1_REFERENCE();
117 EGLPlatformParameters D3D11_FL10_0_REFERENCE();
118 
119 EGLPlatformParameters METAL();
120 
121 EGLPlatformParameters OPENGL();
122 EGLPlatformParameters OPENGL(EGLint major, EGLint minor);
123 EGLPlatformParameters OPENGL_NULL();
124 
125 EGLPlatformParameters OPENGLES();
126 EGLPlatformParameters OPENGLES(EGLint major, EGLint minor);
127 EGLPlatformParameters OPENGLES_NULL();
128 
129 EGLPlatformParameters OPENGL_OR_GLES();
130 EGLPlatformParameters OPENGL_OR_GLES(EGLint major, EGLint minor);
131 EGLPlatformParameters OPENGL_OR_GLES_NULL();
132 
133 EGLPlatformParameters VULKAN();
134 EGLPlatformParameters VULKAN_NULL();
135 EGLPlatformParameters VULKAN_SWIFTSHADER();
136 
137 EGLPlatformParameters WEBGPU();
138 
139 }  // namespace egl_platform
140 
141 // ANGLE tests platforms
142 PlatformParameters ES1_D3D9();
143 PlatformParameters ES2_D3D9();
144 
145 PlatformParameters ES1_D3D11();
146 PlatformParameters ES2_D3D11();
147 PlatformParameters ES2_D3D11_PRESENT_PATH_FAST();
148 PlatformParameters ES2_D3D11_FL11_0();
149 PlatformParameters ES2_D3D11_FL10_1();
150 PlatformParameters ES2_D3D11_FL10_0();
151 
152 PlatformParameters ES2_D3D11_WARP();
153 PlatformParameters ES2_D3D11_FL11_0_WARP();
154 PlatformParameters ES2_D3D11_FL10_1_WARP();
155 PlatformParameters ES2_D3D11_FL10_0_WARP();
156 
157 PlatformParameters ES2_D3D11_REFERENCE();
158 PlatformParameters ES2_D3D11_FL11_0_REFERENCE();
159 PlatformParameters ES2_D3D11_FL10_1_REFERENCE();
160 PlatformParameters ES2_D3D11_FL10_0_REFERENCE();
161 
162 PlatformParameters ES3_D3D11();
163 PlatformParameters ES3_D3D11_FL11_1();
164 PlatformParameters ES3_D3D11_FL11_0();
165 PlatformParameters ES3_D3D11_FL10_1();
166 PlatformParameters ES31_D3D11();
167 PlatformParameters ES31_D3D11_FL11_1();
168 PlatformParameters ES31_D3D11_FL11_0();
169 
170 PlatformParameters ES3_D3D11_WARP();
171 PlatformParameters ES3_D3D11_FL11_1_WARP();
172 PlatformParameters ES3_D3D11_FL11_0_WARP();
173 PlatformParameters ES3_D3D11_FL10_1_WARP();
174 
175 PlatformParameters ES1_OPENGL();
176 PlatformParameters ES2_OPENGL();
177 PlatformParameters ES2_OPENGL(EGLint major, EGLint minor);
178 PlatformParameters ES3_OPENGL();
179 PlatformParameters ES3_OPENGL(EGLint major, EGLint minor);
180 PlatformParameters ES31_OPENGL();
181 PlatformParameters ES31_OPENGL(EGLint major, EGLint minor);
182 
183 PlatformParameters ES1_OPENGLES();
184 PlatformParameters ES2_OPENGLES();
185 PlatformParameters ES2_OPENGLES(EGLint major, EGLint minor);
186 PlatformParameters ES3_OPENGLES();
187 PlatformParameters ES3_OPENGLES(EGLint major, EGLint minor);
188 PlatformParameters ES31_OPENGLES();
189 PlatformParameters ES31_OPENGLES(EGLint major, EGLint minor);
190 
191 PlatformParameters ES1_NULL();
192 PlatformParameters ES2_NULL();
193 PlatformParameters ES3_NULL();
194 PlatformParameters ES31_NULL();
195 
196 PlatformParameters ES1_VULKAN();
197 PlatformParameters ES1_VULKAN_NULL();
198 PlatformParameters ES1_VULKAN_SWIFTSHADER();
199 PlatformParameters ES2_VULKAN();
200 PlatformParameters ES2_VULKAN_NULL();
201 PlatformParameters ES2_VULKAN_SWIFTSHADER();
202 PlatformParameters ES3_VULKAN();
203 PlatformParameters ES3_VULKAN_NULL();
204 PlatformParameters ES3_VULKAN_SWIFTSHADER();
205 PlatformParameters ES31_VULKAN();
206 PlatformParameters ES31_VULKAN_NULL();
207 PlatformParameters ES31_VULKAN_SWIFTSHADER();
208 PlatformParameters ES32_VULKAN();
209 PlatformParameters ES32_VULKAN_NULL();
210 PlatformParameters ES32_VULKAN_SWIFTSHADER();
211 PlatformParameters GL32_CORE_VULKAN();
212 PlatformParameters GL32_CORE_VULKAN_SWIFTSHADER();
213 
214 PlatformParameters ES1_METAL();
215 PlatformParameters ES2_METAL();
216 PlatformParameters ES3_METAL();
217 
218 PlatformParameters ES2_WGL();
219 PlatformParameters ES3_WGL();
220 
221 PlatformParameters ES1_EGL();
222 PlatformParameters ES2_EGL();
223 PlatformParameters ES3_EGL();
224 PlatformParameters ES31_EGL();
225 PlatformParameters ES32_EGL();
226 
227 PlatformParameters ES1_ANGLE_Vulkan_Secondaries();
228 PlatformParameters ES2_ANGLE_Vulkan_Secondaries();
229 PlatformParameters ES3_ANGLE_Vulkan_Secondaries();
230 PlatformParameters ES31_ANGLE_Vulkan_Secondaries();
231 PlatformParameters ES32_ANGLE_Vulkan_Secondaries();
232 
233 PlatformParameters ES2_WEBGPU();
234 
235 PlatformParameters ES1_Zink();
236 PlatformParameters ES2_Zink();
237 PlatformParameters ES3_Zink();
238 PlatformParameters ES31_Zink();
239 PlatformParameters ES32_Zink();
240 
241 const char *GetNativeEGLLibraryNameWithExtension();
242 
WithNoFixture(const PlatformParameters & params)243 inline PlatformParameters WithNoFixture(const PlatformParameters &params)
244 {
245     PlatformParameters withNoFixture = params;
246     withNoFixture.noFixture          = true;
247     return withNoFixture;
248 }
249 
WithRobustness(const PlatformParameters & params)250 inline PlatformParameters WithRobustness(const PlatformParameters &params)
251 {
252     PlatformParameters withRobustness       = params;
253     withRobustness.eglParameters.robustness = EGL_TRUE;
254     return withRobustness;
255 }
256 
WithLowPowerGPU(const PlatformParameters & paramsIn)257 inline PlatformParameters WithLowPowerGPU(const PlatformParameters &paramsIn)
258 {
259     PlatformParameters paramsOut                   = paramsIn;
260     paramsOut.eglParameters.displayPowerPreference = EGL_LOW_POWER_ANGLE;
261     return paramsOut;
262 }
263 
WithHighPowerGPU(const PlatformParameters & paramsIn)264 inline PlatformParameters WithHighPowerGPU(const PlatformParameters &paramsIn)
265 {
266     PlatformParameters paramsOut                   = paramsIn;
267     paramsOut.eglParameters.displayPowerPreference = EGL_HIGH_POWER_ANGLE;
268     return paramsOut;
269 }
270 
WithVulkanSecondaries(const PlatformParameters & params)271 inline PlatformParameters WithVulkanSecondaries(const PlatformParameters &params)
272 {
273     PlatformParameters paramsOut = params;
274     paramsOut.driver             = GLESDriverType::AngleVulkanSecondariesEGL;
275     return paramsOut;
276 }
277 }  // namespace angle
278 
279 #endif  // ANGLE_TEST_CONFIGS_H_
280