Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / command_buffer / service / feature_info_unittest.cc
blob8321e6868ca645cd8a3d02b799a0858e4af21de0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gpu/command_buffer/service/feature_info.h"
7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_number_conversions.h"
10 #include "gpu/command_buffer/service/gpu_service_test.h"
11 #include "gpu/command_buffer/service/gpu_switches.h"
12 #include "gpu/command_buffer/service/test_helper.h"
13 #include "gpu/command_buffer/service/texture_manager.h"
14 #include "gpu/config/gpu_driver_bug_workaround_type.h"
15 #include "gpu/config/gpu_switches.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gl/gl_fence.h"
18 #include "ui/gl/gl_implementation.h"
19 #include "ui/gl/gl_mock.h"
21 using ::testing::_;
22 using ::testing::DoAll;
23 using ::testing::HasSubstr;
24 using ::testing::InSequence;
25 using ::testing::MatcherCast;
26 using ::testing::Not;
27 using ::testing::Pointee;
28 using ::testing::Return;
29 using ::testing::SetArrayArgument;
30 using ::testing::SetArgumentPointee;
31 using ::testing::StrEq;
33 namespace gpu {
34 namespace gles2 {
36 namespace {
37 const char kGLRendererStringANGLE[] = "ANGLE (some renderer)";
38 } // anonymous namespace
40 enum MockedGLVersionKind {
41 Version3_0,
42 Version3_2Compatibility
45 class FeatureInfoTest
46 : public GpuServiceTest,
47 public ::testing::WithParamInterface<MockedGLVersionKind> {
48 public:
49 FeatureInfoTest() {
52 void SetupInitExpectations(const char* extensions) {
53 std::string extensions_str = extensions;
54 // Most of the tests' expectations currently assume the desktop
55 // OpenGL compatibility profile.
56 switch (GetParam()) {
57 case Version3_0:
58 SetupInitExpectationsWithGLVersion(extensions_str.c_str(), "", "3.0");
59 break;
60 case Version3_2Compatibility:
61 if (extensions_str.find("GL_ARB_compatibility") == std::string::npos) {
62 extensions_str += " GL_ARB_compatibility";
64 SetupInitExpectationsWithGLVersion(extensions_str.c_str(), "", "3.2");
65 break;
66 default:
67 NOTREACHED();
68 break;
72 void SetupInitExpectationsWithGLVersion(
73 const char* extensions, const char* renderer, const char* version) {
74 GpuServiceTest::SetUpWithGLVersion(version, extensions);
75 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
76 gl_.get(), extensions, renderer, version);
77 info_ = new FeatureInfo();
78 info_->Initialize();
81 void SetupInitExpectationsWithGLVersionAndCommandLine(
82 const char* extensions,
83 const char* renderer,
84 const char* version,
85 const base::CommandLine& command_line) {
86 GpuServiceTest::SetUpWithGLVersion(version, extensions);
87 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
88 gl_.get(), extensions, renderer, version);
89 info_ = new FeatureInfo(command_line);
90 info_->Initialize();
93 void SetupWithCommandLine(const base::CommandLine& command_line) {
94 GpuServiceTest::SetUp();
95 info_ = new FeatureInfo(command_line);
98 void SetupInitExpectationsWithCommandLine(
99 const char* extensions,
100 const base::CommandLine& command_line) {
101 GpuServiceTest::SetUpWithGLVersion("2.0", extensions);
102 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
103 gl_.get(), extensions, "", "");
104 info_ = new FeatureInfo(command_line);
105 info_->Initialize();
108 void SetupWithoutInit() {
109 GpuServiceTest::SetUp();
110 info_ = new FeatureInfo();
113 protected:
114 void SetUp() override {
115 // Do nothing here, since we are using the explicit Setup*() functions.
118 void TearDown() override {
119 info_ = NULL;
120 GpuServiceTest::TearDown();
123 scoped_refptr<FeatureInfo> info_;
126 namespace {
128 struct FormatInfo {
129 GLenum format;
130 const GLenum* types;
131 size_t count;
134 } // anonymous namespace.
136 static const MockedGLVersionKind kGLVersionKinds[] = {
137 Version3_0,
138 Version3_2Compatibility
141 INSTANTIATE_TEST_CASE_P(Service,
142 FeatureInfoTest,
143 ::testing::ValuesIn(kGLVersionKinds));
145 TEST_P(FeatureInfoTest, Basic) {
146 SetupWithoutInit();
147 // Test it starts off uninitialized.
148 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
149 EXPECT_FALSE(info_->feature_flags().use_core_framebuffer_multisample);
150 EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture);
151 EXPECT_FALSE(info_->feature_flags(
152 ).use_img_for_multisampled_render_to_texture);
153 EXPECT_FALSE(info_->feature_flags().oes_standard_derivatives);
154 EXPECT_FALSE(info_->feature_flags().npot_ok);
155 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
156 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
157 EXPECT_FALSE(info_->feature_flags().oes_egl_image_external);
158 EXPECT_FALSE(info_->feature_flags().oes_depth24);
159 EXPECT_FALSE(info_->feature_flags().packed_depth24_stencil8);
160 EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source);
161 EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order);
162 EXPECT_FALSE(info_->feature_flags().arb_texture_rectangle);
163 EXPECT_FALSE(info_->feature_flags().angle_instanced_arrays);
164 EXPECT_FALSE(info_->feature_flags().occlusion_query_boolean);
165 EXPECT_FALSE(info_->feature_flags(
166 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
167 EXPECT_FALSE(info_->feature_flags(
168 ).use_arb_occlusion_query_for_occlusion_query_boolean);
169 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object);
170 EXPECT_FALSE(info_->feature_flags().map_buffer_range);
171 EXPECT_FALSE(info_->feature_flags().use_async_readpixels);
172 EXPECT_FALSE(info_->feature_flags().ext_draw_buffers);
173 EXPECT_FALSE(info_->feature_flags().nv_draw_buffers);
174 EXPECT_FALSE(info_->feature_flags().ext_discard_framebuffer);
175 EXPECT_FALSE(info_->feature_flags().angle_depth_texture);
177 #define GPU_OP(type, name) EXPECT_FALSE(info_->workarounds().name);
178 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
179 #undef GPU_OP
180 EXPECT_EQ(0, info_->workarounds().max_texture_size);
181 EXPECT_EQ(0, info_->workarounds().max_cube_map_texture_size);
182 EXPECT_FALSE(info_->workarounds().gl_clear_broken);
185 TEST_P(FeatureInfoTest, InitializeNoExtensions) {
186 SetupInitExpectations("");
187 // Check default extensions are there
188 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_resource_safe"));
189 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs"));
190 EXPECT_THAT(info_->extensions(),
191 HasSubstr("GL_ANGLE_translated_shader_source"));
192 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_trace_marker"));
194 // Check a couple of random extensions that should not be there.
195 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_npot")));
196 EXPECT_THAT(info_->extensions(),
197 Not(HasSubstr("GL_EXT_texture_compression_dxt1")));
198 EXPECT_THAT(info_->extensions(),
199 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3")));
200 EXPECT_THAT(info_->extensions(),
201 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5")));
202 EXPECT_THAT(info_->extensions(),
203 Not(HasSubstr("GL_ANGLE_texture_usage")));
204 EXPECT_THAT(info_->extensions(),
205 Not(HasSubstr("GL_EXT_texture_storage")));
206 EXPECT_THAT(info_->extensions(),
207 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")));
208 EXPECT_THAT(info_->extensions(),
209 Not(HasSubstr("GL_AMD_compressed_ATC_texture")));
210 EXPECT_THAT(info_->extensions(),
211 Not(HasSubstr("GL_IMG_texture_compression_pvrtc")));
212 EXPECT_THAT(info_->extensions(),
213 Not(HasSubstr("GL_EXT_sRGB")));
214 EXPECT_FALSE(info_->feature_flags().npot_ok);
215 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
216 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
217 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
218 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
219 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
220 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
221 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
222 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
223 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
224 GL_ETC1_RGB8_OES));
225 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
226 GL_ATC_RGB_AMD));
227 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
228 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
229 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
230 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
231 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
232 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
233 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
234 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
235 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
236 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
237 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
238 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
239 EXPECT_FALSE(info_->validators()->read_pixel_format.IsValid(
240 GL_BGRA_EXT));
241 EXPECT_FALSE(info_->validators()->texture_parameter.IsValid(
242 GL_TEXTURE_MAX_ANISOTROPY_EXT));
243 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
244 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
245 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
246 GL_READ_FRAMEBUFFER_EXT));
247 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
248 GL_DRAW_FRAMEBUFFER_EXT));
249 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
250 GL_READ_FRAMEBUFFER_BINDING_EXT));
251 EXPECT_FALSE(info_->validators()->render_buffer_parameter.IsValid(
252 GL_MAX_SAMPLES_EXT));
253 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
254 GL_DEPTH_COMPONENT));
255 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
256 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
257 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
258 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
259 GL_DEPTH24_STENCIL8));
260 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
261 GL_DEPTH_STENCIL));
262 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
263 GL_RGBA32F));
264 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
265 GL_RGB32F));
266 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
267 GL_DEPTH_STENCIL));
268 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(
269 GL_UNSIGNED_INT_24_8));
270 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
271 GL_DEPTH_COMPONENT24));
272 EXPECT_FALSE(info_->validators()->texture_parameter.IsValid(
273 GL_TEXTURE_USAGE_ANGLE));
274 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
275 GL_DEPTH_COMPONENT16));
276 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
277 GL_DEPTH_COMPONENT32_OES));
278 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
279 GL_DEPTH24_STENCIL8_OES));
280 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MIN_EXT));
281 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MAX_EXT));
282 EXPECT_FALSE(info_->feature_flags().chromium_sync_query);
283 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
284 GL_SRGB_EXT));
285 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
286 GL_SRGB_ALPHA_EXT));
287 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
288 GL_SRGB_EXT));
289 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
290 GL_SRGB_ALPHA_EXT));
291 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
292 GL_SRGB8_ALPHA8_EXT));
293 EXPECT_FALSE(info_->validators()->frame_buffer_parameter.IsValid(
294 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT));
297 TEST_P(FeatureInfoTest, InitializeWithANGLE) {
298 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE, "");
299 EXPECT_TRUE(info_->gl_version_info().is_angle);
302 TEST_P(FeatureInfoTest, InitializeNPOTExtensionGLES) {
303 SetupInitExpectations("GL_OES_texture_npot");
304 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot"));
305 EXPECT_TRUE(info_->feature_flags().npot_ok);
308 TEST_P(FeatureInfoTest, InitializeNPOTExtensionGL) {
309 SetupInitExpectations("GL_ARB_texture_non_power_of_two");
310 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot"));
311 EXPECT_TRUE(info_->feature_flags().npot_ok);
314 TEST_P(FeatureInfoTest, InitializeDXTExtensionGLES2) {
315 SetupInitExpectations("GL_EXT_texture_compression_dxt1");
316 EXPECT_THAT(info_->extensions(),
317 HasSubstr("GL_EXT_texture_compression_dxt1"));
318 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
319 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
320 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
321 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
322 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
323 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
324 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
325 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
328 TEST_P(FeatureInfoTest, InitializeDXTExtensionGL) {
329 SetupInitExpectations("GL_EXT_texture_compression_s3tc");
330 EXPECT_THAT(info_->extensions(),
331 HasSubstr("GL_EXT_texture_compression_dxt1"));
332 EXPECT_THAT(info_->extensions(),
333 HasSubstr("GL_CHROMIUM_texture_compression_dxt3"));
334 EXPECT_THAT(info_->extensions(),
335 HasSubstr("GL_CHROMIUM_texture_compression_dxt5"));
336 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
337 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
338 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
339 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
340 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
341 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
342 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
343 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
346 TEST_P(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GLES2) {
347 SetupInitExpectations("GL_EXT_texture_format_BGRA8888");
348 EXPECT_THAT(info_->extensions(),
349 HasSubstr("GL_EXT_texture_format_BGRA8888"));
350 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
351 GL_BGRA_EXT));
352 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
353 GL_BGRA_EXT));
354 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
355 GL_BGRA8_EXT));
356 EXPECT_FALSE(info_->feature_flags().ext_render_buffer_format_bgra8888);
359 TEST_P(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GL) {
360 SetupInitExpectations("GL_EXT_bgra");
361 EXPECT_THAT(info_->extensions(),
362 HasSubstr("GL_EXT_texture_format_BGRA8888"));
363 EXPECT_THAT(info_->extensions(),
364 HasSubstr("GL_EXT_read_format_bgra"));
365 EXPECT_THAT(info_->extensions(),
366 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
367 EXPECT_TRUE(info_->feature_flags().ext_render_buffer_format_bgra8888);
368 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
369 GL_BGRA_EXT));
370 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
371 GL_BGRA_EXT));
372 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(
373 GL_BGRA_EXT));
374 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
375 GL_BGRA8_EXT));
378 TEST_P(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888Apple) {
379 SetupInitExpectations("GL_APPLE_texture_format_BGRA8888");
380 EXPECT_THAT(info_->extensions(),
381 HasSubstr("GL_EXT_texture_format_BGRA8888"));
382 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
383 GL_BGRA_EXT));
384 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
385 GL_BGRA_EXT));
386 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
387 GL_BGRA8_EXT));
388 EXPECT_FALSE(info_->feature_flags().ext_render_buffer_format_bgra8888);
391 TEST_P(FeatureInfoTest, InitializeEXT_read_format_bgra) {
392 SetupInitExpectations("GL_EXT_read_format_bgra");
393 EXPECT_THAT(info_->extensions(),
394 HasSubstr("GL_EXT_read_format_bgra"));
395 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
396 GL_BGRA_EXT));
397 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
398 GL_BGRA_EXT));
399 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(
400 GL_BGRA_EXT));
401 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
402 GL_BGRA8_EXT));
403 EXPECT_FALSE(info_->feature_flags().ext_render_buffer_format_bgra8888);
406 TEST_P(FeatureInfoTest, InitializeEXT_sRGB) {
407 SetupInitExpectations("GL_EXT_sRGB GL_OES_rgb8_rgba8");
408 EXPECT_THAT(info_->extensions(),
409 HasSubstr("GL_EXT_sRGB"));
410 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
411 GL_SRGB_EXT));
412 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
413 GL_SRGB_ALPHA_EXT));
414 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
415 GL_SRGB_EXT));
416 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
417 GL_SRGB_ALPHA_EXT));
418 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
419 GL_SRGB8_ALPHA8_EXT));
420 EXPECT_TRUE(info_->validators()->frame_buffer_parameter.IsValid(
421 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT));
424 TEST_P(FeatureInfoTest, InitializeEXT_texture_storage) {
425 SetupInitExpectations("GL_EXT_texture_storage");
426 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
427 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
428 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
429 GL_TEXTURE_IMMUTABLE_FORMAT_EXT));
430 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
431 GL_BGRA8_EXT));
432 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
433 GL_RGBA32F_EXT));
434 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
435 GL_RGB32F_EXT));
436 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
437 GL_ALPHA32F_EXT));
438 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
439 GL_LUMINANCE32F_EXT));
440 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
441 GL_LUMINANCE_ALPHA32F_EXT));
442 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
443 GL_RGBA16F_EXT));
444 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
445 GL_RGB16F_EXT));
446 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
447 GL_ALPHA16F_EXT));
448 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
449 GL_LUMINANCE16F_EXT));
450 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
451 GL_LUMINANCE_ALPHA16F_EXT));
454 TEST_P(FeatureInfoTest, InitializeARB_texture_storage) {
455 SetupInitExpectations("GL_ARB_texture_storage");
456 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
457 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
458 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
459 GL_TEXTURE_IMMUTABLE_FORMAT_EXT));
462 TEST_P(FeatureInfoTest, InitializeEXT_texture_storage_BGRA) {
463 SetupInitExpectations("GL_EXT_texture_storage GL_EXT_bgra");
464 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
465 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
466 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
467 GL_BGRA8_EXT));
468 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
471 TEST_P(FeatureInfoTest, InitializeARB_texture_storage_BGRA) {
472 SetupInitExpectations("GL_ARB_texture_storage GL_EXT_bgra");
473 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
474 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
475 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
476 GL_BGRA8_EXT));
477 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
480 TEST_P(FeatureInfoTest, InitializeEXT_texture_storage_BGRA8888) {
481 SetupInitExpectations(
482 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888");
483 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
484 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
485 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
486 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
487 GL_BGRA8_EXT));
488 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
491 TEST_P(FeatureInfoTest, InitializeEXT_texture_storage_float) {
492 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_float");
493 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
494 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float"));
495 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
496 GL_RGBA32F_EXT));
497 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
498 GL_RGB32F_EXT));
499 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
500 GL_ALPHA32F_EXT));
501 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
502 GL_LUMINANCE32F_EXT));
503 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
504 GL_LUMINANCE_ALPHA32F_EXT));
507 TEST_P(FeatureInfoTest, InitializeEXT_texture_storage_half_float) {
508 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_half_float");
509 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
510 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_half_float"));
511 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
512 GL_RGBA16F_EXT));
513 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
514 GL_RGB16F_EXT));
515 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
516 GL_ALPHA16F_EXT));
517 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
518 GL_LUMINANCE16F_EXT));
519 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
520 GL_LUMINANCE_ALPHA16F_EXT));
523 // Check how to handle ES, texture_storage and BGRA combination; 10 tests.
525 // 1- ES2 + GL_EXT_texture_storage -> GL_EXT_texture_storage (and no
526 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8 in
527 // glTexStorage2DEXT)
528 TEST_P(FeatureInfoTest, InitializeGLES2_texture_storage) {
529 SetupInitExpectationsWithGLVersion(
530 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
531 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
532 EXPECT_THAT(info_->extensions(),
533 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
536 // 2- ES2 + GL_EXT_texture_storage + (GL_EXT_texture_format_BGRA8888 or
537 // GL_APPLE_texture_format_bgra8888)
538 TEST_P(FeatureInfoTest, InitializeGLES2_texture_storage_BGRA) {
539 SetupInitExpectationsWithGLVersion(
540 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
542 "OpenGL ES 2.0");
543 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
544 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
547 // 3- ES2 + GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_bgra8888
548 TEST_P(FeatureInfoTest, InitializeGLES2_texture_format_BGRA) {
549 SetupInitExpectationsWithGLVersion(
550 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 2.0");
551 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
552 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
555 // 4- ES2 (neither GL_EXT_texture_storage nor GL_EXT_texture_format_BGRA8888) ->
556 // nothing
557 TEST_P(FeatureInfoTest, InitializeGLES2_neither_texture_storage_nor_BGRA) {
558 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
559 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
560 EXPECT_THAT(info_->extensions(),
561 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
564 // 5- ES3 + GL_EXT_texture_format_BGRA8888 -> GL_EXT_texture_format_BGRA8888
565 // (we can't expose GL_EXT_texture_storage because we fail the GL_BGRA8
566 // requirement)
567 TEST_P(FeatureInfoTest, InitializeGLES3_texture_storage_EXT_BGRA) {
568 SetupInitExpectationsWithGLVersion(
569 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 3.0");
570 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
571 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
574 // 6- ES3 + GL_APPLE_texture_format_bgra8888 -> GL_EXT_texture_storage +
575 // GL_EXT_texture_format_BGRA8888 (driver promises to handle GL_BGRA8 by
576 // exposing GL_APPLE_texture_format_bgra8888)
577 TEST_P(FeatureInfoTest, InitializeGLES3_texture_storage_APPLE_BGRA) {
578 SetupInitExpectationsWithGLVersion(
579 "GL_APPLE_texture_format_BGRA8888", "", "OpenGL ES 3.0");
580 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
581 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
584 // 7- ES3 + GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 ->
585 // GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 (driver promises to
586 // handle GL_BGRA8 by exposing GL_EXT_texture_storage)
587 TEST_P(FeatureInfoTest, InitializeGLES3_EXT_texture_storage_EXT_BGRA) {
588 SetupInitExpectationsWithGLVersion(
589 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
591 "OpenGL ES 3.0");
592 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
593 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
596 // 8- ES3 + none of the above -> GL_EXT_texture_storage (and no
597 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8)
598 TEST_P(FeatureInfoTest, InitializeGLES3_texture_storage) {
599 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
600 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
601 EXPECT_THAT(info_->extensions(),
602 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
605 // 9- ANGLE will add the GL_CHROMIUM_renderbuffer_format_BGRA8888 extension and
606 // the GL_BGRA8_EXT render buffer format.
607 TEST_P(FeatureInfoTest, InitializeWithANGLE_BGRA8) {
608 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE, "");
609 EXPECT_TRUE(info_->gl_version_info().is_angle);
610 EXPECT_THAT(info_->extensions(),
611 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
612 EXPECT_TRUE(info_->feature_flags().ext_render_buffer_format_bgra8888);
613 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_BGRA8_EXT));
616 // 10- vanilla opengl es means no GL_CHROMIUM_renderbuffer_format_BGRA8888
617 TEST_P(FeatureInfoTest,
618 InitializeGLES2_no_CHROMIUM_renderbuffer_format_BGRA8888) {
619 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
620 EXPECT_FALSE(info_->feature_flags().ext_render_buffer_format_bgra8888);
621 EXPECT_THAT(info_->extensions(),
622 Not(HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888")));
625 TEST_P(FeatureInfoTest, InitializeARB_texture_float) {
626 SetupInitExpectations("GL_ARB_texture_float");
627 EXPECT_TRUE(info_->feature_flags().chromium_color_buffer_float_rgba);
628 EXPECT_TRUE(info_->feature_flags().chromium_color_buffer_float_rgb);
629 std::string extensions = info_->extensions() + " ";
630 EXPECT_THAT(extensions, HasSubstr("GL_CHROMIUM_color_buffer_float_rgb "));
631 EXPECT_THAT(extensions, HasSubstr("GL_CHROMIUM_color_buffer_float_rgba"));
632 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
633 GL_RGBA32F));
634 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
635 GL_RGB32F));
638 TEST_P(FeatureInfoTest, Initialize_texture_floatGLES3) {
639 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
640 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float")));
641 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
642 EXPECT_THAT(info_->extensions(),
643 Not(HasSubstr("GL_OES_texture_float_linear")));
644 EXPECT_THAT(info_->extensions(),
645 Not(HasSubstr("GL_OES_texture_half_float_linear")));
648 TEST_P(FeatureInfoTest, Initialize_sRGBGLES3) {
649 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
650 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_sRGB")));
651 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
652 GL_SRGB_EXT));
653 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
654 GL_SRGB_ALPHA_EXT));
655 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
656 GL_SRGB_EXT));
657 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
658 GL_SRGB_ALPHA_EXT));
659 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
660 GL_SRGB8_ALPHA8_EXT));
661 EXPECT_FALSE(info_->validators()->frame_buffer_parameter.IsValid(
662 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT));
665 TEST_P(FeatureInfoTest, InitializeOES_texture_floatGLES2) {
666 SetupInitExpectations("GL_OES_texture_float");
667 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
668 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
669 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float"));
670 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
671 EXPECT_THAT(info_->extensions(),
672 Not(HasSubstr("GL_OES_texture_float_linear")));
673 EXPECT_THAT(info_->extensions(),
674 Not(HasSubstr("GL_OES_texture_half_float_linear")));
675 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
676 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
679 TEST_P(FeatureInfoTest, InitializeOES_texture_float_linearGLES2) {
680 SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear");
681 EXPECT_TRUE(info_->feature_flags().enable_texture_float_linear);
682 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
683 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float"));
684 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
685 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float_linear"));
686 EXPECT_THAT(info_->extensions(),
687 Not(HasSubstr("GL_OES_texture_half_float_linear")));
688 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
689 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
692 TEST_P(FeatureInfoTest, InitializeOES_texture_half_floatGLES2) {
693 SetupInitExpectations("GL_OES_texture_half_float");
694 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
695 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
696 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float")));
697 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_half_float"));
698 EXPECT_THAT(info_->extensions(),
699 Not(HasSubstr("GL_OES_texture_float_linear")));
700 EXPECT_THAT(info_->extensions(),
701 Not(HasSubstr("GL_OES_texture_half_float_linear")));
702 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
703 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
706 TEST_P(FeatureInfoTest, InitializeOES_texture_half_float_linearGLES2) {
707 SetupInitExpectations(
708 "GL_OES_texture_half_float GL_OES_texture_half_float_linear");
709 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
710 EXPECT_TRUE(info_->feature_flags().enable_texture_half_float_linear);
711 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float")));
712 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_half_float"));
713 EXPECT_THAT(info_->extensions(),
714 Not(HasSubstr("GL_OES_texture_float_linear")));
715 EXPECT_THAT(info_->extensions(),
716 HasSubstr("GL_OES_texture_half_float_linear"));
717 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
718 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
721 TEST_P(FeatureInfoTest, InitializeEXT_framebuffer_multisample) {
722 SetupInitExpectations("GL_EXT_framebuffer_multisample");
723 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
724 EXPECT_THAT(info_->extensions(),
725 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
726 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
727 GL_READ_FRAMEBUFFER_EXT));
728 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
729 GL_DRAW_FRAMEBUFFER_EXT));
730 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
731 GL_READ_FRAMEBUFFER_BINDING_EXT));
732 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
733 GL_MAX_SAMPLES_EXT));
734 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
735 GL_RENDERBUFFER_SAMPLES_EXT));
738 TEST_P(FeatureInfoTest, InitializeANGLE_framebuffer_multisample) {
739 SetupInitExpectationsWithGLVersion(
740 "GL_ANGLE_framebuffer_multisample", kGLRendererStringANGLE, "");
741 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
742 EXPECT_THAT(info_->extensions(),
743 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
744 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
745 GL_READ_FRAMEBUFFER_EXT));
746 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
747 GL_DRAW_FRAMEBUFFER_EXT));
748 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
749 GL_READ_FRAMEBUFFER_BINDING_EXT));
750 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
751 GL_MAX_SAMPLES_EXT));
752 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
753 GL_RENDERBUFFER_SAMPLES_EXT));
756 // We don't allow ANGLE_framebuffer_multisample on non-ANGLE implementations,
757 // because we wouldn't be choosing the right driver entry point and because the
758 // extension was falsely advertised on some Android devices (crbug.com/165736).
759 TEST_P(FeatureInfoTest, InitializeANGLE_framebuffer_multisampleWithoutANGLE) {
760 SetupInitExpectations("GL_ANGLE_framebuffer_multisample");
761 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
762 EXPECT_THAT(info_->extensions(),
763 Not(HasSubstr("GL_CHROMIUM_framebuffer_multisample")));
764 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
765 GL_READ_FRAMEBUFFER_EXT));
766 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
767 GL_DRAW_FRAMEBUFFER_EXT));
768 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
769 GL_READ_FRAMEBUFFER_BINDING_EXT));
770 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
771 GL_MAX_SAMPLES_EXT));
772 EXPECT_FALSE(info_->validators()->render_buffer_parameter.IsValid(
773 GL_RENDERBUFFER_SAMPLES_EXT));
776 TEST_P(FeatureInfoTest, InitializeEXT_multisampled_render_to_texture) {
777 SetupInitExpectations("GL_EXT_multisampled_render_to_texture");
778 EXPECT_TRUE(info_->feature_flags(
779 ).multisampled_render_to_texture);
780 EXPECT_FALSE(info_->feature_flags(
781 ).use_img_for_multisampled_render_to_texture);
782 EXPECT_THAT(info_->extensions(),
783 HasSubstr("GL_EXT_multisampled_render_to_texture"));
784 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
785 GL_MAX_SAMPLES_EXT));
786 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
787 GL_RENDERBUFFER_SAMPLES_EXT));
788 EXPECT_TRUE(info_->validators()->frame_buffer_parameter.IsValid(
789 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT));
792 TEST_P(FeatureInfoTest, InitializeIMG_multisampled_render_to_texture) {
793 SetupInitExpectations("GL_IMG_multisampled_render_to_texture");
794 EXPECT_TRUE(info_->feature_flags(
795 ).multisampled_render_to_texture);
796 EXPECT_TRUE(info_->feature_flags(
797 ).use_img_for_multisampled_render_to_texture);
798 EXPECT_THAT(info_->extensions(),
799 HasSubstr("GL_EXT_multisampled_render_to_texture"));
800 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
801 GL_MAX_SAMPLES_EXT));
802 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
803 GL_RENDERBUFFER_SAMPLES_EXT));
804 EXPECT_TRUE(info_->validators()->frame_buffer_parameter.IsValid(
805 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT));
808 TEST_P(FeatureInfoTest, InitializeEXT_texture_filter_anisotropic) {
809 SetupInitExpectations("GL_EXT_texture_filter_anisotropic");
810 EXPECT_THAT(info_->extensions(),
811 HasSubstr("GL_EXT_texture_filter_anisotropic"));
812 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
813 GL_TEXTURE_MAX_ANISOTROPY_EXT));
814 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
815 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
818 TEST_P(FeatureInfoTest, InitializeEXT_ARB_depth_texture) {
819 SetupInitExpectations("GL_ARB_depth_texture");
820 EXPECT_THAT(info_->extensions(),
821 HasSubstr("GL_GOOGLE_depth_texture"));
822 EXPECT_THAT(info_->extensions(),
823 HasSubstr("GL_CHROMIUM_depth_texture"));
824 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
825 GL_DEPTH_COMPONENT));
826 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
827 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
828 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
829 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
832 TEST_P(FeatureInfoTest, InitializeOES_ARB_depth_texture) {
833 SetupInitExpectations("GL_OES_depth_texture");
834 EXPECT_THAT(info_->extensions(),
835 HasSubstr("GL_GOOGLE_depth_texture"));
836 EXPECT_THAT(info_->extensions(),
837 HasSubstr("GL_CHROMIUM_depth_texture"));
838 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
839 GL_DEPTH_COMPONENT));
840 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
841 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
842 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
843 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
846 TEST_P(FeatureInfoTest, InitializeANGLE_depth_texture) {
847 SetupInitExpectations("GL_ANGLE_depth_texture");
848 EXPECT_THAT(info_->extensions(),
849 HasSubstr("GL_GOOGLE_depth_texture"));
850 EXPECT_THAT(info_->extensions(),
851 HasSubstr("GL_CHROMIUM_depth_texture"));
852 EXPECT_THAT(info_->extensions(),
853 Not(HasSubstr("GL_ANGLE_depth_texture")));
854 EXPECT_TRUE(info_->feature_flags().angle_depth_texture);
855 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
856 GL_DEPTH_COMPONENT));
857 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
858 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
859 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
860 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
861 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
862 GL_DEPTH_COMPONENT16));
863 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
864 GL_DEPTH_COMPONENT32_OES));
865 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
866 GL_DEPTH24_STENCIL8_OES));
869 TEST_P(FeatureInfoTest, InitializeEXT_packed_depth_stencil) {
870 SetupInitExpectations("GL_EXT_packed_depth_stencil");
871 EXPECT_THAT(info_->extensions(),
872 HasSubstr("GL_OES_packed_depth_stencil"));
873 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
874 GL_DEPTH24_STENCIL8));
875 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
876 GL_DEPTH_COMPONENT));
877 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
878 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
879 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
882 TEST_P(FeatureInfoTest, InitializeOES_packed_depth_stencil) {
883 SetupInitExpectations("GL_OES_packed_depth_stencil");
884 EXPECT_THAT(info_->extensions(),
885 HasSubstr("GL_OES_packed_depth_stencil"));
886 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
887 GL_DEPTH24_STENCIL8));
888 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
889 GL_DEPTH_COMPONENT));
890 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
891 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
892 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
895 TEST_P(FeatureInfoTest,
896 InitializeOES_packed_depth_stencil_and_GL_ARB_depth_texture) {
897 SetupInitExpectations("GL_OES_packed_depth_stencil GL_ARB_depth_texture");
898 EXPECT_THAT(info_->extensions(),
899 HasSubstr("GL_OES_packed_depth_stencil"));
900 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
901 GL_DEPTH24_STENCIL8));
902 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
903 GL_DEPTH_STENCIL));
904 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
905 GL_DEPTH_STENCIL));
906 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(
907 GL_UNSIGNED_INT_24_8));
910 TEST_P(FeatureInfoTest, InitializeOES_depth24) {
911 SetupInitExpectations("GL_OES_depth24");
912 EXPECT_TRUE(info_->feature_flags().oes_depth24);
913 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24"));
914 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
915 GL_DEPTH_COMPONENT24));
918 TEST_P(FeatureInfoTest, InitializeOES_standard_derivatives) {
919 SetupInitExpectations("GL_OES_standard_derivatives");
920 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives"));
921 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives);
922 EXPECT_TRUE(info_->validators()->hint_target.IsValid(
923 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
924 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
925 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
928 TEST_P(FeatureInfoTest, InitializeOES_rgb8_rgba8) {
929 SetupInitExpectations("GL_OES_rgb8_rgba8");
930 EXPECT_THAT(info_->extensions(),
931 HasSubstr("GL_OES_rgb8_rgba8"));
932 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
933 GL_RGB8_OES));
934 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
935 GL_RGBA8_OES));
938 TEST_P(FeatureInfoTest, InitializeOES_EGL_image_external) {
939 SetupInitExpectations("GL_OES_EGL_image_external");
940 EXPECT_THAT(info_->extensions(),
941 HasSubstr("GL_OES_EGL_image_external"));
942 EXPECT_TRUE(info_->feature_flags().oes_egl_image_external);
943 EXPECT_TRUE(info_->validators()->texture_bind_target.IsValid(
944 GL_TEXTURE_EXTERNAL_OES));
945 EXPECT_TRUE(info_->validators()->get_tex_param_target.IsValid(
946 GL_TEXTURE_EXTERNAL_OES));
947 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
948 GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES));
949 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
950 GL_TEXTURE_BINDING_EXTERNAL_OES));
953 TEST_P(FeatureInfoTest, InitializeOES_compressed_ETC1_RGB8_texture) {
954 SetupInitExpectations("GL_OES_compressed_ETC1_RGB8_texture");
955 EXPECT_THAT(info_->extensions(),
956 HasSubstr("GL_OES_compressed_ETC1_RGB8_texture"));
957 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
958 GL_ETC1_RGB8_OES));
959 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
960 GL_ETC1_RGB8_OES));
963 TEST_P(FeatureInfoTest, InitializeAMD_compressed_ATC_texture) {
964 SetupInitExpectations("GL_AMD_compressed_ATC_texture");
965 EXPECT_THAT(info_->extensions(),
966 HasSubstr("GL_AMD_compressed_ATC_texture"));
967 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
968 GL_ATC_RGB_AMD));
969 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
970 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
971 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
972 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
975 TEST_P(FeatureInfoTest, InitializeIMG_texture_compression_pvrtc) {
976 SetupInitExpectations("GL_IMG_texture_compression_pvrtc");
977 EXPECT_THAT(info_->extensions(),
978 HasSubstr("GL_IMG_texture_compression_pvrtc"));
979 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
980 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
981 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
982 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
983 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
984 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
985 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
986 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
989 TEST_P(FeatureInfoTest, InitializeEXT_occlusion_query_boolean) {
990 SetupInitExpectations("GL_EXT_occlusion_query_boolean");
991 EXPECT_THAT(info_->extensions(),
992 HasSubstr("GL_EXT_occlusion_query_boolean"));
993 EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean);
994 EXPECT_FALSE(info_->feature_flags(
995 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
996 EXPECT_FALSE(info_->feature_flags(
997 ).use_arb_occlusion_query_for_occlusion_query_boolean);
1000 TEST_P(FeatureInfoTest, InitializeARB_occlusion_query) {
1001 SetupInitExpectations("GL_ARB_occlusion_query");
1002 EXPECT_THAT(info_->extensions(),
1003 HasSubstr("GL_EXT_occlusion_query_boolean"));
1004 EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean);
1005 EXPECT_FALSE(info_->feature_flags(
1006 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
1007 EXPECT_TRUE(info_->feature_flags(
1008 ).use_arb_occlusion_query_for_occlusion_query_boolean);
1011 TEST_P(FeatureInfoTest, InitializeARB_occlusion_query2) {
1012 SetupInitExpectations("GL_ARB_occlusion_query2 GL_ARB_occlusion_query2");
1013 EXPECT_THAT(info_->extensions(),
1014 HasSubstr("GL_EXT_occlusion_query_boolean"));
1015 EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean);
1016 EXPECT_TRUE(info_->feature_flags(
1017 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
1018 EXPECT_FALSE(info_->feature_flags(
1019 ).use_arb_occlusion_query_for_occlusion_query_boolean);
1022 TEST_P(FeatureInfoTest, InitializeOES_vertex_array_object) {
1023 SetupInitExpectations("GL_OES_vertex_array_object");
1024 EXPECT_THAT(info_->extensions(),
1025 HasSubstr("GL_OES_vertex_array_object"));
1026 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1029 TEST_P(FeatureInfoTest, InitializeARB_vertex_array_object) {
1030 SetupInitExpectations("GL_ARB_vertex_array_object");
1031 EXPECT_THAT(info_->extensions(),
1032 HasSubstr("GL_OES_vertex_array_object"));
1033 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1036 TEST_P(FeatureInfoTest, InitializeAPPLE_vertex_array_object) {
1037 SetupInitExpectations("GL_APPLE_vertex_array_object");
1038 EXPECT_THAT(info_->extensions(),
1039 HasSubstr("GL_OES_vertex_array_object"));
1040 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1043 TEST_P(FeatureInfoTest, InitializeNo_vertex_array_object) {
1044 SetupInitExpectations("");
1045 // Even if the native extensions are not available the implementation
1046 // may still emulate the GL_OES_vertex_array_object functionality. In this
1047 // scenario native_vertex_array_object must be false.
1048 EXPECT_THAT(info_->extensions(),
1049 HasSubstr("GL_OES_vertex_array_object"));
1050 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object);
1053 TEST_P(FeatureInfoTest, InitializeOES_element_index_uint) {
1054 SetupInitExpectations("GL_OES_element_index_uint");
1055 EXPECT_THAT(info_->extensions(),
1056 HasSubstr("GL_OES_element_index_uint"));
1057 EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT));
1060 TEST_P(FeatureInfoTest, InitializeVAOsWithClientSideArrays) {
1061 base::CommandLine command_line(0, NULL);
1062 command_line.AppendSwitchASCII(
1063 switches::kGpuDriverBugWorkarounds,
1064 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
1065 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object",
1066 command_line);
1067 EXPECT_TRUE(info_->workarounds().use_client_side_arrays_for_stream_buffers);
1068 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object);
1071 TEST_P(FeatureInfoTest, InitializeEXT_blend_minmax) {
1072 SetupInitExpectations("GL_EXT_blend_minmax");
1073 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_blend_minmax"));
1074 EXPECT_TRUE(info_->validators()->equation.IsValid(GL_MIN_EXT));
1075 EXPECT_TRUE(info_->validators()->equation.IsValid(GL_MAX_EXT));
1078 TEST_P(FeatureInfoTest, InitializeEXT_frag_depth) {
1079 SetupInitExpectations("GL_EXT_frag_depth");
1080 EXPECT_TRUE(info_->feature_flags().ext_frag_depth);
1081 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_frag_depth"));
1084 TEST_P(FeatureInfoTest, InitializeEXT_shader_texture_lod) {
1085 SetupInitExpectations("GL_EXT_shader_texture_lod");
1086 EXPECT_TRUE(info_->feature_flags().ext_shader_texture_lod);
1087 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_shader_texture_lod"));
1090 TEST_P(FeatureInfoTest, InitializeEXT_discard_framebuffer) {
1091 SetupInitExpectations("GL_EXT_discard_framebuffer");
1092 EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
1093 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1096 TEST_P(FeatureInfoTest, InitializeSamplersWithARBSamplerObjects) {
1097 SetupInitExpectationsWithGLVersion(
1098 "GL_ARB_sampler_objects", "", "OpenGL 3.0");
1099 EXPECT_TRUE(info_->feature_flags().enable_samplers);
1102 TEST_P(FeatureInfoTest, InitializeWithES3) {
1103 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
1104 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
1105 EXPECT_TRUE(info_->feature_flags().use_core_framebuffer_multisample);
1106 EXPECT_THAT(info_->extensions(),
1107 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
1108 EXPECT_TRUE(info_->feature_flags().use_async_readpixels);
1109 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives);
1110 EXPECT_TRUE(info_->feature_flags().oes_depth24);
1111 EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
1112 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
1113 EXPECT_TRUE(
1114 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_COMPONENT));
1115 EXPECT_TRUE(
1116 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
1117 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
1118 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
1119 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
1120 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
1121 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT_24_8));
1122 EXPECT_TRUE(info_->feature_flags().packed_depth24_stencil8);
1123 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24"));
1124 EXPECT_TRUE(
1125 info_->validators()->render_buffer_format.IsValid(GL_DEPTH_COMPONENT24));
1126 EXPECT_TRUE(
1127 info_->validators()->render_buffer_format.IsValid(GL_DEPTH24_STENCIL8));
1128 EXPECT_TRUE(
1129 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
1130 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
1131 EXPECT_TRUE(info_->feature_flags().npot_ok);
1132 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1133 EXPECT_TRUE(info_->feature_flags().enable_samplers);
1134 EXPECT_TRUE(info_->feature_flags().map_buffer_range);
1135 EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
1136 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1137 EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
1138 EXPECT_TRUE(gfx::GLFence::IsSupported());
1141 TEST_P(FeatureInfoTest, InitializeWithoutSamplers) {
1142 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0");
1143 EXPECT_FALSE(info_->feature_flags().enable_samplers);
1146 TEST_P(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) {
1147 base::CommandLine command_line(0, NULL);
1148 command_line.AppendSwitchASCII(
1149 switches::kGpuDriverBugWorkarounds,
1150 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST));
1151 // Workarounds should get parsed without the need for a context.
1152 SetupWithCommandLine(command_line);
1153 EXPECT_TRUE(info_->workarounds().exit_on_context_lost);
1156 TEST_P(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) {
1157 base::CommandLine command_line(0, NULL);
1158 command_line.AppendSwitchASCII(
1159 switches::kGpuDriverBugWorkarounds,
1160 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," +
1161 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," +
1162 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096));
1163 // Workarounds should get parsed without the need for a context.
1164 SetupWithCommandLine(command_line);
1165 EXPECT_TRUE(info_->workarounds().exit_on_context_lost);
1166 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size);
1167 EXPECT_EQ(4096, info_->workarounds().max_texture_size);
1170 TEST_P(FeatureInfoTest, InitializeWithARBSync) {
1171 SetupInitExpectations("GL_ARB_sync");
1172 EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
1173 EXPECT_TRUE(gfx::GLFence::IsSupported());
1176 TEST_P(FeatureInfoTest, InitializeWithNVFence) {
1177 SetupInitExpectations("GL_NV_fence");
1178 EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
1179 EXPECT_TRUE(gfx::GLFence::IsSupported());
1182 TEST_P(FeatureInfoTest, InitializeWithNVDrawBuffers) {
1183 SetupInitExpectationsWithGLVersion("GL_NV_draw_buffers", "", "OpenGL ES 3.0");
1184 EXPECT_TRUE(info_->feature_flags().nv_draw_buffers);
1185 EXPECT_TRUE(info_->feature_flags().ext_draw_buffers);
1188 TEST_P(FeatureInfoTest, InitializeWithPreferredEXTDrawBuffers) {
1189 SetupInitExpectationsWithGLVersion(
1190 "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0");
1191 EXPECT_FALSE(info_->feature_flags().nv_draw_buffers);
1192 EXPECT_TRUE(info_->feature_flags().ext_draw_buffers);
1195 TEST_P(FeatureInfoTest, BlendEquationAdvancedDisabled) {
1196 base::CommandLine command_line(0, NULL);
1197 command_line.AppendSwitchASCII(
1198 switches::kGpuDriverBugWorkarounds,
1199 base::IntToString(gpu::DISABLE_BLEND_EQUATION_ADVANCED));
1200 SetupInitExpectationsWithCommandLine(
1201 "GL_KHR_blend_equation_advanced_coherent GL_KHR_blend_equation_advanced",
1202 command_line);
1203 EXPECT_FALSE(info_->feature_flags().blend_equation_advanced);
1204 EXPECT_FALSE(info_->feature_flags().blend_equation_advanced_coherent);
1207 TEST_P(FeatureInfoTest, InitializeCHROMIUM_path_rendering_no_cmdline_switch) {
1208 SetupInitExpectationsWithGLVersion(
1209 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1210 "", "4.3");
1211 EXPECT_FALSE(info_->feature_flags().chromium_path_rendering);
1212 EXPECT_THAT(info_->extensions(),
1213 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1216 TEST_P(FeatureInfoTest, InitializeCHROMIUM_path_rendering) {
1217 base::CommandLine command_line(0, NULL);
1218 command_line.AppendSwitch(switches::kEnableGLPathRendering);
1219 SetupInitExpectationsWithGLVersionAndCommandLine(
1220 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1221 "", "4.3", command_line);
1222 EXPECT_TRUE(info_->feature_flags().chromium_path_rendering);
1223 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1226 TEST_P(FeatureInfoTest, InitializeCHROMIUM_path_rendering2) {
1227 base::CommandLine command_line(0, NULL);
1228 command_line.AppendSwitch(switches::kEnableGLPathRendering);
1229 SetupInitExpectationsWithGLVersionAndCommandLine(
1230 "GL_NV_path_rendering", "", "OpenGL ES 3.1", command_line);
1231 EXPECT_TRUE(info_->feature_flags().chromium_path_rendering);
1232 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1235 TEST_P(FeatureInfoTest, InitializeNoCHROMIUM_path_rendering) {
1236 base::CommandLine command_line(0, NULL);
1237 command_line.AppendSwitch(switches::kEnableGLPathRendering);
1238 SetupInitExpectationsWithGLVersionAndCommandLine("GL_ARB_compatibility", "",
1239 "4.3", command_line);
1240 EXPECT_FALSE(info_->feature_flags().chromium_path_rendering);
1241 EXPECT_THAT(info_->extensions(),
1242 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1245 TEST_P(FeatureInfoTest, InitializeNoCHROMIUM_path_rendering2) {
1246 base::CommandLine command_line(0, NULL);
1247 command_line.AppendSwitch(switches::kEnableGLPathRendering);
1248 SetupInitExpectationsWithGLVersionAndCommandLine(
1249 "GL_ARB_compatibility GL_NV_path_rendering", "", "4.3", command_line);
1250 EXPECT_FALSE(info_->feature_flags().chromium_path_rendering);
1251 EXPECT_THAT(info_->extensions(),
1252 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1255 TEST_P(FeatureInfoTest, InitializeNoKHR_blend_equation_advanced) {
1256 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility", "", "4.3");
1257 EXPECT_FALSE(info_->feature_flags().blend_equation_advanced);
1258 EXPECT_THAT(info_->extensions(),
1259 Not(HasSubstr("GL_KHR_blend_equation_advanced")));
1262 TEST_P(FeatureInfoTest, InitializeKHR_blend_equations_advanced) {
1263 SetupInitExpectations("GL_KHR_blend_equation_advanced");
1264 EXPECT_THAT(info_->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1265 EXPECT_TRUE(info_->feature_flags().blend_equation_advanced);
1268 TEST_P(FeatureInfoTest, InitializeNV_blend_equations_advanced) {
1269 SetupInitExpectations("GL_NV_blend_equation_advanced");
1270 EXPECT_THAT(info_->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1271 EXPECT_TRUE(info_->feature_flags().blend_equation_advanced);
1274 TEST_P(FeatureInfoTest, InitializeNoKHR_blend_equation_advanced_coherent) {
1275 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility ", "", "4.3");
1276 EXPECT_FALSE(info_->feature_flags().blend_equation_advanced_coherent);
1277 EXPECT_THAT(info_->extensions(),
1278 Not(HasSubstr("GL_KHR_blend_equation_advanced_coherent")));
1281 TEST_P(FeatureInfoTest, InitializeKHR_blend_equations_advanced_coherent) {
1282 SetupInitExpectations("GL_KHR_blend_equation_advanced_coherent");
1283 EXPECT_THAT(info_->extensions(),
1284 HasSubstr("GL_KHR_blend_equation_advanced_coherent"));
1285 EXPECT_TRUE(info_->feature_flags().blend_equation_advanced);
1286 EXPECT_TRUE(info_->feature_flags().blend_equation_advanced_coherent);
1289 TEST_P(FeatureInfoTest, InitializeEXT_texture_rgWithFloat) {
1290 SetupInitExpectations(
1291 "GL_EXT_texture_rg GL_OES_texture_float GL_OES_texture_half_float");
1292 EXPECT_TRUE(info_->feature_flags().ext_texture_rg);
1294 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_RED_EXT));
1295 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_RG_EXT));
1296 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(GL_RED_EXT));
1297 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(GL_RG_EXT));
1298 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(GL_RED_EXT));
1299 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(GL_RG_EXT));
1300 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_R8_EXT));
1301 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_RG8_EXT));
1304 TEST_P(FeatureInfoTest, InitializeARB_texture_rgNoFloat) {
1305 SetupInitExpectations("GL_ARB_texture_rg");
1306 EXPECT_TRUE(info_->feature_flags().ext_texture_rg);
1308 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_RED_EXT));
1309 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_RG_EXT));
1310 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(GL_RED_EXT));
1311 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(GL_RG_EXT));
1312 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(GL_RED_EXT));
1313 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(GL_RG_EXT));
1314 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_R8_EXT));
1315 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_RG8_EXT));
1318 } // namespace gles2
1319 } // namespace gpu