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"
20 #include "ui/gl/gl_version_info.h"
23 using ::testing::DoAll
;
24 using ::testing::HasSubstr
;
25 using ::testing::InSequence
;
26 using ::testing::MatcherCast
;
28 using ::testing::Pointee
;
29 using ::testing::Return
;
30 using ::testing::SetArrayArgument
;
31 using ::testing::SetArgumentPointee
;
32 using ::testing::StrEq
;
38 const char kGLRendererStringANGLE
[] = "ANGLE (some renderer)";
39 } // anonymous namespace
41 enum MockedGLVersionKind
{
43 Version3_2Compatibility
47 : public GpuServiceTest
,
48 public ::testing::WithParamInterface
<MockedGLVersionKind
> {
53 void SetupInitExpectations(const char* extensions
) {
54 std::string extensions_str
= extensions
;
55 // Most of the tests' expectations currently assume the desktop
56 // OpenGL compatibility profile.
59 SetupInitExpectationsWithGLVersion(extensions_str
.c_str(), "", "3.0");
61 case Version3_2Compatibility
:
62 if (extensions_str
.find("GL_ARB_compatibility") == std::string::npos
) {
63 extensions_str
+= " GL_ARB_compatibility";
65 SetupInitExpectationsWithGLVersion(extensions_str
.c_str(), "", "3.2");
73 void SetupInitExpectationsWithGLVersion(
74 const char* extensions
, const char* renderer
, const char* version
) {
75 GpuServiceTest::SetUpWithGLVersion(version
, extensions
);
76 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
77 gl_
.get(), extensions
, renderer
, version
);
78 info_
= new FeatureInfo();
82 void SetupInitExpectationsWithGLVersionAndCommandLine(
83 const char* extensions
,
86 const base::CommandLine
& command_line
) {
87 GpuServiceTest::SetUpWithGLVersion(version
, extensions
);
88 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
89 gl_
.get(), extensions
, renderer
, version
);
90 info_
= new FeatureInfo(command_line
);
94 void SetupWithCommandLine(const base::CommandLine
& command_line
) {
95 GpuServiceTest::SetUp();
96 info_
= new FeatureInfo(command_line
);
99 void SetupInitExpectationsWithCommandLine(
100 const char* extensions
,
101 const base::CommandLine
& command_line
) {
102 GpuServiceTest::SetUpWithGLVersion("2.0", extensions
);
103 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
104 gl_
.get(), extensions
, "", "");
105 info_
= new FeatureInfo(command_line
);
109 void SetupWithoutInit() {
110 GpuServiceTest::SetUp();
111 info_
= new FeatureInfo();
115 void SetUp() override
{
116 // Do nothing here, since we are using the explicit Setup*() functions.
119 void TearDown() override
{
121 GpuServiceTest::TearDown();
124 scoped_refptr
<FeatureInfo
> info_
;
135 } // anonymous namespace.
137 static const MockedGLVersionKind kGLVersionKinds
[] = {
139 Version3_2Compatibility
142 INSTANTIATE_TEST_CASE_P(Service
,
144 ::testing::ValuesIn(kGLVersionKinds
));
146 TEST_P(FeatureInfoTest
, Basic
) {
148 // Test it starts off uninitialized.
149 EXPECT_FALSE(info_
->feature_flags().chromium_framebuffer_multisample
);
150 EXPECT_FALSE(info_
->feature_flags().use_core_framebuffer_multisample
);
151 EXPECT_FALSE(info_
->feature_flags().multisampled_render_to_texture
);
152 EXPECT_FALSE(info_
->feature_flags(
153 ).use_img_for_multisampled_render_to_texture
);
154 EXPECT_FALSE(info_
->feature_flags().oes_standard_derivatives
);
155 EXPECT_FALSE(info_
->feature_flags().npot_ok
);
156 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
157 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
158 EXPECT_FALSE(info_
->feature_flags().oes_egl_image_external
);
159 EXPECT_FALSE(info_
->feature_flags().oes_depth24
);
160 EXPECT_FALSE(info_
->feature_flags().packed_depth24_stencil8
);
161 EXPECT_FALSE(info_
->feature_flags().angle_translated_shader_source
);
162 EXPECT_FALSE(info_
->feature_flags().angle_pack_reverse_row_order
);
163 EXPECT_FALSE(info_
->feature_flags().arb_texture_rectangle
);
164 EXPECT_FALSE(info_
->feature_flags().angle_instanced_arrays
);
165 EXPECT_FALSE(info_
->feature_flags().occlusion_query_boolean
);
166 EXPECT_FALSE(info_
->feature_flags(
167 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
168 EXPECT_FALSE(info_
->feature_flags(
169 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
170 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
171 EXPECT_FALSE(info_
->feature_flags().map_buffer_range
);
172 EXPECT_FALSE(info_
->feature_flags().use_async_readpixels
);
173 EXPECT_FALSE(info_
->feature_flags().ext_draw_buffers
);
174 EXPECT_FALSE(info_
->feature_flags().nv_draw_buffers
);
175 EXPECT_FALSE(info_
->feature_flags().ext_discard_framebuffer
);
176 EXPECT_FALSE(info_
->feature_flags().angle_depth_texture
);
178 #define GPU_OP(type, name) EXPECT_FALSE(info_->workarounds().name);
179 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP
)
181 EXPECT_EQ(0, info_
->workarounds().max_texture_size
);
182 EXPECT_EQ(0, info_
->workarounds().max_cube_map_texture_size
);
183 EXPECT_FALSE(info_
->workarounds().gl_clear_broken
);
186 TEST_P(FeatureInfoTest
, InitializeNoExtensions
) {
187 SetupInitExpectations("");
188 // Check default extensions are there
189 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_resource_safe"));
190 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs"));
191 EXPECT_THAT(info_
->extensions(),
192 HasSubstr("GL_ANGLE_translated_shader_source"));
193 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_trace_marker"));
195 // Check a couple of random extensions that should not be there.
196 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_npot")));
197 EXPECT_THAT(info_
->extensions(),
198 Not(HasSubstr("GL_EXT_texture_compression_dxt1")));
199 EXPECT_THAT(info_
->extensions(),
200 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3")));
201 EXPECT_THAT(info_
->extensions(),
202 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5")));
203 EXPECT_THAT(info_
->extensions(),
204 Not(HasSubstr("GL_ANGLE_texture_usage")));
205 EXPECT_THAT(info_
->extensions(),
206 Not(HasSubstr("GL_EXT_texture_storage")));
207 EXPECT_THAT(info_
->extensions(),
208 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")));
209 EXPECT_THAT(info_
->extensions(),
210 Not(HasSubstr("GL_AMD_compressed_ATC_texture")));
211 EXPECT_THAT(info_
->extensions(),
212 Not(HasSubstr("GL_IMG_texture_compression_pvrtc")));
213 EXPECT_THAT(info_
->extensions(),
214 Not(HasSubstr("GL_EXT_sRGB")));
215 EXPECT_FALSE(info_
->feature_flags().npot_ok
);
216 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
217 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
218 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
219 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
220 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
221 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
222 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
223 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
224 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
226 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
228 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
229 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
));
230 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
231 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
));
232 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
233 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
));
234 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
235 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
));
236 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
237 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
));
238 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
239 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
));
240 EXPECT_FALSE(info_
->validators()->read_pixel_format
.IsValid(
242 EXPECT_FALSE(info_
->validators()->texture_parameter
.IsValid(
243 GL_TEXTURE_MAX_ANISOTROPY_EXT
));
244 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
245 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
));
246 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
247 GL_READ_FRAMEBUFFER_EXT
));
248 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
249 GL_DRAW_FRAMEBUFFER_EXT
));
250 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
251 GL_READ_FRAMEBUFFER_BINDING_EXT
));
252 EXPECT_FALSE(info_
->validators()->render_buffer_parameter
.IsValid(
253 GL_MAX_SAMPLES_EXT
));
254 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
255 GL_DEPTH_COMPONENT
));
256 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
257 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
258 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
259 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
260 GL_DEPTH24_STENCIL8
));
261 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
263 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
265 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
267 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
269 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(
270 GL_UNSIGNED_INT_24_8
));
271 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
272 GL_DEPTH_COMPONENT24
));
273 EXPECT_FALSE(info_
->validators()->texture_parameter
.IsValid(
274 GL_TEXTURE_USAGE_ANGLE
));
275 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
276 GL_DEPTH_COMPONENT16
));
277 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
278 GL_DEPTH_COMPONENT32_OES
));
279 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
280 GL_DEPTH24_STENCIL8_OES
));
281 EXPECT_FALSE(info_
->validators()->equation
.IsValid(GL_MIN_EXT
));
282 EXPECT_FALSE(info_
->validators()->equation
.IsValid(GL_MAX_EXT
));
283 EXPECT_FALSE(info_
->feature_flags().chromium_sync_query
);
284 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
286 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
288 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
290 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
292 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
293 GL_SRGB8_ALPHA8_EXT
));
294 EXPECT_FALSE(info_
->validators()->frame_buffer_parameter
.IsValid(
295 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
298 TEST_P(FeatureInfoTest
, InitializeWithANGLE
) {
299 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE
, "");
300 EXPECT_TRUE(info_
->gl_version_info().is_angle
);
303 TEST_P(FeatureInfoTest
, InitializeNPOTExtensionGLES
) {
304 SetupInitExpectations("GL_OES_texture_npot");
305 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_npot"));
306 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
309 TEST_P(FeatureInfoTest
, InitializeNPOTExtensionGL
) {
310 SetupInitExpectations("GL_ARB_texture_non_power_of_two");
311 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_npot"));
312 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
315 TEST_P(FeatureInfoTest
, InitializeDXTExtensionGLES2
) {
316 SetupInitExpectations("GL_EXT_texture_compression_dxt1");
317 EXPECT_THAT(info_
->extensions(),
318 HasSubstr("GL_EXT_texture_compression_dxt1"));
319 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
320 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
321 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
322 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
323 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
324 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
325 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
326 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
329 TEST_P(FeatureInfoTest
, InitializeDXTExtensionGL
) {
330 SetupInitExpectations("GL_EXT_texture_compression_s3tc");
331 EXPECT_THAT(info_
->extensions(),
332 HasSubstr("GL_EXT_texture_compression_dxt1"));
333 EXPECT_THAT(info_
->extensions(),
334 HasSubstr("GL_CHROMIUM_texture_compression_dxt3"));
335 EXPECT_THAT(info_
->extensions(),
336 HasSubstr("GL_CHROMIUM_texture_compression_dxt5"));
337 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
338 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
339 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
340 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
341 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
342 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
343 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
344 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
347 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888GLES2
) {
348 SetupInitExpectations("GL_EXT_texture_format_BGRA8888");
349 EXPECT_THAT(info_
->extensions(),
350 HasSubstr("GL_EXT_texture_format_BGRA8888"));
351 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
353 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
355 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
357 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
360 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888GL
) {
361 SetupInitExpectations("GL_EXT_bgra");
362 EXPECT_THAT(info_
->extensions(),
363 HasSubstr("GL_EXT_texture_format_BGRA8888"));
364 EXPECT_THAT(info_
->extensions(),
365 HasSubstr("GL_EXT_read_format_bgra"));
366 EXPECT_THAT(info_
->extensions(),
367 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
368 EXPECT_TRUE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
369 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
371 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
373 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
375 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
379 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888Apple
) {
380 SetupInitExpectations("GL_APPLE_texture_format_BGRA8888");
381 EXPECT_THAT(info_
->extensions(),
382 HasSubstr("GL_EXT_texture_format_BGRA8888"));
383 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
385 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
387 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
389 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
392 TEST_P(FeatureInfoTest
, InitializeGLES2EXT_read_format_bgra
) {
393 SetupInitExpectationsWithGLVersion(
394 "GL_EXT_read_format_bgra", "", "OpenGL ES 2.0");
395 EXPECT_THAT(info_
->extensions(),
396 HasSubstr("GL_EXT_read_format_bgra"));
397 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
399 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
401 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
403 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
405 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
408 TEST_P(FeatureInfoTest
, InitializeEXT_read_format_bgra
) {
409 SetupInitExpectations("GL_EXT_read_format_bgra");
410 EXPECT_THAT(info_
->extensions(),
411 HasSubstr("GL_EXT_read_format_bgra"));
412 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
414 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
416 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
418 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
420 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
423 TEST_P(FeatureInfoTest
, InitializeEXT_sRGB
) {
424 SetupInitExpectations("GL_EXT_sRGB GL_OES_rgb8_rgba8");
425 EXPECT_THAT(info_
->extensions(),
426 HasSubstr("GL_EXT_sRGB"));
427 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
429 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
431 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
433 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
435 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
436 GL_SRGB8_ALPHA8_EXT
));
437 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
438 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
441 TEST_P(FeatureInfoTest
, InitializeGLES2EXT_texture_storage
) {
442 SetupInitExpectationsWithGLVersion(
443 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
444 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
445 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
446 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
447 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
448 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
450 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
452 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
454 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
456 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
457 GL_LUMINANCE32F_EXT
));
458 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
459 GL_LUMINANCE_ALPHA32F_EXT
));
460 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
462 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
464 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
466 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
467 GL_LUMINANCE16F_EXT
));
468 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
469 GL_LUMINANCE_ALPHA16F_EXT
));
472 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage
) {
473 SetupInitExpectations("GL_EXT_texture_storage");
474 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
475 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
476 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
477 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
478 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
480 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
482 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
484 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
486 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
487 GL_LUMINANCE32F_EXT
));
488 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
489 GL_LUMINANCE_ALPHA32F_EXT
));
490 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
492 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
494 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
496 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
497 GL_LUMINANCE16F_EXT
));
498 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
499 GL_LUMINANCE_ALPHA16F_EXT
));
502 TEST_P(FeatureInfoTest
, InitializeARB_texture_storage
) {
503 SetupInitExpectations("GL_ARB_texture_storage");
504 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
505 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
506 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
507 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
510 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_BGRA
) {
511 SetupInitExpectations("GL_EXT_texture_storage GL_EXT_bgra");
512 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
513 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
514 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
516 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
519 TEST_P(FeatureInfoTest
, InitializeARB_texture_storage_BGRA
) {
520 SetupInitExpectations("GL_ARB_texture_storage GL_EXT_bgra");
521 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
522 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
523 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
525 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
528 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_BGRA8888
) {
529 SetupInitExpectations(
530 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888");
531 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
532 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
533 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
534 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
536 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
539 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_float
) {
540 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_float");
541 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
542 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
543 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
545 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
547 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
549 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
550 GL_LUMINANCE32F_EXT
));
551 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
552 GL_LUMINANCE_ALPHA32F_EXT
));
555 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_half_float
) {
556 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_half_float");
557 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
558 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
559 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
561 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
563 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
565 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
566 GL_LUMINANCE16F_EXT
));
567 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
568 GL_LUMINANCE_ALPHA16F_EXT
));
571 // Check how to handle ES, texture_storage and BGRA combination; 10 tests.
573 // 1- ES2 + GL_EXT_texture_storage -> GL_EXT_texture_storage (and no
574 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8 in
575 // glTexStorage2DEXT)
576 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_storage
) {
577 SetupInitExpectationsWithGLVersion(
578 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
579 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
580 EXPECT_THAT(info_
->extensions(),
581 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
584 // 2- ES2 + GL_EXT_texture_storage + (GL_EXT_texture_format_BGRA8888 or
585 // GL_APPLE_texture_format_bgra8888)
586 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_storage_BGRA
) {
587 SetupInitExpectationsWithGLVersion(
588 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
591 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
592 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
595 // 3- ES2 + GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_bgra8888
596 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_format_BGRA
) {
597 SetupInitExpectationsWithGLVersion(
598 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 2.0");
599 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
600 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
603 // 4- ES2 (neither GL_EXT_texture_storage nor GL_EXT_texture_format_BGRA8888) ->
605 TEST_P(FeatureInfoTest
, InitializeGLES2_neither_texture_storage_nor_BGRA
) {
606 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
607 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
608 EXPECT_THAT(info_
->extensions(),
609 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
612 // 5- ES3 + GL_EXT_texture_format_BGRA8888 -> GL_EXT_texture_format_BGRA8888
613 // (we can't expose GL_EXT_texture_storage because we fail the GL_BGRA8
615 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage_EXT_BGRA
) {
616 SetupInitExpectationsWithGLVersion(
617 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 3.0");
618 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
619 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
622 // 6- ES3 + GL_APPLE_texture_format_bgra8888 -> GL_EXT_texture_storage +
623 // GL_EXT_texture_format_BGRA8888 (driver promises to handle GL_BGRA8 by
624 // exposing GL_APPLE_texture_format_bgra8888)
625 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage_APPLE_BGRA
) {
626 SetupInitExpectationsWithGLVersion(
627 "GL_APPLE_texture_format_BGRA8888", "", "OpenGL ES 3.0");
628 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
629 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
632 // 7- ES3 + GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 ->
633 // GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 (driver promises to
634 // handle GL_BGRA8 by exposing GL_EXT_texture_storage)
635 TEST_P(FeatureInfoTest
, InitializeGLES3_EXT_texture_storage_EXT_BGRA
) {
636 SetupInitExpectationsWithGLVersion(
637 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
640 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
641 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
644 // 8- ES3 + none of the above -> GL_EXT_texture_storage (and no
645 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8)
646 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage
) {
647 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
648 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
649 EXPECT_THAT(info_
->extensions(),
650 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
653 // 9- ANGLE will add the GL_CHROMIUM_renderbuffer_format_BGRA8888 extension and
654 // the GL_BGRA8_EXT render buffer format.
655 TEST_P(FeatureInfoTest
, InitializeWithANGLE_BGRA8
) {
656 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE
, "");
657 EXPECT_TRUE(info_
->gl_version_info().is_angle
);
658 EXPECT_THAT(info_
->extensions(),
659 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
660 EXPECT_TRUE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
661 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_BGRA8_EXT
));
664 // 10- vanilla opengl es means no GL_CHROMIUM_renderbuffer_format_BGRA8888
665 TEST_P(FeatureInfoTest
,
666 InitializeGLES2_no_CHROMIUM_renderbuffer_format_BGRA8888
) {
667 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
668 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
669 EXPECT_THAT(info_
->extensions(),
670 Not(HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888")));
673 TEST_P(FeatureInfoTest
, InitializeARB_texture_float
) {
674 SetupInitExpectations("GL_ARB_texture_float");
675 EXPECT_TRUE(info_
->feature_flags().chromium_color_buffer_float_rgba
);
676 EXPECT_TRUE(info_
->feature_flags().chromium_color_buffer_float_rgb
);
677 std::string extensions
= info_
->extensions() + " ";
678 EXPECT_THAT(extensions
, HasSubstr("GL_CHROMIUM_color_buffer_float_rgb "));
679 EXPECT_THAT(extensions
, HasSubstr("GL_CHROMIUM_color_buffer_float_rgba"));
680 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
682 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
686 TEST_P(FeatureInfoTest
, Initialize_texture_floatGLES3
) {
687 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
688 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
689 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
690 EXPECT_THAT(info_
->extensions(),
691 Not(HasSubstr("GL_OES_texture_float_linear")));
692 EXPECT_THAT(info_
->extensions(),
693 Not(HasSubstr("GL_OES_texture_half_float_linear")));
696 TEST_P(FeatureInfoTest
, Initialize_sRGBGLES3
) {
697 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
698 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_sRGB")));
699 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
701 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
703 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
705 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
707 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
708 GL_SRGB8_ALPHA8_EXT
));
709 EXPECT_FALSE(info_
->validators()->frame_buffer_parameter
.IsValid(
710 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
713 TEST_P(FeatureInfoTest
, InitializeOES_texture_floatGLES2
) {
714 SetupInitExpectations("GL_OES_texture_float");
715 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
716 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
717 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
718 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
719 EXPECT_THAT(info_
->extensions(),
720 Not(HasSubstr("GL_OES_texture_float_linear")));
721 EXPECT_THAT(info_
->extensions(),
722 Not(HasSubstr("GL_OES_texture_half_float_linear")));
723 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
724 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
727 TEST_P(FeatureInfoTest
, InitializeOES_texture_float_linearGLES2
) {
728 SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear");
729 EXPECT_TRUE(info_
->feature_flags().enable_texture_float_linear
);
730 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
731 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
732 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
733 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float_linear"));
734 EXPECT_THAT(info_
->extensions(),
735 Not(HasSubstr("GL_OES_texture_half_float_linear")));
736 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
737 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
740 TEST_P(FeatureInfoTest
, InitializeOES_texture_half_floatGLES2
) {
741 SetupInitExpectations("GL_OES_texture_half_float");
742 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
743 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
744 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
745 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
746 EXPECT_THAT(info_
->extensions(),
747 Not(HasSubstr("GL_OES_texture_float_linear")));
748 EXPECT_THAT(info_
->extensions(),
749 Not(HasSubstr("GL_OES_texture_half_float_linear")));
750 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
751 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
754 TEST_P(FeatureInfoTest
, InitializeOES_texture_half_float_linearGLES2
) {
755 SetupInitExpectations(
756 "GL_OES_texture_half_float GL_OES_texture_half_float_linear");
757 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
758 EXPECT_TRUE(info_
->feature_flags().enable_texture_half_float_linear
);
759 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
760 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
761 EXPECT_THAT(info_
->extensions(),
762 Not(HasSubstr("GL_OES_texture_float_linear")));
763 EXPECT_THAT(info_
->extensions(),
764 HasSubstr("GL_OES_texture_half_float_linear"));
765 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
766 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
769 TEST_P(FeatureInfoTest
, InitializeEXT_framebuffer_multisample
) {
770 SetupInitExpectations("GL_EXT_framebuffer_multisample");
771 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
772 EXPECT_THAT(info_
->extensions(),
773 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
774 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
775 GL_READ_FRAMEBUFFER_EXT
));
776 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
777 GL_DRAW_FRAMEBUFFER_EXT
));
778 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
779 GL_READ_FRAMEBUFFER_BINDING_EXT
));
780 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
781 GL_MAX_SAMPLES_EXT
));
782 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
783 GL_RENDERBUFFER_SAMPLES_EXT
));
786 TEST_P(FeatureInfoTest
, InitializeANGLE_framebuffer_multisample
) {
787 SetupInitExpectationsWithGLVersion(
788 "GL_ANGLE_framebuffer_multisample", kGLRendererStringANGLE
, "");
789 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
790 EXPECT_THAT(info_
->extensions(),
791 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
792 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
793 GL_READ_FRAMEBUFFER_EXT
));
794 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
795 GL_DRAW_FRAMEBUFFER_EXT
));
796 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
797 GL_READ_FRAMEBUFFER_BINDING_EXT
));
798 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
799 GL_MAX_SAMPLES_EXT
));
800 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
801 GL_RENDERBUFFER_SAMPLES_EXT
));
804 // We don't allow ANGLE_framebuffer_multisample on non-ANGLE implementations,
805 // because we wouldn't be choosing the right driver entry point and because the
806 // extension was falsely advertised on some Android devices (crbug.com/165736).
807 TEST_P(FeatureInfoTest
, InitializeANGLE_framebuffer_multisampleWithoutANGLE
) {
808 SetupInitExpectations("GL_ANGLE_framebuffer_multisample");
809 EXPECT_FALSE(info_
->feature_flags().chromium_framebuffer_multisample
);
810 EXPECT_THAT(info_
->extensions(),
811 Not(HasSubstr("GL_CHROMIUM_framebuffer_multisample")));
812 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
813 GL_READ_FRAMEBUFFER_EXT
));
814 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
815 GL_DRAW_FRAMEBUFFER_EXT
));
816 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
817 GL_READ_FRAMEBUFFER_BINDING_EXT
));
818 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
819 GL_MAX_SAMPLES_EXT
));
820 EXPECT_FALSE(info_
->validators()->render_buffer_parameter
.IsValid(
821 GL_RENDERBUFFER_SAMPLES_EXT
));
824 TEST_P(FeatureInfoTest
, InitializeEXT_multisampled_render_to_texture
) {
825 SetupInitExpectations("GL_EXT_multisampled_render_to_texture");
826 EXPECT_TRUE(info_
->feature_flags(
827 ).multisampled_render_to_texture
);
828 EXPECT_FALSE(info_
->feature_flags(
829 ).use_img_for_multisampled_render_to_texture
);
830 EXPECT_THAT(info_
->extensions(),
831 HasSubstr("GL_EXT_multisampled_render_to_texture"));
832 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
833 GL_MAX_SAMPLES_EXT
));
834 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
835 GL_RENDERBUFFER_SAMPLES_EXT
));
836 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
837 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT
));
840 TEST_P(FeatureInfoTest
, InitializeIMG_multisampled_render_to_texture
) {
841 SetupInitExpectations("GL_IMG_multisampled_render_to_texture");
842 EXPECT_TRUE(info_
->feature_flags(
843 ).multisampled_render_to_texture
);
844 EXPECT_TRUE(info_
->feature_flags(
845 ).use_img_for_multisampled_render_to_texture
);
846 EXPECT_THAT(info_
->extensions(),
847 HasSubstr("GL_EXT_multisampled_render_to_texture"));
848 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
849 GL_MAX_SAMPLES_EXT
));
850 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
851 GL_RENDERBUFFER_SAMPLES_EXT
));
852 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
853 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT
));
856 TEST_P(FeatureInfoTest
, InitializeEXT_texture_filter_anisotropic
) {
857 SetupInitExpectations("GL_EXT_texture_filter_anisotropic");
858 EXPECT_THAT(info_
->extensions(),
859 HasSubstr("GL_EXT_texture_filter_anisotropic"));
860 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
861 GL_TEXTURE_MAX_ANISOTROPY_EXT
));
862 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
863 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
));
866 TEST_P(FeatureInfoTest
, InitializeEXT_ARB_depth_texture
) {
867 SetupInitExpectations("GL_ARB_depth_texture");
868 EXPECT_THAT(info_
->extensions(),
869 HasSubstr("GL_GOOGLE_depth_texture"));
870 EXPECT_THAT(info_
->extensions(),
871 HasSubstr("GL_CHROMIUM_depth_texture"));
872 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
873 GL_DEPTH_COMPONENT
));
874 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
875 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
876 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
877 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
880 TEST_P(FeatureInfoTest
, InitializeOES_ARB_depth_texture
) {
881 SetupInitExpectations("GL_OES_depth_texture");
882 EXPECT_THAT(info_
->extensions(),
883 HasSubstr("GL_GOOGLE_depth_texture"));
884 EXPECT_THAT(info_
->extensions(),
885 HasSubstr("GL_CHROMIUM_depth_texture"));
886 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
887 GL_DEPTH_COMPONENT
));
888 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
889 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
890 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
891 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
894 TEST_P(FeatureInfoTest
, InitializeANGLE_depth_texture
) {
895 SetupInitExpectations("GL_ANGLE_depth_texture");
896 EXPECT_THAT(info_
->extensions(),
897 HasSubstr("GL_GOOGLE_depth_texture"));
898 EXPECT_THAT(info_
->extensions(),
899 HasSubstr("GL_CHROMIUM_depth_texture"));
900 EXPECT_THAT(info_
->extensions(),
901 Not(HasSubstr("GL_ANGLE_depth_texture")));
902 EXPECT_TRUE(info_
->feature_flags().angle_depth_texture
);
903 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
904 GL_DEPTH_COMPONENT
));
905 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
906 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
907 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
908 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
909 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
910 GL_DEPTH_COMPONENT16
));
911 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
912 GL_DEPTH_COMPONENT32_OES
));
913 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
914 GL_DEPTH24_STENCIL8_OES
));
917 TEST_P(FeatureInfoTest
, InitializeEXT_packed_depth_stencil
) {
918 SetupInitExpectations("GL_EXT_packed_depth_stencil");
919 EXPECT_THAT(info_
->extensions(),
920 HasSubstr("GL_OES_packed_depth_stencil"));
921 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
922 GL_DEPTH24_STENCIL8
));
923 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
924 GL_DEPTH_COMPONENT
));
925 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
926 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
927 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
930 TEST_P(FeatureInfoTest
, InitializeOES_packed_depth_stencil
) {
931 SetupInitExpectations("GL_OES_packed_depth_stencil");
932 EXPECT_THAT(info_
->extensions(),
933 HasSubstr("GL_OES_packed_depth_stencil"));
934 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
935 GL_DEPTH24_STENCIL8
));
936 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
937 GL_DEPTH_COMPONENT
));
938 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
939 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
940 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
943 TEST_P(FeatureInfoTest
,
944 InitializeOES_packed_depth_stencil_and_GL_ARB_depth_texture
) {
945 SetupInitExpectations("GL_OES_packed_depth_stencil GL_ARB_depth_texture");
946 EXPECT_THAT(info_
->extensions(),
947 HasSubstr("GL_OES_packed_depth_stencil"));
948 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
949 GL_DEPTH24_STENCIL8
));
950 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
952 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
954 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(
955 GL_UNSIGNED_INT_24_8
));
958 TEST_P(FeatureInfoTest
, InitializeOES_depth24
) {
959 SetupInitExpectations("GL_OES_depth24");
960 EXPECT_TRUE(info_
->feature_flags().oes_depth24
);
961 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_depth24"));
962 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
963 GL_DEPTH_COMPONENT24
));
966 TEST_P(FeatureInfoTest
, InitializeOES_standard_derivatives
) {
967 SetupInitExpectations("GL_OES_standard_derivatives");
968 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_standard_derivatives"));
969 EXPECT_TRUE(info_
->feature_flags().oes_standard_derivatives
);
970 EXPECT_TRUE(info_
->validators()->hint_target
.IsValid(
971 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
));
972 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
973 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
));
976 TEST_P(FeatureInfoTest
, InitializeOES_rgb8_rgba8
) {
977 SetupInitExpectations("GL_OES_rgb8_rgba8");
978 EXPECT_THAT(info_
->extensions(),
979 HasSubstr("GL_OES_rgb8_rgba8"));
980 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
982 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
986 TEST_P(FeatureInfoTest
, InitializeOES_EGL_image_external
) {
987 SetupInitExpectations("GL_OES_EGL_image_external");
988 EXPECT_THAT(info_
->extensions(),
989 HasSubstr("GL_OES_EGL_image_external"));
990 EXPECT_TRUE(info_
->feature_flags().oes_egl_image_external
);
991 EXPECT_TRUE(info_
->validators()->texture_bind_target
.IsValid(
992 GL_TEXTURE_EXTERNAL_OES
));
993 EXPECT_TRUE(info_
->validators()->get_tex_param_target
.IsValid(
994 GL_TEXTURE_EXTERNAL_OES
));
995 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
996 GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES
));
997 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
998 GL_TEXTURE_BINDING_EXTERNAL_OES
));
1001 TEST_P(FeatureInfoTest
, InitializeOES_compressed_ETC1_RGB8_texture
) {
1002 SetupInitExpectations("GL_OES_compressed_ETC1_RGB8_texture");
1003 EXPECT_THAT(info_
->extensions(),
1004 HasSubstr("GL_OES_compressed_ETC1_RGB8_texture"));
1005 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1007 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
1011 TEST_P(FeatureInfoTest
, InitializeAMD_compressed_ATC_texture
) {
1012 SetupInitExpectations("GL_AMD_compressed_ATC_texture");
1013 EXPECT_THAT(info_
->extensions(),
1014 HasSubstr("GL_AMD_compressed_ATC_texture"));
1015 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1017 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1018 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
));
1019 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1020 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
));
1023 TEST_P(FeatureInfoTest
, InitializeIMG_texture_compression_pvrtc
) {
1024 SetupInitExpectations("GL_IMG_texture_compression_pvrtc");
1025 EXPECT_THAT(info_
->extensions(),
1026 HasSubstr("GL_IMG_texture_compression_pvrtc"));
1027 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1028 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
));
1029 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1030 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
));
1031 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1032 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
));
1033 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1034 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
));
1037 TEST_P(FeatureInfoTest
, InitializeEXT_occlusion_query_boolean
) {
1038 SetupInitExpectations("GL_EXT_occlusion_query_boolean");
1039 EXPECT_THAT(info_
->extensions(),
1040 HasSubstr("GL_EXT_occlusion_query_boolean"));
1041 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
1042 EXPECT_FALSE(info_
->feature_flags(
1043 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
1044 EXPECT_FALSE(info_
->feature_flags(
1045 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
1048 TEST_P(FeatureInfoTest
, InitializeARB_occlusion_query
) {
1049 SetupInitExpectations("GL_ARB_occlusion_query");
1050 EXPECT_THAT(info_
->extensions(),
1051 HasSubstr("GL_EXT_occlusion_query_boolean"));
1052 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
1053 EXPECT_FALSE(info_
->feature_flags(
1054 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
1055 EXPECT_TRUE(info_
->feature_flags(
1056 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
1059 TEST_P(FeatureInfoTest
, InitializeARB_occlusion_query2
) {
1060 SetupInitExpectations("GL_ARB_occlusion_query2 GL_ARB_occlusion_query2");
1061 EXPECT_THAT(info_
->extensions(),
1062 HasSubstr("GL_EXT_occlusion_query_boolean"));
1063 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
1064 EXPECT_TRUE(info_
->feature_flags(
1065 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
1066 EXPECT_FALSE(info_
->feature_flags(
1067 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
1070 TEST_P(FeatureInfoTest
, InitializeOES_vertex_array_object
) {
1071 SetupInitExpectations("GL_OES_vertex_array_object");
1072 EXPECT_THAT(info_
->extensions(),
1073 HasSubstr("GL_OES_vertex_array_object"));
1074 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1077 TEST_P(FeatureInfoTest
, InitializeARB_vertex_array_object
) {
1078 SetupInitExpectations("GL_ARB_vertex_array_object");
1079 EXPECT_THAT(info_
->extensions(),
1080 HasSubstr("GL_OES_vertex_array_object"));
1081 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1084 TEST_P(FeatureInfoTest
, InitializeAPPLE_vertex_array_object
) {
1085 SetupInitExpectations("GL_APPLE_vertex_array_object");
1086 EXPECT_THAT(info_
->extensions(),
1087 HasSubstr("GL_OES_vertex_array_object"));
1088 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1091 TEST_P(FeatureInfoTest
, InitializeNo_vertex_array_object
) {
1092 SetupInitExpectations("");
1093 // Even if the native extensions are not available the implementation
1094 // may still emulate the GL_OES_vertex_array_object functionality. In this
1095 // scenario native_vertex_array_object must be false.
1096 EXPECT_THAT(info_
->extensions(),
1097 HasSubstr("GL_OES_vertex_array_object"));
1098 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
1101 TEST_P(FeatureInfoTest
, InitializeOES_element_index_uint
) {
1102 SetupInitExpectations("GL_OES_element_index_uint");
1103 EXPECT_THAT(info_
->extensions(),
1104 HasSubstr("GL_OES_element_index_uint"));
1105 EXPECT_TRUE(info_
->validators()->index_type
.IsValid(GL_UNSIGNED_INT
));
1108 TEST_P(FeatureInfoTest
, InitializeVAOsWithClientSideArrays
) {
1109 base::CommandLine
command_line(0, NULL
);
1110 command_line
.AppendSwitchASCII(
1111 switches::kGpuDriverBugWorkarounds
,
1112 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS
));
1113 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object",
1115 EXPECT_TRUE(info_
->workarounds().use_client_side_arrays_for_stream_buffers
);
1116 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
1119 TEST_P(FeatureInfoTest
, InitializeEXT_blend_minmax
) {
1120 SetupInitExpectations("GL_EXT_blend_minmax");
1121 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_blend_minmax"));
1122 EXPECT_TRUE(info_
->validators()->equation
.IsValid(GL_MIN_EXT
));
1123 EXPECT_TRUE(info_
->validators()->equation
.IsValid(GL_MAX_EXT
));
1126 TEST_P(FeatureInfoTest
, InitializeEXT_frag_depth
) {
1127 SetupInitExpectations("GL_EXT_frag_depth");
1128 EXPECT_TRUE(info_
->feature_flags().ext_frag_depth
);
1129 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_frag_depth"));
1132 TEST_P(FeatureInfoTest
, InitializeEXT_shader_texture_lod
) {
1133 SetupInitExpectations("GL_EXT_shader_texture_lod");
1134 EXPECT_TRUE(info_
->feature_flags().ext_shader_texture_lod
);
1135 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_shader_texture_lod"));
1138 TEST_P(FeatureInfoTest
, InitializeEXT_discard_framebuffer
) {
1139 SetupInitExpectations("GL_EXT_discard_framebuffer");
1140 EXPECT_TRUE(info_
->feature_flags().ext_discard_framebuffer
);
1141 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1144 TEST_P(FeatureInfoTest
, InitializeSamplersWithARBSamplerObjects
) {
1145 SetupInitExpectationsWithGLVersion(
1146 "GL_ARB_sampler_objects", "", "OpenGL 3.0");
1147 EXPECT_TRUE(info_
->feature_flags().enable_samplers
);
1150 TEST_P(FeatureInfoTest
, InitializeWithES3
) {
1151 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
1152 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
1153 EXPECT_TRUE(info_
->feature_flags().use_core_framebuffer_multisample
);
1154 EXPECT_THAT(info_
->extensions(),
1155 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
1156 EXPECT_TRUE(info_
->feature_flags().use_async_readpixels
);
1157 EXPECT_TRUE(info_
->feature_flags().oes_standard_derivatives
);
1158 EXPECT_TRUE(info_
->feature_flags().oes_depth24
);
1159 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
1160 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
1162 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_COMPONENT
));
1164 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_STENCIL
));
1165 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
1166 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
1167 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
1168 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
1169 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT_24_8
));
1170 EXPECT_TRUE(info_
->feature_flags().packed_depth24_stencil8
);
1171 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_depth24"));
1173 info_
->validators()->render_buffer_format
.IsValid(GL_DEPTH_COMPONENT24
));
1175 info_
->validators()->render_buffer_format
.IsValid(GL_DEPTH24_STENCIL8
));
1177 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_STENCIL
));
1178 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
1179 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
1180 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1181 EXPECT_TRUE(info_
->feature_flags().enable_samplers
);
1182 EXPECT_TRUE(info_
->feature_flags().map_buffer_range
);
1183 EXPECT_TRUE(info_
->feature_flags().ext_discard_framebuffer
);
1184 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1185 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1186 EXPECT_TRUE(gfx::GLFence::IsSupported());
1189 TEST_P(FeatureInfoTest
, InitializeWithoutSamplers
) {
1190 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0");
1191 EXPECT_FALSE(info_
->feature_flags().enable_samplers
);
1194 TEST_P(FeatureInfoTest
, ParseDriverBugWorkaroundsSingle
) {
1195 base::CommandLine
command_line(0, NULL
);
1196 command_line
.AppendSwitchASCII(
1197 switches::kGpuDriverBugWorkarounds
,
1198 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST
));
1199 // Workarounds should get parsed without the need for a context.
1200 SetupWithCommandLine(command_line
);
1201 EXPECT_TRUE(info_
->workarounds().exit_on_context_lost
);
1204 TEST_P(FeatureInfoTest
, ParseDriverBugWorkaroundsMultiple
) {
1205 base::CommandLine
command_line(0, NULL
);
1206 command_line
.AppendSwitchASCII(
1207 switches::kGpuDriverBugWorkarounds
,
1208 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST
) + "," +
1209 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024
) + "," +
1210 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096
));
1211 // Workarounds should get parsed without the need for a context.
1212 SetupWithCommandLine(command_line
);
1213 EXPECT_TRUE(info_
->workarounds().exit_on_context_lost
);
1214 EXPECT_EQ(1024, info_
->workarounds().max_cube_map_texture_size
);
1215 EXPECT_EQ(4096, info_
->workarounds().max_texture_size
);
1218 TEST_P(FeatureInfoTest
, InitializeWithARBSync
) {
1219 SetupInitExpectations("GL_ARB_sync");
1220 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1221 EXPECT_TRUE(gfx::GLFence::IsSupported());
1224 TEST_P(FeatureInfoTest
, InitializeWithNVFence
) {
1225 SetupInitExpectations("GL_NV_fence");
1226 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1227 EXPECT_TRUE(gfx::GLFence::IsSupported());
1230 TEST_P(FeatureInfoTest
, InitializeWithNVDrawBuffers
) {
1231 SetupInitExpectationsWithGLVersion("GL_NV_draw_buffers", "", "OpenGL ES 3.0");
1232 EXPECT_TRUE(info_
->feature_flags().nv_draw_buffers
);
1233 EXPECT_TRUE(info_
->feature_flags().ext_draw_buffers
);
1236 TEST_P(FeatureInfoTest
, InitializeWithPreferredEXTDrawBuffers
) {
1237 SetupInitExpectationsWithGLVersion(
1238 "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0");
1239 EXPECT_FALSE(info_
->feature_flags().nv_draw_buffers
);
1240 EXPECT_TRUE(info_
->feature_flags().ext_draw_buffers
);
1243 TEST_P(FeatureInfoTest
, BlendEquationAdvancedDisabled
) {
1244 base::CommandLine
command_line(0, NULL
);
1245 command_line
.AppendSwitchASCII(
1246 switches::kGpuDriverBugWorkarounds
,
1247 base::IntToString(gpu::DISABLE_BLEND_EQUATION_ADVANCED
));
1248 SetupInitExpectationsWithCommandLine(
1249 "GL_KHR_blend_equation_advanced_coherent GL_KHR_blend_equation_advanced",
1251 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced
);
1252 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced_coherent
);
1255 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering_no_cmdline_switch
) {
1256 SetupInitExpectationsWithGLVersion(
1257 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1259 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1260 EXPECT_THAT(info_
->extensions(),
1261 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1264 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering
) {
1265 base::CommandLine
command_line(0, NULL
);
1266 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1267 SetupInitExpectationsWithGLVersionAndCommandLine(
1268 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1269 "", "4.3", command_line
);
1270 EXPECT_TRUE(info_
->feature_flags().chromium_path_rendering
);
1271 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1274 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering2
) {
1275 base::CommandLine
command_line(0, NULL
);
1276 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1277 SetupInitExpectationsWithGLVersionAndCommandLine(
1278 "GL_NV_path_rendering", "", "OpenGL ES 3.1", command_line
);
1279 EXPECT_TRUE(info_
->feature_flags().chromium_path_rendering
);
1280 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1283 TEST_P(FeatureInfoTest
, InitializeNoCHROMIUM_path_rendering
) {
1284 base::CommandLine
command_line(0, NULL
);
1285 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1286 SetupInitExpectationsWithGLVersionAndCommandLine("GL_ARB_compatibility", "",
1287 "4.3", command_line
);
1288 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1289 EXPECT_THAT(info_
->extensions(),
1290 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1293 TEST_P(FeatureInfoTest
, InitializeNoCHROMIUM_path_rendering2
) {
1294 base::CommandLine
command_line(0, NULL
);
1295 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1296 SetupInitExpectationsWithGLVersionAndCommandLine(
1297 "GL_ARB_compatibility GL_NV_path_rendering", "", "4.3", command_line
);
1298 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1299 EXPECT_THAT(info_
->extensions(),
1300 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1303 TEST_P(FeatureInfoTest
, InitializeNoKHR_blend_equation_advanced
) {
1304 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility", "", "4.3");
1305 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced
);
1306 EXPECT_THAT(info_
->extensions(),
1307 Not(HasSubstr("GL_KHR_blend_equation_advanced")));
1310 TEST_P(FeatureInfoTest
, InitializeKHR_blend_equations_advanced
) {
1311 SetupInitExpectations("GL_KHR_blend_equation_advanced");
1312 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1313 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1316 TEST_P(FeatureInfoTest
, InitializeNV_blend_equations_advanced
) {
1317 SetupInitExpectations("GL_NV_blend_equation_advanced");
1318 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1319 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1322 TEST_P(FeatureInfoTest
, InitializeNoKHR_blend_equation_advanced_coherent
) {
1323 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility ", "", "4.3");
1324 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced_coherent
);
1325 EXPECT_THAT(info_
->extensions(),
1326 Not(HasSubstr("GL_KHR_blend_equation_advanced_coherent")));
1329 TEST_P(FeatureInfoTest
, InitializeKHR_blend_equations_advanced_coherent
) {
1330 SetupInitExpectations("GL_KHR_blend_equation_advanced_coherent");
1331 EXPECT_THAT(info_
->extensions(),
1332 HasSubstr("GL_KHR_blend_equation_advanced_coherent"));
1333 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1334 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced_coherent
);
1337 TEST_P(FeatureInfoTest
, InitializeEXT_texture_rgWithFloat
) {
1338 SetupInitExpectations(
1339 "GL_EXT_texture_rg GL_OES_texture_float GL_OES_texture_half_float");
1340 EXPECT_TRUE(info_
->feature_flags().ext_texture_rg
);
1342 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RED_EXT
));
1343 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RG_EXT
));
1344 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RED_EXT
));
1345 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RG_EXT
));
1346 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RED_EXT
));
1347 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RG_EXT
));
1348 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_R8_EXT
));
1349 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_RG8_EXT
));
1352 TEST_P(FeatureInfoTest
, InitializeARB_texture_rgNoFloat
) {
1353 SetupInitExpectations("GL_ARB_texture_rg");
1354 EXPECT_TRUE(info_
->feature_flags().ext_texture_rg
);
1356 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RED_EXT
));
1357 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RG_EXT
));
1358 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RED_EXT
));
1359 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RG_EXT
));
1360 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RED_EXT
));
1361 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RG_EXT
));
1362 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_R8_EXT
));
1363 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_RG8_EXT
));
1366 } // namespace gles2