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 // The GLES driver type determines what shared object we use to load the GLES entry points.
27 // AngleEGL loads from ANGLE's version of libEGL, libGLESv2, and libGLESv1_CM.
28 // SystemEGL uses the system copies of libEGL, libGLESv2, and libGLESv1_CM.
29 // SystemWGL loads Windows GL with the GLES compatiblity extensions. See util/WGLWindow.h.
30 enum class GLESDriverType
31 {
32 AngleEGL,
33 SystemEGL,
34 SystemWGL,
35 };
36
37 struct PlatformParameters
38 {
39 PlatformParameters();
40 PlatformParameters(EGLint majorVersion,
41 EGLint minorVersion,
42 const EGLPlatformParameters &eglPlatformParameters);
43 PlatformParameters(EGLint majorVersion, EGLint minorVersion, GLESDriverType driver);
44
45 EGLint getRenderer() const;
46 EGLint getDeviceType() const;
47 bool isSwiftshader() const;
48
49 void initDefaultParameters();
50
tiePlatformParameters51 auto tie() const
52 {
53 return std::tie(driver, noFixture, eglParameters, majorVersion, minorVersion);
54 }
55
56 GLESDriverType driver;
57 bool noFixture;
58 EGLPlatformParameters eglParameters;
59 EGLint majorVersion;
60 EGLint minorVersion;
61 };
62
63 const char *GetRendererName(EGLint renderer);
64
65 bool operator<(const PlatformParameters &a, const PlatformParameters &b);
66 bool operator==(const PlatformParameters &a, const PlatformParameters &b);
67 std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp);
68
69 // EGL platforms
70 namespace egl_platform
71 {
72
73 EGLPlatformParameters DEFAULT();
74 EGLPlatformParameters DEFAULT_NULL();
75
76 EGLPlatformParameters D3D9();
77 EGLPlatformParameters D3D9_NULL();
78 EGLPlatformParameters D3D9_REFERENCE();
79
80 EGLPlatformParameters D3D11();
81 EGLPlatformParameters D3D11_PRESENT_PATH_FAST();
82 EGLPlatformParameters D3D11_FL11_1();
83 EGLPlatformParameters D3D11_FL11_0();
84 EGLPlatformParameters D3D11_FL10_1();
85 EGLPlatformParameters D3D11_FL10_0();
86 EGLPlatformParameters D3D11_FL9_3();
87
88 EGLPlatformParameters D3D11_NULL();
89
90 EGLPlatformParameters D3D11_WARP();
91 EGLPlatformParameters D3D11_FL11_1_WARP();
92 EGLPlatformParameters D3D11_FL11_0_WARP();
93 EGLPlatformParameters D3D11_FL10_1_WARP();
94 EGLPlatformParameters D3D11_FL10_0_WARP();
95 EGLPlatformParameters D3D11_FL9_3_WARP();
96
97 EGLPlatformParameters D3D11_REFERENCE();
98 EGLPlatformParameters D3D11_FL11_1_REFERENCE();
99 EGLPlatformParameters D3D11_FL11_0_REFERENCE();
100 EGLPlatformParameters D3D11_FL10_1_REFERENCE();
101 EGLPlatformParameters D3D11_FL10_0_REFERENCE();
102 EGLPlatformParameters D3D11_FL9_3_REFERENCE();
103
104 EGLPlatformParameters OPENGL();
105 EGLPlatformParameters OPENGL(EGLint major, EGLint minor);
106 EGLPlatformParameters OPENGL_NULL();
107
108 EGLPlatformParameters OPENGLES();
109 EGLPlatformParameters OPENGLES(EGLint major, EGLint minor);
110 EGLPlatformParameters OPENGLES_NULL();
111
112 EGLPlatformParameters OPENGL_OR_GLES();
113 EGLPlatformParameters OPENGL_OR_GLES(EGLint major, EGLint minor);
114 EGLPlatformParameters OPENGL_OR_GLES_NULL();
115
116 EGLPlatformParameters VULKAN();
117 EGLPlatformParameters VULKAN_NULL();
118 EGLPlatformParameters VULKAN_SWIFTSHADER();
119
120 } // namespace egl_platform
121
122 // ANGLE tests platforms
123 PlatformParameters ES1_D3D9();
124 PlatformParameters ES2_D3D9();
125
126 PlatformParameters ES1_D3D11();
127 PlatformParameters ES2_D3D11();
128 PlatformParameters ES2_D3D11_PRESENT_PATH_FAST();
129 PlatformParameters ES2_D3D11_FL11_0();
130 PlatformParameters ES2_D3D11_FL10_1();
131 PlatformParameters ES2_D3D11_FL10_0();
132 PlatformParameters ES2_D3D11_FL9_3();
133
134 PlatformParameters ES2_D3D11_WARP();
135 PlatformParameters ES2_D3D11_FL11_0_WARP();
136 PlatformParameters ES2_D3D11_FL10_1_WARP();
137 PlatformParameters ES2_D3D11_FL10_0_WARP();
138 PlatformParameters ES2_D3D11_FL9_3_WARP();
139
140 PlatformParameters ES2_D3D11_REFERENCE();
141 PlatformParameters ES2_D3D11_FL11_0_REFERENCE();
142 PlatformParameters ES2_D3D11_FL10_1_REFERENCE();
143 PlatformParameters ES2_D3D11_FL10_0_REFERENCE();
144 PlatformParameters ES2_D3D11_FL9_3_REFERENCE();
145
146 PlatformParameters ES3_D3D11();
147 PlatformParameters ES3_D3D11_FL11_1();
148 PlatformParameters ES3_D3D11_FL11_0();
149 PlatformParameters ES3_D3D11_FL10_1();
150 PlatformParameters ES31_D3D11();
151 PlatformParameters ES31_D3D11_FL11_1();
152 PlatformParameters ES31_D3D11_FL11_0();
153
154 PlatformParameters ES3_D3D11_WARP();
155 PlatformParameters ES3_D3D11_FL11_1_WARP();
156 PlatformParameters ES3_D3D11_FL11_0_WARP();
157 PlatformParameters ES3_D3D11_FL10_1_WARP();
158
159 PlatformParameters ES1_OPENGL();
160 PlatformParameters ES2_OPENGL();
161 PlatformParameters ES2_OPENGL(EGLint major, EGLint minor);
162 PlatformParameters ES3_OPENGL();
163 PlatformParameters ES3_OPENGL(EGLint major, EGLint minor);
164 PlatformParameters ES31_OPENGL();
165 PlatformParameters ES31_OPENGL(EGLint major, EGLint minor);
166
167 PlatformParameters ES1_OPENGLES();
168 PlatformParameters ES2_OPENGLES();
169 PlatformParameters ES2_OPENGLES(EGLint major, EGLint minor);
170 PlatformParameters ES3_OPENGLES();
171 PlatformParameters ES3_OPENGLES(EGLint major, EGLint minor);
172 PlatformParameters ES31_OPENGLES();
173 PlatformParameters ES31_OPENGLES(EGLint major, EGLint minor);
174
175 PlatformParameters ES1_NULL();
176 PlatformParameters ES2_NULL();
177 PlatformParameters ES3_NULL();
178 PlatformParameters ES31_NULL();
179
180 PlatformParameters ES1_VULKAN();
181 PlatformParameters ES1_VULKAN_NULL();
182 PlatformParameters ES1_VULKAN_SWIFTSHADER();
183 PlatformParameters ES2_VULKAN();
184 PlatformParameters ES2_VULKAN_NULL();
185 PlatformParameters ES2_VULKAN_SWIFTSHADER();
186 PlatformParameters ES3_VULKAN();
187 PlatformParameters ES3_VULKAN_NULL();
188 PlatformParameters ES3_VULKAN_SWIFTSHADER();
189 PlatformParameters ES31_VULKAN();
190 PlatformParameters ES31_VULKAN_NULL();
191 PlatformParameters ES31_VULKAN_SWIFTSHADER();
192
193 PlatformParameters ES1_METAL();
194 PlatformParameters ES2_METAL();
195 PlatformParameters ES3_METAL();
196
197 PlatformParameters ES2_WGL();
198 PlatformParameters ES3_WGL();
199
WithNoVirtualContexts(const PlatformParameters & params)200 inline PlatformParameters WithNoVirtualContexts(const PlatformParameters ¶ms)
201 {
202 PlatformParameters withNoVirtualContexts = params;
203 withNoVirtualContexts.eglParameters.contextVirtualization = EGL_FALSE;
204 return withNoVirtualContexts;
205 }
206
WithNoFixture(const PlatformParameters & params)207 inline PlatformParameters WithNoFixture(const PlatformParameters ¶ms)
208 {
209 PlatformParameters withNoFixture = params;
210 withNoFixture.noFixture = true;
211 return withNoFixture;
212 }
213
WithNoTransformFeedback(const PlatformParameters & params)214 inline PlatformParameters WithNoTransformFeedback(const PlatformParameters ¶ms)
215 {
216 PlatformParameters withNoTransformFeedback = params;
217 withNoTransformFeedback.eglParameters.transformFeedbackFeature = EGL_FALSE;
218 return withNoTransformFeedback;
219 }
220
WithAllocateNonZeroMemory(const PlatformParameters & params)221 inline PlatformParameters WithAllocateNonZeroMemory(const PlatformParameters ¶ms)
222 {
223 PlatformParameters allocateNonZero = params;
224 allocateNonZero.eglParameters.allocateNonZeroMemoryFeature = EGL_TRUE;
225 return allocateNonZero;
226 }
227
WithRobustness(const PlatformParameters & params)228 inline PlatformParameters WithRobustness(const PlatformParameters ¶ms)
229 {
230 PlatformParameters withRobustness = params;
231 withRobustness.eglParameters.robustness = EGL_TRUE;
232 return withRobustness;
233 }
234 } // namespace angle
235
236 #endif // ANGLE_TEST_CONFIGS_H_
237