Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / gpu / command_buffer / service / feature_info_unittest.cc
blob6e2cb4647c956caa0c437517d6c9ecd9cde9e9a4
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 "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gl/gl_fence.h"
17 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_mock.h"
20 using ::testing::_;
21 using ::testing::DoAll;
22 using ::testing::HasSubstr;
23 using ::testing::InSequence;
24 using ::testing::MatcherCast;
25 using ::testing::Not;
26 using ::testing::Pointee;
27 using ::testing::Return;
28 using ::testing::SetArrayArgument;
29 using ::testing::SetArgumentPointee;
30 using ::testing::StrEq;
32 namespace gpu {
33 namespace gles2 {
35 namespace {
36 const char kGLRendererStringANGLE[] = "ANGLE (some renderer)";
37 } // anonymous namespace
39 class FeatureInfoTest : public GpuServiceTest {
40 public:
41 FeatureInfoTest() {
44 void SetupInitExpectations(const char* extensions) {
45 SetupInitExpectationsWithGLVersion(extensions, "", "");
48 void SetupInitExpectationsWithGLVersion(
49 const char* extensions, const char* renderer, const char* version) {
50 GpuServiceTest::SetUpWithGLVersion(version, extensions);
51 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
52 gl_.get(), extensions, renderer, version);
53 info_ = new FeatureInfo();
54 info_->Initialize();
57 void SetupWithCommandLine(const CommandLine& command_line) {
58 GpuServiceTest::SetUp();
59 info_ = new FeatureInfo(command_line);
62 void SetupInitExpectationsWithCommandLine(
63 const char* extensions, const CommandLine& command_line) {
64 GpuServiceTest::SetUpWithGLVersion("2.0", extensions);
65 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
66 gl_.get(), extensions, "", "");
67 info_ = new FeatureInfo(command_line);
68 info_->Initialize();
71 void SetupWithoutInit() {
72 GpuServiceTest::SetUp();
73 info_ = new FeatureInfo();
76 protected:
77 virtual void SetUp() OVERRIDE {
78 // Do nothing here, since we are using the explicit Setup*() functions.
81 virtual void TearDown() OVERRIDE {
82 info_ = NULL;
83 GpuServiceTest::TearDown();
86 scoped_refptr<FeatureInfo> info_;
89 namespace {
91 struct FormatInfo {
92 GLenum format;
93 const GLenum* types;
94 size_t count;
97 } // anonymous namespace.
99 TEST_F(FeatureInfoTest, Basic) {
100 SetupWithoutInit();
101 // Test it starts off uninitialized.
102 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
103 EXPECT_FALSE(info_->feature_flags().use_core_framebuffer_multisample);
104 EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture);
105 EXPECT_FALSE(info_->feature_flags(
106 ).use_img_for_multisampled_render_to_texture);
107 EXPECT_FALSE(info_->feature_flags().oes_standard_derivatives);
108 EXPECT_FALSE(info_->feature_flags().npot_ok);
109 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
110 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
111 EXPECT_FALSE(info_->feature_flags().oes_egl_image_external);
112 EXPECT_FALSE(info_->feature_flags().oes_depth24);
113 EXPECT_FALSE(info_->feature_flags().packed_depth24_stencil8);
114 EXPECT_FALSE(info_->feature_flags().angle_translated_shader_source);
115 EXPECT_FALSE(info_->feature_flags().angle_pack_reverse_row_order);
116 EXPECT_FALSE(info_->feature_flags().arb_texture_rectangle);
117 EXPECT_FALSE(info_->feature_flags().angle_instanced_arrays);
118 EXPECT_FALSE(info_->feature_flags().occlusion_query_boolean);
119 EXPECT_FALSE(info_->feature_flags(
120 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
121 EXPECT_FALSE(info_->feature_flags(
122 ).use_arb_occlusion_query_for_occlusion_query_boolean);
123 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object);
124 EXPECT_FALSE(info_->feature_flags().map_buffer_range);
125 EXPECT_FALSE(info_->feature_flags().use_async_readpixels);
126 EXPECT_FALSE(info_->feature_flags().ext_discard_framebuffer);
127 EXPECT_FALSE(info_->feature_flags().angle_depth_texture);
128 EXPECT_FALSE(info_->feature_flags().is_angle);
130 #define GPU_OP(type, name) EXPECT_FALSE(info_->workarounds().name);
131 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
132 #undef GPU_OP
133 EXPECT_EQ(0, info_->workarounds().max_texture_size);
134 EXPECT_EQ(0, info_->workarounds().max_cube_map_texture_size);
136 // Test good types.
138 static const GLenum kAlphaTypes[] = {
139 GL_UNSIGNED_BYTE,
141 static const GLenum kRGBTypes[] = {
142 GL_UNSIGNED_BYTE,
143 GL_UNSIGNED_SHORT_5_6_5,
145 static const GLenum kRGBATypes[] = {
146 GL_UNSIGNED_BYTE,
147 GL_UNSIGNED_SHORT_4_4_4_4,
148 GL_UNSIGNED_SHORT_5_5_5_1,
150 static const GLenum kLuminanceTypes[] = {
151 GL_UNSIGNED_BYTE,
153 static const GLenum kLuminanceAlphaTypes[] = {
154 GL_UNSIGNED_BYTE,
156 static const FormatInfo kFormatTypes[] = {
157 { GL_ALPHA, kAlphaTypes, arraysize(kAlphaTypes), },
158 { GL_RGB, kRGBTypes, arraysize(kRGBTypes), },
159 { GL_RGBA, kRGBATypes, arraysize(kRGBATypes), },
160 { GL_LUMINANCE, kLuminanceTypes, arraysize(kLuminanceTypes), },
161 { GL_LUMINANCE_ALPHA, kLuminanceAlphaTypes,
162 arraysize(kLuminanceAlphaTypes), } ,
164 for (size_t ii = 0; ii < arraysize(kFormatTypes); ++ii) {
165 const FormatInfo& info = kFormatTypes[ii];
166 const ValueValidator<GLenum>& validator =
167 info_->GetTextureFormatValidator(info.format);
168 for (size_t jj = 0; jj < info.count; ++jj) {
169 EXPECT_TRUE(validator.IsValid(info.types[jj]));
174 // Test some bad types
176 static const GLenum kAlphaTypes[] = {
177 GL_UNSIGNED_SHORT_5_5_5_1,
178 GL_FLOAT,
180 static const GLenum kRGBTypes[] = {
181 GL_UNSIGNED_SHORT_4_4_4_4,
182 GL_FLOAT,
184 static const GLenum kRGBATypes[] = {
185 GL_UNSIGNED_SHORT_5_6_5,
186 GL_FLOAT,
188 static const GLenum kLuminanceTypes[] = {
189 GL_UNSIGNED_SHORT_4_4_4_4,
190 GL_FLOAT,
192 static const GLenum kLuminanceAlphaTypes[] = {
193 GL_UNSIGNED_SHORT_5_5_5_1,
194 GL_FLOAT,
196 static const GLenum kBGRATypes[] = {
197 GL_UNSIGNED_BYTE,
198 GL_UNSIGNED_SHORT_5_6_5,
199 GL_FLOAT,
201 static const GLenum kDepthTypes[] = {
202 GL_UNSIGNED_BYTE,
203 GL_UNSIGNED_SHORT,
204 GL_UNSIGNED_INT,
205 GL_FLOAT,
207 static const FormatInfo kFormatTypes[] = {
208 { GL_ALPHA, kAlphaTypes, arraysize(kAlphaTypes), },
209 { GL_RGB, kRGBTypes, arraysize(kRGBTypes), },
210 { GL_RGBA, kRGBATypes, arraysize(kRGBATypes), },
211 { GL_LUMINANCE, kLuminanceTypes, arraysize(kLuminanceTypes), },
212 { GL_LUMINANCE_ALPHA, kLuminanceAlphaTypes,
213 arraysize(kLuminanceAlphaTypes), } ,
214 { GL_BGRA_EXT, kBGRATypes, arraysize(kBGRATypes), },
215 { GL_DEPTH_COMPONENT, kDepthTypes, arraysize(kDepthTypes), },
217 for (size_t ii = 0; ii < arraysize(kFormatTypes); ++ii) {
218 const FormatInfo& info = kFormatTypes[ii];
219 const ValueValidator<GLenum>& validator =
220 info_->GetTextureFormatValidator(info.format);
221 for (size_t jj = 0; jj < info.count; ++jj) {
222 EXPECT_FALSE(validator.IsValid(info.types[jj]));
228 TEST_F(FeatureInfoTest, InitializeNoExtensions) {
229 SetupInitExpectations("");
230 // Check default extensions are there
231 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_resource_safe"));
232 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs"));
233 EXPECT_THAT(info_->extensions(),
234 HasSubstr("GL_ANGLE_translated_shader_source"));
236 // Check a couple of random extensions that should not be there.
237 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_npot")));
238 EXPECT_THAT(info_->extensions(),
239 Not(HasSubstr("GL_EXT_texture_compression_dxt1")));
240 EXPECT_THAT(info_->extensions(),
241 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3")));
242 EXPECT_THAT(info_->extensions(),
243 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5")));
244 EXPECT_THAT(info_->extensions(),
245 Not(HasSubstr("GL_ANGLE_texture_usage")));
246 EXPECT_THAT(info_->extensions(),
247 Not(HasSubstr("GL_EXT_texture_storage")));
248 EXPECT_THAT(info_->extensions(),
249 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")));
250 EXPECT_THAT(info_->extensions(),
251 Not(HasSubstr("GL_AMD_compressed_ATC_texture")));
252 EXPECT_THAT(info_->extensions(),
253 Not(HasSubstr("GL_IMG_texture_compression_pvrtc")));
254 EXPECT_FALSE(info_->feature_flags().npot_ok);
255 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
256 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
257 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
258 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
259 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
260 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
261 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
262 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
263 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
264 GL_ETC1_RGB8_OES));
265 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
266 GL_ATC_RGB_AMD));
267 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
268 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
269 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
270 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
271 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
272 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
273 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
274 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
275 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
276 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
277 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
278 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
279 EXPECT_FALSE(info_->validators()->read_pixel_format.IsValid(
280 GL_BGRA_EXT));
281 EXPECT_FALSE(info_->validators()->texture_parameter.IsValid(
282 GL_TEXTURE_MAX_ANISOTROPY_EXT));
283 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
284 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
285 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
286 GL_READ_FRAMEBUFFER_EXT));
287 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
288 GL_DRAW_FRAMEBUFFER_EXT));
289 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
290 GL_READ_FRAMEBUFFER_BINDING_EXT));
291 EXPECT_FALSE(info_->validators()->render_buffer_parameter.IsValid(
292 GL_MAX_SAMPLES_EXT));
293 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
294 GL_DEPTH_COMPONENT));
295 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
296 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
297 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
298 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
299 GL_DEPTH24_STENCIL8));
300 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
301 GL_DEPTH_STENCIL));
302 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
303 GL_RGBA32F));
304 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
305 GL_RGB32F));
306 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
307 GL_DEPTH_STENCIL));
308 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(
309 GL_UNSIGNED_INT_24_8));
310 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
311 GL_DEPTH_COMPONENT24));
312 EXPECT_FALSE(info_->validators()->texture_parameter.IsValid(
313 GL_TEXTURE_USAGE_ANGLE));
314 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
315 GL_DEPTH_COMPONENT16));
316 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
317 GL_DEPTH_COMPONENT32_OES));
318 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
319 GL_DEPTH24_STENCIL8_OES));
320 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MIN_EXT));
321 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MAX_EXT));
322 EXPECT_FALSE(info_->feature_flags().chromium_sync_query);
325 TEST_F(FeatureInfoTest, InitializeWithANGLE) {
326 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE, "");
327 EXPECT_TRUE(info_->feature_flags().is_angle);
330 TEST_F(FeatureInfoTest, InitializeNPOTExtensionGLES) {
331 SetupInitExpectations("GL_OES_texture_npot");
332 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot"));
333 EXPECT_TRUE(info_->feature_flags().npot_ok);
336 TEST_F(FeatureInfoTest, InitializeNPOTExtensionGL) {
337 SetupInitExpectations("GL_ARB_texture_non_power_of_two");
338 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot"));
339 EXPECT_TRUE(info_->feature_flags().npot_ok);
342 TEST_F(FeatureInfoTest, InitializeDXTExtensionGLES2) {
343 SetupInitExpectations("GL_EXT_texture_compression_dxt1");
344 EXPECT_THAT(info_->extensions(),
345 HasSubstr("GL_EXT_texture_compression_dxt1"));
346 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
347 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
348 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
349 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
350 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
351 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
352 EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid(
353 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
356 TEST_F(FeatureInfoTest, InitializeDXTExtensionGL) {
357 SetupInitExpectations("GL_EXT_texture_compression_s3tc");
358 EXPECT_THAT(info_->extensions(),
359 HasSubstr("GL_EXT_texture_compression_dxt1"));
360 EXPECT_THAT(info_->extensions(),
361 HasSubstr("GL_CHROMIUM_texture_compression_dxt3"));
362 EXPECT_THAT(info_->extensions(),
363 HasSubstr("GL_CHROMIUM_texture_compression_dxt5"));
364 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
365 GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
366 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
367 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
368 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
369 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
370 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
371 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
374 TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GLES2) {
375 SetupInitExpectations("GL_EXT_texture_format_BGRA8888");
376 EXPECT_THAT(info_->extensions(),
377 HasSubstr("GL_EXT_texture_format_BGRA8888"));
378 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
379 GL_BGRA_EXT));
380 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
381 GL_BGRA_EXT));
382 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_BGRA_EXT).IsValid(
383 GL_UNSIGNED_BYTE));
384 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
385 GL_BGRA8_EXT));
388 TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GL) {
389 SetupInitExpectations("GL_EXT_bgra");
390 EXPECT_THAT(info_->extensions(),
391 HasSubstr("GL_EXT_texture_format_BGRA8888"));
392 EXPECT_THAT(info_->extensions(),
393 HasSubstr("GL_EXT_read_format_bgra"));
394 EXPECT_THAT(info_->extensions(),
395 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
396 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
397 GL_BGRA_EXT));
398 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
399 GL_BGRA_EXT));
400 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(
401 GL_BGRA_EXT));
402 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_BGRA_EXT).IsValid(
403 GL_UNSIGNED_BYTE));
404 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
405 GL_BGRA8_EXT));
408 TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888Apple) {
409 SetupInitExpectations("GL_APPLE_texture_format_BGRA8888");
410 EXPECT_THAT(info_->extensions(),
411 HasSubstr("GL_EXT_texture_format_BGRA8888"));
412 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
413 GL_BGRA_EXT));
414 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
415 GL_BGRA_EXT));
416 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_BGRA_EXT).IsValid(
417 GL_UNSIGNED_BYTE));
418 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
419 GL_BGRA8_EXT));
422 TEST_F(FeatureInfoTest, InitializeEXT_read_format_bgra) {
423 SetupInitExpectations("GL_EXT_read_format_bgra");
424 EXPECT_THAT(info_->extensions(),
425 HasSubstr("GL_EXT_read_format_bgra"));
426 EXPECT_FALSE(info_->validators()->texture_format.IsValid(
427 GL_BGRA_EXT));
428 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
429 GL_BGRA_EXT));
430 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(
431 GL_BGRA_EXT));
432 EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid(
433 GL_BGRA8_EXT));
436 TEST_F(FeatureInfoTest, InitializeEXT_texture_storage) {
437 SetupInitExpectations("GL_EXT_texture_storage");
438 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
439 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
440 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
441 GL_TEXTURE_IMMUTABLE_FORMAT_EXT));
442 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
443 GL_BGRA8_EXT));
444 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
445 GL_RGBA32F_EXT));
446 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
447 GL_RGB32F_EXT));
448 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
449 GL_ALPHA32F_EXT));
450 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
451 GL_LUMINANCE32F_EXT));
452 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
453 GL_LUMINANCE_ALPHA32F_EXT));
454 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
455 GL_RGBA16F_EXT));
456 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
457 GL_RGB16F_EXT));
458 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
459 GL_ALPHA16F_EXT));
460 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
461 GL_LUMINANCE16F_EXT));
462 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
463 GL_LUMINANCE_ALPHA16F_EXT));
466 TEST_F(FeatureInfoTest, InitializeARB_texture_storage) {
467 SetupInitExpectations("GL_ARB_texture_storage");
468 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
469 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
470 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
471 GL_TEXTURE_IMMUTABLE_FORMAT_EXT));
474 TEST_F(FeatureInfoTest, InitializeEXT_texture_storage_BGRA) {
475 SetupInitExpectations("GL_EXT_texture_storage GL_EXT_bgra");
476 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
477 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
478 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
479 GL_BGRA8_EXT));
480 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
483 TEST_F(FeatureInfoTest, InitializeARB_texture_storage_BGRA) {
484 SetupInitExpectations("GL_ARB_texture_storage GL_EXT_bgra");
485 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
486 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
487 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
488 GL_BGRA8_EXT));
489 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
492 TEST_F(FeatureInfoTest, InitializeEXT_texture_storage_BGRA8888) {
493 SetupInitExpectations(
494 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888");
495 EXPECT_TRUE(info_->feature_flags().ext_texture_storage);
496 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
497 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
498 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
499 GL_BGRA8_EXT));
500 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
503 TEST_F(FeatureInfoTest, InitializeEXT_texture_storage_float) {
504 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_float");
505 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
506 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float"));
507 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
508 GL_RGBA32F_EXT));
509 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
510 GL_RGB32F_EXT));
511 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
512 GL_ALPHA32F_EXT));
513 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
514 GL_LUMINANCE32F_EXT));
515 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
516 GL_LUMINANCE_ALPHA32F_EXT));
519 TEST_F(FeatureInfoTest, InitializeEXT_texture_storage_half_float) {
520 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_half_float");
521 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
522 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_half_float"));
523 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
524 GL_RGBA16F_EXT));
525 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
526 GL_RGB16F_EXT));
527 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
528 GL_ALPHA16F_EXT));
529 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
530 GL_LUMINANCE16F_EXT));
531 EXPECT_TRUE(info_->validators()->texture_internal_format_storage.IsValid(
532 GL_LUMINANCE_ALPHA16F_EXT));
535 // Check how to handle ES, texture_storage and BGRA combination; 8 tests.
537 // 1- ES2 + GL_EXT_texture_storage -> GL_EXT_texture_storage (and no
538 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8 in
539 // glTexStorage2DEXT)
540 TEST_F(FeatureInfoTest, InitializeGLES2_texture_storage) {
541 SetupInitExpectationsWithGLVersion(
542 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
543 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
544 EXPECT_THAT(info_->extensions(),
545 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
548 // 2- ES2 + GL_EXT_texture_storage + (GL_EXT_texture_format_BGRA8888 or
549 // GL_APPLE_texture_format_bgra8888)
550 TEST_F(FeatureInfoTest, InitializeGLES2_texture_storage_BGRA) {
551 SetupInitExpectationsWithGLVersion(
552 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
554 "OpenGL ES 2.0");
555 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
556 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
559 // 3- ES2 + GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_bgra8888
560 TEST_F(FeatureInfoTest, InitializeGLES2_texture_format_BGRA) {
561 SetupInitExpectationsWithGLVersion(
562 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 2.0");
563 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
564 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
567 // 4- ES2 (neither GL_EXT_texture_storage nor GL_EXT_texture_format_BGRA8888) ->
568 // nothing
569 TEST_F(FeatureInfoTest, InitializeGLES2_neither_texture_storage_nor_BGRA) {
570 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
571 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
572 EXPECT_THAT(info_->extensions(),
573 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
576 // 5- ES3 + GL_EXT_texture_format_BGRA8888 -> GL_EXT_texture_format_BGRA8888
577 // (we can't expose GL_EXT_texture_storage because we fail the GL_BGRA8
578 // requirement)
579 TEST_F(FeatureInfoTest, InitializeGLES3_texture_storage_EXT_BGRA) {
580 SetupInitExpectationsWithGLVersion(
581 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 3.0");
582 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
583 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
586 // 6- ES3 + GL_APPLE_texture_format_bgra8888 -> GL_EXT_texture_storage +
587 // GL_EXT_texture_format_BGRA8888 (driver promises to handle GL_BGRA8 by
588 // exposing GL_APPLE_texture_format_bgra8888)
589 TEST_F(FeatureInfoTest, InitializeGLES3_texture_storage_APPLE_BGRA) {
590 SetupInitExpectationsWithGLVersion(
591 "GL_APPLE_texture_format_BGRA8888", "", "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 // 7- ES3 + GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 ->
597 // GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 (driver promises to
598 // handle GL_BGRA8 by exposing GL_EXT_texture_storage)
599 TEST_F(FeatureInfoTest, InitializeGLES3_EXT_texture_storage_EXT_BGRA) {
600 SetupInitExpectationsWithGLVersion(
601 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
603 "OpenGL ES 3.0");
604 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
605 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
608 // 8- ES3 + none of the above -> GL_EXT_texture_storage (and no
609 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8)
610 TEST_F(FeatureInfoTest, InitializeGLES3_texture_storage) {
611 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
612 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_storage"));
613 EXPECT_THAT(info_->extensions(),
614 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
617 TEST_F(FeatureInfoTest, InitializeARB_texture_float) {
618 SetupInitExpectations("GL_ARB_texture_float");
619 EXPECT_TRUE(info_->feature_flags().chromium_color_buffer_float_rgba);
620 EXPECT_TRUE(info_->feature_flags().chromium_color_buffer_float_rgb);
621 std::string extensions = info_->extensions() + " ";
622 EXPECT_THAT(extensions, HasSubstr("GL_CHROMIUM_color_buffer_float_rgb "));
623 EXPECT_THAT(extensions, HasSubstr("GL_CHROMIUM_color_buffer_float_rgba"));
624 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
625 GL_RGBA32F));
626 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
627 GL_RGB32F));
630 TEST_F(FeatureInfoTest, InitializeOES_texture_floatGLES2) {
631 SetupInitExpectations("GL_OES_texture_float");
632 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
633 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
634 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float"));
635 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
636 EXPECT_THAT(info_->extensions(),
637 Not(HasSubstr("GL_OES_texture_float_linear")));
638 EXPECT_THAT(info_->extensions(),
639 Not(HasSubstr("GL_OES_texture_half_float_linear")));
640 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
641 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
642 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
643 GL_FLOAT));
644 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
645 GL_FLOAT));
646 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
647 GL_FLOAT));
648 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
649 GL_FLOAT));
650 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
651 GL_FLOAT));
652 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
653 GL_HALF_FLOAT_OES));
654 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
655 GL_HALF_FLOAT_OES));
656 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
657 GL_HALF_FLOAT_OES));
658 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
659 GL_HALF_FLOAT_OES));
660 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
661 GL_HALF_FLOAT_OES));
664 TEST_F(FeatureInfoTest, InitializeOES_texture_float_linearGLES2) {
665 SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear");
666 EXPECT_TRUE(info_->feature_flags().enable_texture_float_linear);
667 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
668 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float"));
669 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
670 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float_linear"));
671 EXPECT_THAT(info_->extensions(),
672 Not(HasSubstr("GL_OES_texture_half_float_linear")));
673 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
674 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
675 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
676 GL_FLOAT));
677 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
678 GL_FLOAT));
679 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
680 GL_FLOAT));
681 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
682 GL_FLOAT));
683 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
684 GL_FLOAT));
685 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
686 GL_HALF_FLOAT_OES));
687 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
688 GL_HALF_FLOAT_OES));
689 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
690 GL_HALF_FLOAT_OES));
691 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
692 GL_HALF_FLOAT_OES));
693 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
694 GL_HALF_FLOAT_OES));
697 TEST_F(FeatureInfoTest, InitializeOES_texture_half_floatGLES2) {
698 SetupInitExpectations("GL_OES_texture_half_float");
699 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
700 EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear);
701 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float")));
702 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_half_float"));
703 EXPECT_THAT(info_->extensions(),
704 Not(HasSubstr("GL_OES_texture_float_linear")));
705 EXPECT_THAT(info_->extensions(),
706 Not(HasSubstr("GL_OES_texture_half_float_linear")));
707 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
708 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
709 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
710 GL_FLOAT));
711 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
712 GL_FLOAT));
713 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
714 GL_FLOAT));
715 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
716 GL_FLOAT));
717 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
718 GL_FLOAT));
719 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
720 GL_HALF_FLOAT_OES));
721 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
722 GL_HALF_FLOAT_OES));
723 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
724 GL_HALF_FLOAT_OES));
725 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
726 GL_HALF_FLOAT_OES));
727 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
728 GL_HALF_FLOAT_OES));
731 TEST_F(FeatureInfoTest, InitializeOES_texture_half_float_linearGLES2) {
732 SetupInitExpectations(
733 "GL_OES_texture_half_float GL_OES_texture_half_float_linear");
734 EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear);
735 EXPECT_TRUE(info_->feature_flags().enable_texture_half_float_linear);
736 EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float")));
737 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_half_float"));
738 EXPECT_THAT(info_->extensions(),
739 Not(HasSubstr("GL_OES_texture_float_linear")));
740 EXPECT_THAT(info_->extensions(),
741 HasSubstr("GL_OES_texture_half_float_linear"));
742 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_FLOAT));
743 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
744 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
745 GL_FLOAT));
746 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
747 GL_FLOAT));
748 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
749 GL_FLOAT));
750 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
751 GL_FLOAT));
752 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
753 GL_FLOAT));
754 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_ALPHA).IsValid(
755 GL_HALF_FLOAT_OES));
756 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGB).IsValid(
757 GL_HALF_FLOAT_OES));
758 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_RGBA).IsValid(
759 GL_HALF_FLOAT_OES));
760 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE).IsValid(
761 GL_HALF_FLOAT_OES));
762 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_LUMINANCE_ALPHA).IsValid(
763 GL_HALF_FLOAT_OES));
766 TEST_F(FeatureInfoTest, InitializeEXT_framebuffer_multisample) {
767 SetupInitExpectations("GL_EXT_framebuffer_multisample");
768 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
769 EXPECT_THAT(info_->extensions(),
770 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
771 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
772 GL_READ_FRAMEBUFFER_EXT));
773 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
774 GL_DRAW_FRAMEBUFFER_EXT));
775 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
776 GL_READ_FRAMEBUFFER_BINDING_EXT));
777 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
778 GL_MAX_SAMPLES_EXT));
779 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
780 GL_RENDERBUFFER_SAMPLES_EXT));
783 TEST_F(FeatureInfoTest, InitializeANGLE_framebuffer_multisample) {
784 SetupInitExpectationsWithGLVersion(
785 "GL_ANGLE_framebuffer_multisample", kGLRendererStringANGLE, "");
786 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
787 EXPECT_THAT(info_->extensions(),
788 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
789 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
790 GL_READ_FRAMEBUFFER_EXT));
791 EXPECT_TRUE(info_->validators()->frame_buffer_target.IsValid(
792 GL_DRAW_FRAMEBUFFER_EXT));
793 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
794 GL_READ_FRAMEBUFFER_BINDING_EXT));
795 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
796 GL_MAX_SAMPLES_EXT));
797 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
798 GL_RENDERBUFFER_SAMPLES_EXT));
801 // We don't allow ANGLE_framebuffer_multisample on non-ANGLE implementations,
802 // because we wouldn't be choosing the right driver entry point and because the
803 // extension was falsely advertised on some Android devices (crbug.com/165736).
804 TEST_F(FeatureInfoTest, InitializeANGLE_framebuffer_multisampleWithoutANGLE) {
805 SetupInitExpectations("GL_ANGLE_framebuffer_multisample");
806 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample);
807 EXPECT_THAT(info_->extensions(),
808 Not(HasSubstr("GL_CHROMIUM_framebuffer_multisample")));
809 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
810 GL_READ_FRAMEBUFFER_EXT));
811 EXPECT_FALSE(info_->validators()->frame_buffer_target.IsValid(
812 GL_DRAW_FRAMEBUFFER_EXT));
813 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
814 GL_READ_FRAMEBUFFER_BINDING_EXT));
815 EXPECT_FALSE(info_->validators()->g_l_state.IsValid(
816 GL_MAX_SAMPLES_EXT));
817 EXPECT_FALSE(info_->validators()->render_buffer_parameter.IsValid(
818 GL_RENDERBUFFER_SAMPLES_EXT));
821 TEST_F(FeatureInfoTest, InitializeEXT_multisampled_render_to_texture) {
822 SetupInitExpectations("GL_EXT_multisampled_render_to_texture");
823 EXPECT_TRUE(info_->feature_flags(
824 ).multisampled_render_to_texture);
825 EXPECT_FALSE(info_->feature_flags(
826 ).use_img_for_multisampled_render_to_texture);
827 EXPECT_THAT(info_->extensions(),
828 HasSubstr("GL_EXT_multisampled_render_to_texture"));
829 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
830 GL_MAX_SAMPLES_EXT));
831 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
832 GL_RENDERBUFFER_SAMPLES_EXT));
833 EXPECT_TRUE(info_->validators()->frame_buffer_parameter.IsValid(
834 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT));
837 TEST_F(FeatureInfoTest, InitializeIMG_multisampled_render_to_texture) {
838 SetupInitExpectations("GL_IMG_multisampled_render_to_texture");
839 EXPECT_TRUE(info_->feature_flags(
840 ).multisampled_render_to_texture);
841 EXPECT_TRUE(info_->feature_flags(
842 ).use_img_for_multisampled_render_to_texture);
843 EXPECT_THAT(info_->extensions(),
844 HasSubstr("GL_EXT_multisampled_render_to_texture"));
845 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
846 GL_MAX_SAMPLES_EXT));
847 EXPECT_TRUE(info_->validators()->render_buffer_parameter.IsValid(
848 GL_RENDERBUFFER_SAMPLES_EXT));
849 EXPECT_TRUE(info_->validators()->frame_buffer_parameter.IsValid(
850 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT));
853 TEST_F(FeatureInfoTest, InitializeEXT_texture_filter_anisotropic) {
854 SetupInitExpectations("GL_EXT_texture_filter_anisotropic");
855 EXPECT_THAT(info_->extensions(),
856 HasSubstr("GL_EXT_texture_filter_anisotropic"));
857 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
858 GL_TEXTURE_MAX_ANISOTROPY_EXT));
859 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
860 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
863 TEST_F(FeatureInfoTest, InitializeEXT_ARB_depth_texture) {
864 SetupInitExpectations("GL_ARB_depth_texture");
865 EXPECT_THAT(info_->extensions(),
866 HasSubstr("GL_GOOGLE_depth_texture"));
867 EXPECT_THAT(info_->extensions(),
868 HasSubstr("GL_CHROMIUM_depth_texture"));
869 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
870 GL_DEPTH_COMPONENT));
871 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
872 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
873 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
874 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
875 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
876 GL_UNSIGNED_SHORT));
877 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
878 GL_UNSIGNED_INT));
879 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL).IsValid(
880 GL_UNSIGNED_INT_24_8));
883 TEST_F(FeatureInfoTest, InitializeOES_ARB_depth_texture) {
884 SetupInitExpectations("GL_OES_depth_texture");
885 EXPECT_THAT(info_->extensions(),
886 HasSubstr("GL_GOOGLE_depth_texture"));
887 EXPECT_THAT(info_->extensions(),
888 HasSubstr("GL_CHROMIUM_depth_texture"));
889 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
890 GL_DEPTH_COMPONENT));
891 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
892 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
893 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
894 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
895 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
896 GL_UNSIGNED_SHORT));
897 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
898 GL_UNSIGNED_INT));
899 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL).IsValid(
900 GL_UNSIGNED_INT_24_8));
903 TEST_F(FeatureInfoTest, InitializeANGLE_depth_texture) {
904 SetupInitExpectations("GL_ANGLE_depth_texture");
905 EXPECT_THAT(info_->extensions(),
906 HasSubstr("GL_GOOGLE_depth_texture"));
907 EXPECT_THAT(info_->extensions(),
908 HasSubstr("GL_CHROMIUM_depth_texture"));
909 EXPECT_THAT(info_->extensions(),
910 Not(HasSubstr("GL_ANGLE_depth_texture")));
911 EXPECT_TRUE(info_->feature_flags().angle_depth_texture);
912 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
913 GL_DEPTH_COMPONENT));
914 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
915 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
916 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
917 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
918 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
919 GL_DEPTH_COMPONENT16));
920 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
921 GL_DEPTH_COMPONENT32_OES));
922 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid(
923 GL_DEPTH24_STENCIL8_OES));
924 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
925 GL_UNSIGNED_SHORT));
926 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
927 GL_UNSIGNED_INT));
928 EXPECT_FALSE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL).IsValid(
929 GL_UNSIGNED_INT_24_8));
932 TEST_F(FeatureInfoTest, InitializeEXT_packed_depth_stencil) {
933 SetupInitExpectations("GL_EXT_packed_depth_stencil");
934 EXPECT_THAT(info_->extensions(),
935 HasSubstr("GL_OES_packed_depth_stencil"));
936 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
937 GL_DEPTH24_STENCIL8));
938 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
939 GL_DEPTH_COMPONENT));
940 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
941 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
942 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
945 TEST_F(FeatureInfoTest, InitializeOES_packed_depth_stencil) {
946 SetupInitExpectations("GL_OES_packed_depth_stencil");
947 EXPECT_THAT(info_->extensions(),
948 HasSubstr("GL_OES_packed_depth_stencil"));
949 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
950 GL_DEPTH24_STENCIL8));
951 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
952 GL_DEPTH_COMPONENT));
953 EXPECT_FALSE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
954 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
955 EXPECT_FALSE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
958 TEST_F(FeatureInfoTest,
959 InitializeOES_packed_depth_stencil_and_GL_ARB_depth_texture) {
960 SetupInitExpectations("GL_OES_packed_depth_stencil GL_ARB_depth_texture");
961 EXPECT_THAT(info_->extensions(),
962 HasSubstr("GL_OES_packed_depth_stencil"));
963 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
964 GL_DEPTH24_STENCIL8));
965 EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid(
966 GL_DEPTH_STENCIL));
967 EXPECT_TRUE(info_->validators()->texture_format.IsValid(
968 GL_DEPTH_STENCIL));
969 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(
970 GL_UNSIGNED_INT_24_8));
971 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
972 GL_UNSIGNED_SHORT));
973 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT).IsValid(
974 GL_UNSIGNED_INT));
975 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL).IsValid(
976 GL_UNSIGNED_INT_24_8));
979 TEST_F(FeatureInfoTest, InitializeOES_depth24) {
980 SetupInitExpectations("GL_OES_depth24");
981 EXPECT_TRUE(info_->feature_flags().oes_depth24);
982 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24"));
983 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
984 GL_DEPTH_COMPONENT24));
987 TEST_F(FeatureInfoTest, InitializeOES_standard_derivatives) {
988 SetupInitExpectations("GL_OES_standard_derivatives");
989 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives"));
990 EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives);
991 EXPECT_TRUE(info_->validators()->hint_target.IsValid(
992 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
993 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
994 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES));
997 TEST_F(FeatureInfoTest, InitializeOES_rgb8_rgba8) {
998 SetupInitExpectations("GL_OES_rgb8_rgba8");
999 EXPECT_THAT(info_->extensions(),
1000 HasSubstr("GL_OES_rgb8_rgba8"));
1001 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
1002 GL_RGB8_OES));
1003 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(
1004 GL_RGBA8_OES));
1007 TEST_F(FeatureInfoTest, InitializeOES_EGL_image_external) {
1008 SetupInitExpectations("GL_OES_EGL_image_external");
1009 EXPECT_THAT(info_->extensions(),
1010 HasSubstr("GL_OES_EGL_image_external"));
1011 EXPECT_TRUE(info_->feature_flags().oes_egl_image_external);
1012 EXPECT_TRUE(info_->validators()->texture_bind_target.IsValid(
1013 GL_TEXTURE_EXTERNAL_OES));
1014 EXPECT_TRUE(info_->validators()->get_tex_param_target.IsValid(
1015 GL_TEXTURE_EXTERNAL_OES));
1016 EXPECT_TRUE(info_->validators()->texture_parameter.IsValid(
1017 GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES));
1018 EXPECT_TRUE(info_->validators()->g_l_state.IsValid(
1019 GL_TEXTURE_BINDING_EXTERNAL_OES));
1022 TEST_F(FeatureInfoTest, InitializeOES_compressed_ETC1_RGB8_texture) {
1023 SetupInitExpectations("GL_OES_compressed_ETC1_RGB8_texture");
1024 EXPECT_THAT(info_->extensions(),
1025 HasSubstr("GL_OES_compressed_ETC1_RGB8_texture"));
1026 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1027 GL_ETC1_RGB8_OES));
1028 EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid(
1029 GL_ETC1_RGB8_OES));
1032 TEST_F(FeatureInfoTest, InitializeAMD_compressed_ATC_texture) {
1033 SetupInitExpectations("GL_AMD_compressed_ATC_texture");
1034 EXPECT_THAT(info_->extensions(),
1035 HasSubstr("GL_AMD_compressed_ATC_texture"));
1036 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1037 GL_ATC_RGB_AMD));
1038 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1039 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
1040 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1041 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
1044 TEST_F(FeatureInfoTest, InitializeIMG_texture_compression_pvrtc) {
1045 SetupInitExpectations("GL_IMG_texture_compression_pvrtc");
1046 EXPECT_THAT(info_->extensions(),
1047 HasSubstr("GL_IMG_texture_compression_pvrtc"));
1048 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1049 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
1050 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1051 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
1052 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1053 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
1054 EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid(
1055 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
1058 TEST_F(FeatureInfoTest, InitializeEXT_occlusion_query_boolean) {
1059 SetupInitExpectations("GL_EXT_occlusion_query_boolean");
1060 EXPECT_THAT(info_->extensions(),
1061 HasSubstr("GL_EXT_occlusion_query_boolean"));
1062 EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean);
1063 EXPECT_FALSE(info_->feature_flags(
1064 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
1065 EXPECT_FALSE(info_->feature_flags(
1066 ).use_arb_occlusion_query_for_occlusion_query_boolean);
1069 TEST_F(FeatureInfoTest, InitializeARB_occlusion_query) {
1070 SetupInitExpectations("GL_ARB_occlusion_query");
1071 EXPECT_THAT(info_->extensions(),
1072 HasSubstr("GL_EXT_occlusion_query_boolean"));
1073 EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean);
1074 EXPECT_FALSE(info_->feature_flags(
1075 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
1076 EXPECT_TRUE(info_->feature_flags(
1077 ).use_arb_occlusion_query_for_occlusion_query_boolean);
1080 TEST_F(FeatureInfoTest, InitializeARB_occlusion_query2) {
1081 SetupInitExpectations("GL_ARB_occlusion_query2 GL_ARB_occlusion_query2");
1082 EXPECT_THAT(info_->extensions(),
1083 HasSubstr("GL_EXT_occlusion_query_boolean"));
1084 EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean);
1085 EXPECT_TRUE(info_->feature_flags(
1086 ).use_arb_occlusion_query2_for_occlusion_query_boolean);
1087 EXPECT_FALSE(info_->feature_flags(
1088 ).use_arb_occlusion_query_for_occlusion_query_boolean);
1091 TEST_F(FeatureInfoTest, InitializeOES_vertex_array_object) {
1092 SetupInitExpectations("GL_OES_vertex_array_object");
1093 EXPECT_THAT(info_->extensions(),
1094 HasSubstr("GL_OES_vertex_array_object"));
1095 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1098 TEST_F(FeatureInfoTest, InitializeARB_vertex_array_object) {
1099 SetupInitExpectations("GL_ARB_vertex_array_object");
1100 EXPECT_THAT(info_->extensions(),
1101 HasSubstr("GL_OES_vertex_array_object"));
1102 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1105 TEST_F(FeatureInfoTest, InitializeAPPLE_vertex_array_object) {
1106 SetupInitExpectations("GL_APPLE_vertex_array_object");
1107 EXPECT_THAT(info_->extensions(),
1108 HasSubstr("GL_OES_vertex_array_object"));
1109 EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
1112 TEST_F(FeatureInfoTest, InitializeNo_vertex_array_object) {
1113 SetupInitExpectations("");
1114 // Even if the native extensions are not available the implementation
1115 // may still emulate the GL_OES_vertex_array_object functionality. In this
1116 // scenario native_vertex_array_object must be false.
1117 EXPECT_THAT(info_->extensions(),
1118 HasSubstr("GL_OES_vertex_array_object"));
1119 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object);
1122 TEST_F(FeatureInfoTest, InitializeOES_element_index_uint) {
1123 SetupInitExpectations("GL_OES_element_index_uint");
1124 EXPECT_THAT(info_->extensions(),
1125 HasSubstr("GL_OES_element_index_uint"));
1126 EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT));
1129 TEST_F(FeatureInfoTest, InitializeVAOsWithClientSideArrays) {
1130 CommandLine command_line(0, NULL);
1131 command_line.AppendSwitchASCII(
1132 switches::kGpuDriverBugWorkarounds,
1133 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
1134 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object",
1135 command_line);
1136 EXPECT_TRUE(info_->workarounds().use_client_side_arrays_for_stream_buffers);
1137 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object);
1140 TEST_F(FeatureInfoTest, InitializeEXT_blend_minmax) {
1141 SetupInitExpectations("GL_EXT_blend_minmax");
1142 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_blend_minmax"));
1143 EXPECT_TRUE(info_->validators()->equation.IsValid(GL_MIN_EXT));
1144 EXPECT_TRUE(info_->validators()->equation.IsValid(GL_MAX_EXT));
1147 TEST_F(FeatureInfoTest, InitializeEXT_frag_depth) {
1148 SetupInitExpectations("GL_EXT_frag_depth");
1149 EXPECT_TRUE(info_->feature_flags().ext_frag_depth);
1150 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_frag_depth"));
1153 TEST_F(FeatureInfoTest, InitializeEXT_shader_texture_lod) {
1154 SetupInitExpectations("GL_EXT_shader_texture_lod");
1155 EXPECT_TRUE(info_->feature_flags().ext_shader_texture_lod);
1156 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_shader_texture_lod"));
1159 TEST_F(FeatureInfoTest, InitializeEXT_discard_framebuffer) {
1160 SetupInitExpectations("GL_EXT_discard_framebuffer");
1161 EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
1162 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1165 TEST_F(FeatureInfoTest, InitializeSamplersWithARBSamplerObjects) {
1166 SetupInitExpectationsWithGLVersion(
1167 "GL_ARB_sampler_objects", "", "OpenGL 3.0");
1168 EXPECT_TRUE(info_->feature_flags().enable_samplers);
1171 TEST_F(FeatureInfoTest, InitializeWithES3) {
1172 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
1173 EXPECT_TRUE(info_->feature_flags().enable_samplers);
1174 EXPECT_TRUE(info_->feature_flags().map_buffer_range);
1175 EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
1176 EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1177 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
1178 EXPECT_TRUE(info_->feature_flags().use_core_framebuffer_multisample);
1179 EXPECT_THAT(info_->extensions(),
1180 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
1181 EXPECT_TRUE(info_->feature_flags().use_async_readpixels);
1182 EXPECT_TRUE(info_->feature_flags().oes_depth24);
1183 EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
1184 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
1185 EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT_24_8));
1186 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT)
1187 .IsValid(GL_UNSIGNED_SHORT));
1188 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT)
1189 .IsValid(GL_UNSIGNED_INT));
1190 EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_STENCIL)
1191 .IsValid(GL_UNSIGNED_INT_24_8));
1192 EXPECT_TRUE(info_->feature_flags().packed_depth24_stencil8);
1193 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24"));
1194 EXPECT_TRUE(
1195 info_->validators()->render_buffer_format.IsValid(GL_DEPTH_COMPONENT24));
1196 EXPECT_TRUE(
1197 info_->validators()->render_buffer_format.IsValid(GL_DEPTH24_STENCIL8));
1198 EXPECT_TRUE(
1199 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
1200 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
1201 EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
1202 EXPECT_TRUE(gfx::GLFence::IsSupported());
1205 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) {
1206 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0");
1207 EXPECT_FALSE(info_->feature_flags().enable_samplers);
1210 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) {
1211 CommandLine command_line(0, NULL);
1212 command_line.AppendSwitchASCII(
1213 switches::kGpuDriverBugWorkarounds,
1214 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST));
1215 // Workarounds should get parsed without the need for a context.
1216 SetupWithCommandLine(command_line);
1217 EXPECT_TRUE(info_->workarounds().exit_on_context_lost);
1220 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) {
1221 CommandLine command_line(0, NULL);
1222 command_line.AppendSwitchASCII(
1223 switches::kGpuDriverBugWorkarounds,
1224 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," +
1225 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," +
1226 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096));
1227 // Workarounds should get parsed without the need for a context.
1228 SetupWithCommandLine(command_line);
1229 EXPECT_TRUE(info_->workarounds().exit_on_context_lost);
1230 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size);
1231 EXPECT_EQ(4096, info_->workarounds().max_texture_size);
1234 TEST_F(FeatureInfoTest, InitializeWithARBSync) {
1235 SetupInitExpectations("GL_ARB_sync");
1236 EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
1237 EXPECT_TRUE(gfx::GLFence::IsSupported());
1240 TEST_F(FeatureInfoTest, InitializeWithNVFence) {
1241 SetupInitExpectations("GL_NV_fence");
1242 EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
1243 EXPECT_TRUE(gfx::GLFence::IsSupported());
1246 TEST_F(FeatureInfoTest, ARBSyncDisabled) {
1247 CommandLine command_line(0, NULL);
1248 command_line.AppendSwitchASCII(
1249 switches::kGpuDriverBugWorkarounds,
1250 base::IntToString(gpu::DISABLE_ARB_SYNC));
1251 SetupInitExpectationsWithCommandLine("GL_ARB_sync", command_line);
1252 EXPECT_FALSE(info_->feature_flags().chromium_sync_query);
1253 EXPECT_FALSE(gfx::GLFence::IsSupported());
1256 TEST_F(FeatureInfoTest, InitializeCHROMIUM_path_rendering) {
1257 SetupInitExpectationsWithGLVersion(
1258 "GL_NV_path_rendering GL_EXT_direct_state_access", "", "4.3");
1259 EXPECT_TRUE(info_->feature_flags().chromium_path_rendering);
1260 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1263 TEST_F(FeatureInfoTest, InitializeCHROMIUM_path_rendering2) {
1264 SetupInitExpectationsWithGLVersion(
1265 "GL_NV_path_rendering", "", "OpenGL ES 3.1");
1266 EXPECT_TRUE(info_->feature_flags().chromium_path_rendering);
1267 EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1270 TEST_F(FeatureInfoTest, InitializeNoCHROMIUM_path_rendering) {
1271 SetupInitExpectationsWithGLVersion("", "", "4.3");
1272 EXPECT_FALSE(info_->feature_flags().chromium_path_rendering);
1273 EXPECT_THAT(info_->extensions(),
1274 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1277 TEST_F(FeatureInfoTest, InitializeNoCHROMIUM_path_rendering2) {
1278 SetupInitExpectationsWithGLVersion("GL_NV_path_rendering", "", "4.3");
1279 EXPECT_FALSE(info_->feature_flags().chromium_path_rendering);
1280 EXPECT_THAT(info_->extensions(),
1281 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1284 } // namespace gles2
1285 } // namespace gpu