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"
22 using ::testing::DoAll
;
23 using ::testing::HasSubstr
;
24 using ::testing::InSequence
;
25 using ::testing::MatcherCast
;
27 using ::testing::Pointee
;
28 using ::testing::Return
;
29 using ::testing::SetArrayArgument
;
30 using ::testing::SetArgumentPointee
;
31 using ::testing::StrEq
;
37 const char kGLRendererStringANGLE
[] = "ANGLE (some renderer)";
38 } // anonymous namespace
40 enum MockedGLVersionKind
{
42 Version3_2Compatibility
46 : public GpuServiceTest
,
47 public ::testing::WithParamInterface
<MockedGLVersionKind
> {
52 void SetupInitExpectations(const char* extensions
) {
53 std::string extensions_str
= extensions
;
54 // Most of the tests' expectations currently assume the desktop
55 // OpenGL compatibility profile.
58 SetupInitExpectationsWithGLVersion(extensions_str
.c_str(), "", "3.0");
60 case Version3_2Compatibility
:
61 if (extensions_str
.find("GL_ARB_compatibility") == std::string::npos
) {
62 extensions_str
+= " GL_ARB_compatibility";
64 SetupInitExpectationsWithGLVersion(extensions_str
.c_str(), "", "3.2");
72 void SetupInitExpectationsWithGLVersion(
73 const char* extensions
, const char* renderer
, const char* version
) {
74 GpuServiceTest::SetUpWithGLVersion(version
, extensions
);
75 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
76 gl_
.get(), extensions
, renderer
, version
);
77 info_
= new FeatureInfo();
81 void SetupInitExpectationsWithGLVersionAndCommandLine(
82 const char* extensions
,
85 const base::CommandLine
& command_line
) {
86 GpuServiceTest::SetUpWithGLVersion(version
, extensions
);
87 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
88 gl_
.get(), extensions
, renderer
, version
);
89 info_
= new FeatureInfo(command_line
);
93 void SetupWithCommandLine(const base::CommandLine
& command_line
) {
94 GpuServiceTest::SetUp();
95 info_
= new FeatureInfo(command_line
);
98 void SetupInitExpectationsWithCommandLine(
99 const char* extensions
,
100 const base::CommandLine
& command_line
) {
101 GpuServiceTest::SetUpWithGLVersion("2.0", extensions
);
102 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
103 gl_
.get(), extensions
, "", "");
104 info_
= new FeatureInfo(command_line
);
108 void SetupWithoutInit() {
109 GpuServiceTest::SetUp();
110 info_
= new FeatureInfo();
114 void SetUp() override
{
115 // Do nothing here, since we are using the explicit Setup*() functions.
118 void TearDown() override
{
120 GpuServiceTest::TearDown();
123 scoped_refptr
<FeatureInfo
> info_
;
134 } // anonymous namespace.
136 static const MockedGLVersionKind kGLVersionKinds
[] = {
138 Version3_2Compatibility
141 INSTANTIATE_TEST_CASE_P(Service
,
143 ::testing::ValuesIn(kGLVersionKinds
));
145 TEST_P(FeatureInfoTest
, Basic
) {
147 // Test it starts off uninitialized.
148 EXPECT_FALSE(info_
->feature_flags().chromium_framebuffer_multisample
);
149 EXPECT_FALSE(info_
->feature_flags().use_core_framebuffer_multisample
);
150 EXPECT_FALSE(info_
->feature_flags().multisampled_render_to_texture
);
151 EXPECT_FALSE(info_
->feature_flags(
152 ).use_img_for_multisampled_render_to_texture
);
153 EXPECT_FALSE(info_
->feature_flags().oes_standard_derivatives
);
154 EXPECT_FALSE(info_
->feature_flags().npot_ok
);
155 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
156 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
157 EXPECT_FALSE(info_
->feature_flags().oes_egl_image_external
);
158 EXPECT_FALSE(info_
->feature_flags().oes_depth24
);
159 EXPECT_FALSE(info_
->feature_flags().packed_depth24_stencil8
);
160 EXPECT_FALSE(info_
->feature_flags().angle_translated_shader_source
);
161 EXPECT_FALSE(info_
->feature_flags().angle_pack_reverse_row_order
);
162 EXPECT_FALSE(info_
->feature_flags().arb_texture_rectangle
);
163 EXPECT_FALSE(info_
->feature_flags().angle_instanced_arrays
);
164 EXPECT_FALSE(info_
->feature_flags().occlusion_query_boolean
);
165 EXPECT_FALSE(info_
->feature_flags(
166 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
167 EXPECT_FALSE(info_
->feature_flags(
168 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
169 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
170 EXPECT_FALSE(info_
->feature_flags().map_buffer_range
);
171 EXPECT_FALSE(info_
->feature_flags().use_async_readpixels
);
172 EXPECT_FALSE(info_
->feature_flags().ext_draw_buffers
);
173 EXPECT_FALSE(info_
->feature_flags().nv_draw_buffers
);
174 EXPECT_FALSE(info_
->feature_flags().ext_discard_framebuffer
);
175 EXPECT_FALSE(info_
->feature_flags().angle_depth_texture
);
177 #define GPU_OP(type, name) EXPECT_FALSE(info_->workarounds().name);
178 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP
)
180 EXPECT_EQ(0, info_
->workarounds().max_texture_size
);
181 EXPECT_EQ(0, info_
->workarounds().max_cube_map_texture_size
);
182 EXPECT_FALSE(info_
->workarounds().gl_clear_broken
);
185 TEST_P(FeatureInfoTest
, InitializeNoExtensions
) {
186 SetupInitExpectations("");
187 // Check default extensions are there
188 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_resource_safe"));
189 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs"));
190 EXPECT_THAT(info_
->extensions(),
191 HasSubstr("GL_ANGLE_translated_shader_source"));
192 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_trace_marker"));
194 // Check a couple of random extensions that should not be there.
195 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_npot")));
196 EXPECT_THAT(info_
->extensions(),
197 Not(HasSubstr("GL_EXT_texture_compression_dxt1")));
198 EXPECT_THAT(info_
->extensions(),
199 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3")));
200 EXPECT_THAT(info_
->extensions(),
201 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5")));
202 EXPECT_THAT(info_
->extensions(),
203 Not(HasSubstr("GL_ANGLE_texture_usage")));
204 EXPECT_THAT(info_
->extensions(),
205 Not(HasSubstr("GL_EXT_texture_storage")));
206 EXPECT_THAT(info_
->extensions(),
207 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")));
208 EXPECT_THAT(info_
->extensions(),
209 Not(HasSubstr("GL_AMD_compressed_ATC_texture")));
210 EXPECT_THAT(info_
->extensions(),
211 Not(HasSubstr("GL_IMG_texture_compression_pvrtc")));
212 EXPECT_THAT(info_
->extensions(),
213 Not(HasSubstr("GL_EXT_sRGB")));
214 EXPECT_FALSE(info_
->feature_flags().npot_ok
);
215 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
216 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
217 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
218 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
219 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
220 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
221 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
222 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
223 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
225 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
227 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
228 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
));
229 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
230 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
));
231 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
232 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
));
233 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
234 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
));
235 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
236 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
));
237 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
238 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
));
239 EXPECT_FALSE(info_
->validators()->read_pixel_format
.IsValid(
241 EXPECT_FALSE(info_
->validators()->texture_parameter
.IsValid(
242 GL_TEXTURE_MAX_ANISOTROPY_EXT
));
243 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
244 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
));
245 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
246 GL_READ_FRAMEBUFFER_EXT
));
247 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
248 GL_DRAW_FRAMEBUFFER_EXT
));
249 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
250 GL_READ_FRAMEBUFFER_BINDING_EXT
));
251 EXPECT_FALSE(info_
->validators()->render_buffer_parameter
.IsValid(
252 GL_MAX_SAMPLES_EXT
));
253 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
254 GL_DEPTH_COMPONENT
));
255 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
256 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
257 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
258 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
259 GL_DEPTH24_STENCIL8
));
260 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
262 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
264 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
266 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
268 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(
269 GL_UNSIGNED_INT_24_8
));
270 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
271 GL_DEPTH_COMPONENT24
));
272 EXPECT_FALSE(info_
->validators()->texture_parameter
.IsValid(
273 GL_TEXTURE_USAGE_ANGLE
));
274 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
275 GL_DEPTH_COMPONENT16
));
276 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
277 GL_DEPTH_COMPONENT32_OES
));
278 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
279 GL_DEPTH24_STENCIL8_OES
));
280 EXPECT_FALSE(info_
->validators()->equation
.IsValid(GL_MIN_EXT
));
281 EXPECT_FALSE(info_
->validators()->equation
.IsValid(GL_MAX_EXT
));
282 EXPECT_FALSE(info_
->feature_flags().chromium_sync_query
);
283 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
285 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
287 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
289 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
291 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
292 GL_SRGB8_ALPHA8_EXT
));
293 EXPECT_FALSE(info_
->validators()->frame_buffer_parameter
.IsValid(
294 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
297 TEST_P(FeatureInfoTest
, InitializeWithANGLE
) {
298 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE
, "");
299 EXPECT_TRUE(info_
->gl_version_info().is_angle
);
302 TEST_P(FeatureInfoTest
, InitializeNPOTExtensionGLES
) {
303 SetupInitExpectations("GL_OES_texture_npot");
304 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_npot"));
305 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
308 TEST_P(FeatureInfoTest
, InitializeNPOTExtensionGL
) {
309 SetupInitExpectations("GL_ARB_texture_non_power_of_two");
310 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_npot"));
311 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
314 TEST_P(FeatureInfoTest
, InitializeDXTExtensionGLES2
) {
315 SetupInitExpectations("GL_EXT_texture_compression_dxt1");
316 EXPECT_THAT(info_
->extensions(),
317 HasSubstr("GL_EXT_texture_compression_dxt1"));
318 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
319 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
320 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
321 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
322 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
323 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
324 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
325 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
328 TEST_P(FeatureInfoTest
, InitializeDXTExtensionGL
) {
329 SetupInitExpectations("GL_EXT_texture_compression_s3tc");
330 EXPECT_THAT(info_
->extensions(),
331 HasSubstr("GL_EXT_texture_compression_dxt1"));
332 EXPECT_THAT(info_
->extensions(),
333 HasSubstr("GL_CHROMIUM_texture_compression_dxt3"));
334 EXPECT_THAT(info_
->extensions(),
335 HasSubstr("GL_CHROMIUM_texture_compression_dxt5"));
336 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
337 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
338 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
339 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
340 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
341 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
342 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
343 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
346 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888GLES2
) {
347 SetupInitExpectations("GL_EXT_texture_format_BGRA8888");
348 EXPECT_THAT(info_
->extensions(),
349 HasSubstr("GL_EXT_texture_format_BGRA8888"));
350 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
352 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
354 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
356 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
359 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888GL
) {
360 SetupInitExpectations("GL_EXT_bgra");
361 EXPECT_THAT(info_
->extensions(),
362 HasSubstr("GL_EXT_texture_format_BGRA8888"));
363 EXPECT_THAT(info_
->extensions(),
364 HasSubstr("GL_EXT_read_format_bgra"));
365 EXPECT_THAT(info_
->extensions(),
366 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
367 EXPECT_TRUE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
368 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
370 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
372 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
374 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
378 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888Apple
) {
379 SetupInitExpectations("GL_APPLE_texture_format_BGRA8888");
380 EXPECT_THAT(info_
->extensions(),
381 HasSubstr("GL_EXT_texture_format_BGRA8888"));
382 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
384 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
386 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
388 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
391 TEST_P(FeatureInfoTest
, InitializeGLES2EXT_read_format_bgra
) {
392 SetupInitExpectationsWithGLVersion(
393 "GL_EXT_read_format_bgra", "", "OpenGL ES 2.0");
394 EXPECT_THAT(info_
->extensions(),
395 HasSubstr("GL_EXT_read_format_bgra"));
396 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
398 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
400 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
402 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
404 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
407 TEST_P(FeatureInfoTest
, InitializeEXT_read_format_bgra
) {
408 SetupInitExpectations("GL_EXT_read_format_bgra");
409 EXPECT_THAT(info_
->extensions(),
410 HasSubstr("GL_EXT_read_format_bgra"));
411 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
413 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
415 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
417 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
419 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
422 TEST_P(FeatureInfoTest
, InitializeEXT_sRGB
) {
423 SetupInitExpectations("GL_EXT_sRGB GL_OES_rgb8_rgba8");
424 EXPECT_THAT(info_
->extensions(),
425 HasSubstr("GL_EXT_sRGB"));
426 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
428 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
430 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
432 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
434 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
435 GL_SRGB8_ALPHA8_EXT
));
436 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
437 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
440 TEST_P(FeatureInfoTest
, InitializeGLES2EXT_texture_storage
) {
441 SetupInitExpectationsWithGLVersion(
442 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
443 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
444 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
445 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
446 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
447 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
449 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
451 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
453 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
455 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
456 GL_LUMINANCE32F_EXT
));
457 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
458 GL_LUMINANCE_ALPHA32F_EXT
));
459 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
461 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
463 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
465 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
466 GL_LUMINANCE16F_EXT
));
467 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
468 GL_LUMINANCE_ALPHA16F_EXT
));
471 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage
) {
472 SetupInitExpectations("GL_EXT_texture_storage");
473 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
474 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
475 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
476 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
477 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
479 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
481 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
483 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
485 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
486 GL_LUMINANCE32F_EXT
));
487 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
488 GL_LUMINANCE_ALPHA32F_EXT
));
489 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
491 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
493 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
495 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
496 GL_LUMINANCE16F_EXT
));
497 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
498 GL_LUMINANCE_ALPHA16F_EXT
));
501 TEST_P(FeatureInfoTest
, InitializeARB_texture_storage
) {
502 SetupInitExpectations("GL_ARB_texture_storage");
503 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
504 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
505 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
506 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
509 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_BGRA
) {
510 SetupInitExpectations("GL_EXT_texture_storage GL_EXT_bgra");
511 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
512 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
513 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
515 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
518 TEST_P(FeatureInfoTest
, InitializeARB_texture_storage_BGRA
) {
519 SetupInitExpectations("GL_ARB_texture_storage GL_EXT_bgra");
520 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
521 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
522 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
524 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
527 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_BGRA8888
) {
528 SetupInitExpectations(
529 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888");
530 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
531 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
532 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
533 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
535 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
538 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_float
) {
539 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_float");
540 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
541 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
542 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
544 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
546 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
548 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
549 GL_LUMINANCE32F_EXT
));
550 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
551 GL_LUMINANCE_ALPHA32F_EXT
));
554 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_half_float
) {
555 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_half_float");
556 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
557 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
558 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
560 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
562 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
564 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
565 GL_LUMINANCE16F_EXT
));
566 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
567 GL_LUMINANCE_ALPHA16F_EXT
));
570 // Check how to handle ES, texture_storage and BGRA combination; 10 tests.
572 // 1- ES2 + GL_EXT_texture_storage -> GL_EXT_texture_storage (and no
573 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8 in
574 // glTexStorage2DEXT)
575 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_storage
) {
576 SetupInitExpectationsWithGLVersion(
577 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
578 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
579 EXPECT_THAT(info_
->extensions(),
580 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
583 // 2- ES2 + GL_EXT_texture_storage + (GL_EXT_texture_format_BGRA8888 or
584 // GL_APPLE_texture_format_bgra8888)
585 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_storage_BGRA
) {
586 SetupInitExpectationsWithGLVersion(
587 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
590 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
591 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
594 // 3- ES2 + GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_bgra8888
595 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_format_BGRA
) {
596 SetupInitExpectationsWithGLVersion(
597 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 2.0");
598 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
599 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
602 // 4- ES2 (neither GL_EXT_texture_storage nor GL_EXT_texture_format_BGRA8888) ->
604 TEST_P(FeatureInfoTest
, InitializeGLES2_neither_texture_storage_nor_BGRA
) {
605 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
606 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
607 EXPECT_THAT(info_
->extensions(),
608 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
611 // 5- ES3 + GL_EXT_texture_format_BGRA8888 -> GL_EXT_texture_format_BGRA8888
612 // (we can't expose GL_EXT_texture_storage because we fail the GL_BGRA8
614 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage_EXT_BGRA
) {
615 SetupInitExpectationsWithGLVersion(
616 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 3.0");
617 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
618 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
621 // 6- ES3 + GL_APPLE_texture_format_bgra8888 -> GL_EXT_texture_storage +
622 // GL_EXT_texture_format_BGRA8888 (driver promises to handle GL_BGRA8 by
623 // exposing GL_APPLE_texture_format_bgra8888)
624 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage_APPLE_BGRA
) {
625 SetupInitExpectationsWithGLVersion(
626 "GL_APPLE_texture_format_BGRA8888", "", "OpenGL ES 3.0");
627 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
628 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
631 // 7- ES3 + GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 ->
632 // GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 (driver promises to
633 // handle GL_BGRA8 by exposing GL_EXT_texture_storage)
634 TEST_P(FeatureInfoTest
, InitializeGLES3_EXT_texture_storage_EXT_BGRA
) {
635 SetupInitExpectationsWithGLVersion(
636 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
639 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
640 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
643 // 8- ES3 + none of the above -> GL_EXT_texture_storage (and no
644 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8)
645 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage
) {
646 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
647 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
648 EXPECT_THAT(info_
->extensions(),
649 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
652 // 9- ANGLE will add the GL_CHROMIUM_renderbuffer_format_BGRA8888 extension and
653 // the GL_BGRA8_EXT render buffer format.
654 TEST_P(FeatureInfoTest
, InitializeWithANGLE_BGRA8
) {
655 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE
, "");
656 EXPECT_TRUE(info_
->gl_version_info().is_angle
);
657 EXPECT_THAT(info_
->extensions(),
658 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
659 EXPECT_TRUE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
660 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_BGRA8_EXT
));
663 // 10- vanilla opengl es means no GL_CHROMIUM_renderbuffer_format_BGRA8888
664 TEST_P(FeatureInfoTest
,
665 InitializeGLES2_no_CHROMIUM_renderbuffer_format_BGRA8888
) {
666 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
667 EXPECT_FALSE(info_
->feature_flags().ext_render_buffer_format_bgra8888
);
668 EXPECT_THAT(info_
->extensions(),
669 Not(HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888")));
672 TEST_P(FeatureInfoTest
, InitializeARB_texture_float
) {
673 SetupInitExpectations("GL_ARB_texture_float");
674 EXPECT_TRUE(info_
->feature_flags().chromium_color_buffer_float_rgba
);
675 EXPECT_TRUE(info_
->feature_flags().chromium_color_buffer_float_rgb
);
676 std::string extensions
= info_
->extensions() + " ";
677 EXPECT_THAT(extensions
, HasSubstr("GL_CHROMIUM_color_buffer_float_rgb "));
678 EXPECT_THAT(extensions
, HasSubstr("GL_CHROMIUM_color_buffer_float_rgba"));
679 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
681 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
685 TEST_P(FeatureInfoTest
, Initialize_texture_floatGLES3
) {
686 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
687 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
688 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
689 EXPECT_THAT(info_
->extensions(),
690 Not(HasSubstr("GL_OES_texture_float_linear")));
691 EXPECT_THAT(info_
->extensions(),
692 Not(HasSubstr("GL_OES_texture_half_float_linear")));
695 TEST_P(FeatureInfoTest
, Initialize_sRGBGLES3
) {
696 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
697 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_sRGB")));
698 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
700 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
702 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
704 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
706 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
707 GL_SRGB8_ALPHA8_EXT
));
708 EXPECT_FALSE(info_
->validators()->frame_buffer_parameter
.IsValid(
709 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
712 TEST_P(FeatureInfoTest
, InitializeOES_texture_floatGLES2
) {
713 SetupInitExpectations("GL_OES_texture_float");
714 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
715 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
716 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
717 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
718 EXPECT_THAT(info_
->extensions(),
719 Not(HasSubstr("GL_OES_texture_float_linear")));
720 EXPECT_THAT(info_
->extensions(),
721 Not(HasSubstr("GL_OES_texture_half_float_linear")));
722 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
723 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
726 TEST_P(FeatureInfoTest
, InitializeOES_texture_float_linearGLES2
) {
727 SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear");
728 EXPECT_TRUE(info_
->feature_flags().enable_texture_float_linear
);
729 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
730 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
731 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
732 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float_linear"));
733 EXPECT_THAT(info_
->extensions(),
734 Not(HasSubstr("GL_OES_texture_half_float_linear")));
735 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
736 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
739 TEST_P(FeatureInfoTest
, InitializeOES_texture_half_floatGLES2
) {
740 SetupInitExpectations("GL_OES_texture_half_float");
741 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
742 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
743 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
744 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
745 EXPECT_THAT(info_
->extensions(),
746 Not(HasSubstr("GL_OES_texture_float_linear")));
747 EXPECT_THAT(info_
->extensions(),
748 Not(HasSubstr("GL_OES_texture_half_float_linear")));
749 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
750 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
753 TEST_P(FeatureInfoTest
, InitializeOES_texture_half_float_linearGLES2
) {
754 SetupInitExpectations(
755 "GL_OES_texture_half_float GL_OES_texture_half_float_linear");
756 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
757 EXPECT_TRUE(info_
->feature_flags().enable_texture_half_float_linear
);
758 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
759 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
760 EXPECT_THAT(info_
->extensions(),
761 Not(HasSubstr("GL_OES_texture_float_linear")));
762 EXPECT_THAT(info_
->extensions(),
763 HasSubstr("GL_OES_texture_half_float_linear"));
764 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
765 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
768 TEST_P(FeatureInfoTest
, InitializeEXT_framebuffer_multisample
) {
769 SetupInitExpectations("GL_EXT_framebuffer_multisample");
770 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
771 EXPECT_THAT(info_
->extensions(),
772 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
773 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
774 GL_READ_FRAMEBUFFER_EXT
));
775 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
776 GL_DRAW_FRAMEBUFFER_EXT
));
777 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
778 GL_READ_FRAMEBUFFER_BINDING_EXT
));
779 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
780 GL_MAX_SAMPLES_EXT
));
781 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
782 GL_RENDERBUFFER_SAMPLES_EXT
));
785 TEST_P(FeatureInfoTest
, InitializeANGLE_framebuffer_multisample
) {
786 SetupInitExpectationsWithGLVersion(
787 "GL_ANGLE_framebuffer_multisample", kGLRendererStringANGLE
, "");
788 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
789 EXPECT_THAT(info_
->extensions(),
790 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
791 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
792 GL_READ_FRAMEBUFFER_EXT
));
793 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
794 GL_DRAW_FRAMEBUFFER_EXT
));
795 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
796 GL_READ_FRAMEBUFFER_BINDING_EXT
));
797 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
798 GL_MAX_SAMPLES_EXT
));
799 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
800 GL_RENDERBUFFER_SAMPLES_EXT
));
803 // We don't allow ANGLE_framebuffer_multisample on non-ANGLE implementations,
804 // because we wouldn't be choosing the right driver entry point and because the
805 // extension was falsely advertised on some Android devices (crbug.com/165736).
806 TEST_P(FeatureInfoTest
, InitializeANGLE_framebuffer_multisampleWithoutANGLE
) {
807 SetupInitExpectations("GL_ANGLE_framebuffer_multisample");
808 EXPECT_FALSE(info_
->feature_flags().chromium_framebuffer_multisample
);
809 EXPECT_THAT(info_
->extensions(),
810 Not(HasSubstr("GL_CHROMIUM_framebuffer_multisample")));
811 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
812 GL_READ_FRAMEBUFFER_EXT
));
813 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
814 GL_DRAW_FRAMEBUFFER_EXT
));
815 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
816 GL_READ_FRAMEBUFFER_BINDING_EXT
));
817 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
818 GL_MAX_SAMPLES_EXT
));
819 EXPECT_FALSE(info_
->validators()->render_buffer_parameter
.IsValid(
820 GL_RENDERBUFFER_SAMPLES_EXT
));
823 TEST_P(FeatureInfoTest
, InitializeEXT_multisampled_render_to_texture
) {
824 SetupInitExpectations("GL_EXT_multisampled_render_to_texture");
825 EXPECT_TRUE(info_
->feature_flags(
826 ).multisampled_render_to_texture
);
827 EXPECT_FALSE(info_
->feature_flags(
828 ).use_img_for_multisampled_render_to_texture
);
829 EXPECT_THAT(info_
->extensions(),
830 HasSubstr("GL_EXT_multisampled_render_to_texture"));
831 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
832 GL_MAX_SAMPLES_EXT
));
833 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
834 GL_RENDERBUFFER_SAMPLES_EXT
));
835 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
836 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT
));
839 TEST_P(FeatureInfoTest
, InitializeIMG_multisampled_render_to_texture
) {
840 SetupInitExpectations("GL_IMG_multisampled_render_to_texture");
841 EXPECT_TRUE(info_
->feature_flags(
842 ).multisampled_render_to_texture
);
843 EXPECT_TRUE(info_
->feature_flags(
844 ).use_img_for_multisampled_render_to_texture
);
845 EXPECT_THAT(info_
->extensions(),
846 HasSubstr("GL_EXT_multisampled_render_to_texture"));
847 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
848 GL_MAX_SAMPLES_EXT
));
849 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
850 GL_RENDERBUFFER_SAMPLES_EXT
));
851 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
852 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT
));
855 TEST_P(FeatureInfoTest
, InitializeEXT_texture_filter_anisotropic
) {
856 SetupInitExpectations("GL_EXT_texture_filter_anisotropic");
857 EXPECT_THAT(info_
->extensions(),
858 HasSubstr("GL_EXT_texture_filter_anisotropic"));
859 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
860 GL_TEXTURE_MAX_ANISOTROPY_EXT
));
861 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
862 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
));
865 TEST_P(FeatureInfoTest
, InitializeEXT_ARB_depth_texture
) {
866 SetupInitExpectations("GL_ARB_depth_texture");
867 EXPECT_THAT(info_
->extensions(),
868 HasSubstr("GL_GOOGLE_depth_texture"));
869 EXPECT_THAT(info_
->extensions(),
870 HasSubstr("GL_CHROMIUM_depth_texture"));
871 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
872 GL_DEPTH_COMPONENT
));
873 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
874 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
875 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
876 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
879 TEST_P(FeatureInfoTest
, InitializeOES_ARB_depth_texture
) {
880 SetupInitExpectations("GL_OES_depth_texture");
881 EXPECT_THAT(info_
->extensions(),
882 HasSubstr("GL_GOOGLE_depth_texture"));
883 EXPECT_THAT(info_
->extensions(),
884 HasSubstr("GL_CHROMIUM_depth_texture"));
885 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
886 GL_DEPTH_COMPONENT
));
887 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
888 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
889 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
890 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
893 TEST_P(FeatureInfoTest
, InitializeANGLE_depth_texture
) {
894 SetupInitExpectations("GL_ANGLE_depth_texture");
895 EXPECT_THAT(info_
->extensions(),
896 HasSubstr("GL_GOOGLE_depth_texture"));
897 EXPECT_THAT(info_
->extensions(),
898 HasSubstr("GL_CHROMIUM_depth_texture"));
899 EXPECT_THAT(info_
->extensions(),
900 Not(HasSubstr("GL_ANGLE_depth_texture")));
901 EXPECT_TRUE(info_
->feature_flags().angle_depth_texture
);
902 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
903 GL_DEPTH_COMPONENT
));
904 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
905 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
906 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
907 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
908 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
909 GL_DEPTH_COMPONENT16
));
910 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
911 GL_DEPTH_COMPONENT32_OES
));
912 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
913 GL_DEPTH24_STENCIL8_OES
));
916 TEST_P(FeatureInfoTest
, InitializeEXT_packed_depth_stencil
) {
917 SetupInitExpectations("GL_EXT_packed_depth_stencil");
918 EXPECT_THAT(info_
->extensions(),
919 HasSubstr("GL_OES_packed_depth_stencil"));
920 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
921 GL_DEPTH24_STENCIL8
));
922 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
923 GL_DEPTH_COMPONENT
));
924 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
925 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
926 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
929 TEST_P(FeatureInfoTest
, InitializeOES_packed_depth_stencil
) {
930 SetupInitExpectations("GL_OES_packed_depth_stencil");
931 EXPECT_THAT(info_
->extensions(),
932 HasSubstr("GL_OES_packed_depth_stencil"));
933 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
934 GL_DEPTH24_STENCIL8
));
935 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
936 GL_DEPTH_COMPONENT
));
937 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
938 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
939 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
942 TEST_P(FeatureInfoTest
,
943 InitializeOES_packed_depth_stencil_and_GL_ARB_depth_texture
) {
944 SetupInitExpectations("GL_OES_packed_depth_stencil GL_ARB_depth_texture");
945 EXPECT_THAT(info_
->extensions(),
946 HasSubstr("GL_OES_packed_depth_stencil"));
947 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
948 GL_DEPTH24_STENCIL8
));
949 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
951 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
953 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(
954 GL_UNSIGNED_INT_24_8
));
957 TEST_P(FeatureInfoTest
, InitializeOES_depth24
) {
958 SetupInitExpectations("GL_OES_depth24");
959 EXPECT_TRUE(info_
->feature_flags().oes_depth24
);
960 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_depth24"));
961 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
962 GL_DEPTH_COMPONENT24
));
965 TEST_P(FeatureInfoTest
, InitializeOES_standard_derivatives
) {
966 SetupInitExpectations("GL_OES_standard_derivatives");
967 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_standard_derivatives"));
968 EXPECT_TRUE(info_
->feature_flags().oes_standard_derivatives
);
969 EXPECT_TRUE(info_
->validators()->hint_target
.IsValid(
970 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
));
971 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
972 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
));
975 TEST_P(FeatureInfoTest
, InitializeOES_rgb8_rgba8
) {
976 SetupInitExpectations("GL_OES_rgb8_rgba8");
977 EXPECT_THAT(info_
->extensions(),
978 HasSubstr("GL_OES_rgb8_rgba8"));
979 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
981 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
985 TEST_P(FeatureInfoTest
, InitializeOES_EGL_image_external
) {
986 SetupInitExpectations("GL_OES_EGL_image_external");
987 EXPECT_THAT(info_
->extensions(),
988 HasSubstr("GL_OES_EGL_image_external"));
989 EXPECT_TRUE(info_
->feature_flags().oes_egl_image_external
);
990 EXPECT_TRUE(info_
->validators()->texture_bind_target
.IsValid(
991 GL_TEXTURE_EXTERNAL_OES
));
992 EXPECT_TRUE(info_
->validators()->get_tex_param_target
.IsValid(
993 GL_TEXTURE_EXTERNAL_OES
));
994 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
995 GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES
));
996 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
997 GL_TEXTURE_BINDING_EXTERNAL_OES
));
1000 TEST_P(FeatureInfoTest
, InitializeOES_compressed_ETC1_RGB8_texture
) {
1001 SetupInitExpectations("GL_OES_compressed_ETC1_RGB8_texture");
1002 EXPECT_THAT(info_
->extensions(),
1003 HasSubstr("GL_OES_compressed_ETC1_RGB8_texture"));
1004 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1006 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
1010 TEST_P(FeatureInfoTest
, InitializeAMD_compressed_ATC_texture
) {
1011 SetupInitExpectations("GL_AMD_compressed_ATC_texture");
1012 EXPECT_THAT(info_
->extensions(),
1013 HasSubstr("GL_AMD_compressed_ATC_texture"));
1014 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1016 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1017 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
));
1018 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1019 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
));
1022 TEST_P(FeatureInfoTest
, InitializeIMG_texture_compression_pvrtc
) {
1023 SetupInitExpectations("GL_IMG_texture_compression_pvrtc");
1024 EXPECT_THAT(info_
->extensions(),
1025 HasSubstr("GL_IMG_texture_compression_pvrtc"));
1026 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1027 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
));
1028 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1029 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
));
1030 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1031 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
));
1032 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
1033 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
));
1036 TEST_P(FeatureInfoTest
, InitializeEXT_occlusion_query_boolean
) {
1037 SetupInitExpectations("GL_EXT_occlusion_query_boolean");
1038 EXPECT_THAT(info_
->extensions(),
1039 HasSubstr("GL_EXT_occlusion_query_boolean"));
1040 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
1041 EXPECT_FALSE(info_
->feature_flags(
1042 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
1043 EXPECT_FALSE(info_
->feature_flags(
1044 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
1047 TEST_P(FeatureInfoTest
, InitializeARB_occlusion_query
) {
1048 SetupInitExpectations("GL_ARB_occlusion_query");
1049 EXPECT_THAT(info_
->extensions(),
1050 HasSubstr("GL_EXT_occlusion_query_boolean"));
1051 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
1052 EXPECT_FALSE(info_
->feature_flags(
1053 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
1054 EXPECT_TRUE(info_
->feature_flags(
1055 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
1058 TEST_P(FeatureInfoTest
, InitializeARB_occlusion_query2
) {
1059 SetupInitExpectations("GL_ARB_occlusion_query2 GL_ARB_occlusion_query2");
1060 EXPECT_THAT(info_
->extensions(),
1061 HasSubstr("GL_EXT_occlusion_query_boolean"));
1062 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
1063 EXPECT_TRUE(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_P(FeatureInfoTest
, InitializeOES_vertex_array_object
) {
1070 SetupInitExpectations("GL_OES_vertex_array_object");
1071 EXPECT_THAT(info_
->extensions(),
1072 HasSubstr("GL_OES_vertex_array_object"));
1073 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1076 TEST_P(FeatureInfoTest
, InitializeARB_vertex_array_object
) {
1077 SetupInitExpectations("GL_ARB_vertex_array_object");
1078 EXPECT_THAT(info_
->extensions(),
1079 HasSubstr("GL_OES_vertex_array_object"));
1080 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1083 TEST_P(FeatureInfoTest
, InitializeAPPLE_vertex_array_object
) {
1084 SetupInitExpectations("GL_APPLE_vertex_array_object");
1085 EXPECT_THAT(info_
->extensions(),
1086 HasSubstr("GL_OES_vertex_array_object"));
1087 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1090 TEST_P(FeatureInfoTest
, InitializeNo_vertex_array_object
) {
1091 SetupInitExpectations("");
1092 // Even if the native extensions are not available the implementation
1093 // may still emulate the GL_OES_vertex_array_object functionality. In this
1094 // scenario native_vertex_array_object must be false.
1095 EXPECT_THAT(info_
->extensions(),
1096 HasSubstr("GL_OES_vertex_array_object"));
1097 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
1100 TEST_P(FeatureInfoTest
, InitializeOES_element_index_uint
) {
1101 SetupInitExpectations("GL_OES_element_index_uint");
1102 EXPECT_THAT(info_
->extensions(),
1103 HasSubstr("GL_OES_element_index_uint"));
1104 EXPECT_TRUE(info_
->validators()->index_type
.IsValid(GL_UNSIGNED_INT
));
1107 TEST_P(FeatureInfoTest
, InitializeVAOsWithClientSideArrays
) {
1108 base::CommandLine
command_line(0, NULL
);
1109 command_line
.AppendSwitchASCII(
1110 switches::kGpuDriverBugWorkarounds
,
1111 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS
));
1112 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object",
1114 EXPECT_TRUE(info_
->workarounds().use_client_side_arrays_for_stream_buffers
);
1115 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
1118 TEST_P(FeatureInfoTest
, InitializeEXT_blend_minmax
) {
1119 SetupInitExpectations("GL_EXT_blend_minmax");
1120 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_blend_minmax"));
1121 EXPECT_TRUE(info_
->validators()->equation
.IsValid(GL_MIN_EXT
));
1122 EXPECT_TRUE(info_
->validators()->equation
.IsValid(GL_MAX_EXT
));
1125 TEST_P(FeatureInfoTest
, InitializeEXT_frag_depth
) {
1126 SetupInitExpectations("GL_EXT_frag_depth");
1127 EXPECT_TRUE(info_
->feature_flags().ext_frag_depth
);
1128 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_frag_depth"));
1131 TEST_P(FeatureInfoTest
, InitializeEXT_shader_texture_lod
) {
1132 SetupInitExpectations("GL_EXT_shader_texture_lod");
1133 EXPECT_TRUE(info_
->feature_flags().ext_shader_texture_lod
);
1134 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_shader_texture_lod"));
1137 TEST_P(FeatureInfoTest
, InitializeEXT_discard_framebuffer
) {
1138 SetupInitExpectations("GL_EXT_discard_framebuffer");
1139 EXPECT_TRUE(info_
->feature_flags().ext_discard_framebuffer
);
1140 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1143 TEST_P(FeatureInfoTest
, InitializeSamplersWithARBSamplerObjects
) {
1144 SetupInitExpectationsWithGLVersion(
1145 "GL_ARB_sampler_objects", "", "OpenGL 3.0");
1146 EXPECT_TRUE(info_
->feature_flags().enable_samplers
);
1149 TEST_P(FeatureInfoTest
, InitializeWithES3
) {
1150 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
1151 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
1152 EXPECT_TRUE(info_
->feature_flags().use_core_framebuffer_multisample
);
1153 EXPECT_THAT(info_
->extensions(),
1154 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
1155 EXPECT_TRUE(info_
->feature_flags().use_async_readpixels
);
1156 EXPECT_TRUE(info_
->feature_flags().oes_standard_derivatives
);
1157 EXPECT_TRUE(info_
->feature_flags().oes_depth24
);
1158 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
1159 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
1161 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_COMPONENT
));
1163 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_STENCIL
));
1164 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
1165 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
1166 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
1167 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
1168 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT_24_8
));
1169 EXPECT_TRUE(info_
->feature_flags().packed_depth24_stencil8
);
1170 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_depth24"));
1172 info_
->validators()->render_buffer_format
.IsValid(GL_DEPTH_COMPONENT24
));
1174 info_
->validators()->render_buffer_format
.IsValid(GL_DEPTH24_STENCIL8
));
1176 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_STENCIL
));
1177 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
1178 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
1179 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1180 EXPECT_TRUE(info_
->feature_flags().enable_samplers
);
1181 EXPECT_TRUE(info_
->feature_flags().map_buffer_range
);
1182 EXPECT_TRUE(info_
->feature_flags().ext_discard_framebuffer
);
1183 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1184 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1185 EXPECT_TRUE(gfx::GLFence::IsSupported());
1188 TEST_P(FeatureInfoTest
, InitializeWithoutSamplers
) {
1189 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0");
1190 EXPECT_FALSE(info_
->feature_flags().enable_samplers
);
1193 TEST_P(FeatureInfoTest
, ParseDriverBugWorkaroundsSingle
) {
1194 base::CommandLine
command_line(0, NULL
);
1195 command_line
.AppendSwitchASCII(
1196 switches::kGpuDriverBugWorkarounds
,
1197 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST
));
1198 // Workarounds should get parsed without the need for a context.
1199 SetupWithCommandLine(command_line
);
1200 EXPECT_TRUE(info_
->workarounds().exit_on_context_lost
);
1203 TEST_P(FeatureInfoTest
, ParseDriverBugWorkaroundsMultiple
) {
1204 base::CommandLine
command_line(0, NULL
);
1205 command_line
.AppendSwitchASCII(
1206 switches::kGpuDriverBugWorkarounds
,
1207 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST
) + "," +
1208 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024
) + "," +
1209 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096
));
1210 // Workarounds should get parsed without the need for a context.
1211 SetupWithCommandLine(command_line
);
1212 EXPECT_TRUE(info_
->workarounds().exit_on_context_lost
);
1213 EXPECT_EQ(1024, info_
->workarounds().max_cube_map_texture_size
);
1214 EXPECT_EQ(4096, info_
->workarounds().max_texture_size
);
1217 TEST_P(FeatureInfoTest
, InitializeWithARBSync
) {
1218 SetupInitExpectations("GL_ARB_sync");
1219 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1220 EXPECT_TRUE(gfx::GLFence::IsSupported());
1223 TEST_P(FeatureInfoTest
, InitializeWithNVFence
) {
1224 SetupInitExpectations("GL_NV_fence");
1225 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1226 EXPECT_TRUE(gfx::GLFence::IsSupported());
1229 TEST_P(FeatureInfoTest
, InitializeWithNVDrawBuffers
) {
1230 SetupInitExpectationsWithGLVersion("GL_NV_draw_buffers", "", "OpenGL ES 3.0");
1231 EXPECT_TRUE(info_
->feature_flags().nv_draw_buffers
);
1232 EXPECT_TRUE(info_
->feature_flags().ext_draw_buffers
);
1235 TEST_P(FeatureInfoTest
, InitializeWithPreferredEXTDrawBuffers
) {
1236 SetupInitExpectationsWithGLVersion(
1237 "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0");
1238 EXPECT_FALSE(info_
->feature_flags().nv_draw_buffers
);
1239 EXPECT_TRUE(info_
->feature_flags().ext_draw_buffers
);
1242 TEST_P(FeatureInfoTest
, BlendEquationAdvancedDisabled
) {
1243 base::CommandLine
command_line(0, NULL
);
1244 command_line
.AppendSwitchASCII(
1245 switches::kGpuDriverBugWorkarounds
,
1246 base::IntToString(gpu::DISABLE_BLEND_EQUATION_ADVANCED
));
1247 SetupInitExpectationsWithCommandLine(
1248 "GL_KHR_blend_equation_advanced_coherent GL_KHR_blend_equation_advanced",
1250 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced
);
1251 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced_coherent
);
1254 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering_no_cmdline_switch
) {
1255 SetupInitExpectationsWithGLVersion(
1256 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1258 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1259 EXPECT_THAT(info_
->extensions(),
1260 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1263 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering
) {
1264 base::CommandLine
command_line(0, NULL
);
1265 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1266 SetupInitExpectationsWithGLVersionAndCommandLine(
1267 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1268 "", "4.3", command_line
);
1269 EXPECT_TRUE(info_
->feature_flags().chromium_path_rendering
);
1270 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1273 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering2
) {
1274 base::CommandLine
command_line(0, NULL
);
1275 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1276 SetupInitExpectationsWithGLVersionAndCommandLine(
1277 "GL_NV_path_rendering", "", "OpenGL ES 3.1", command_line
);
1278 EXPECT_TRUE(info_
->feature_flags().chromium_path_rendering
);
1279 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1282 TEST_P(FeatureInfoTest
, InitializeNoCHROMIUM_path_rendering
) {
1283 base::CommandLine
command_line(0, NULL
);
1284 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1285 SetupInitExpectationsWithGLVersionAndCommandLine("GL_ARB_compatibility", "",
1286 "4.3", command_line
);
1287 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1288 EXPECT_THAT(info_
->extensions(),
1289 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1292 TEST_P(FeatureInfoTest
, InitializeNoCHROMIUM_path_rendering2
) {
1293 base::CommandLine
command_line(0, NULL
);
1294 command_line
.AppendSwitch(switches::kEnableGLPathRendering
);
1295 SetupInitExpectationsWithGLVersionAndCommandLine(
1296 "GL_ARB_compatibility GL_NV_path_rendering", "", "4.3", command_line
);
1297 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1298 EXPECT_THAT(info_
->extensions(),
1299 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1302 TEST_P(FeatureInfoTest
, InitializeNoKHR_blend_equation_advanced
) {
1303 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility", "", "4.3");
1304 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced
);
1305 EXPECT_THAT(info_
->extensions(),
1306 Not(HasSubstr("GL_KHR_blend_equation_advanced")));
1309 TEST_P(FeatureInfoTest
, InitializeKHR_blend_equations_advanced
) {
1310 SetupInitExpectations("GL_KHR_blend_equation_advanced");
1311 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1312 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1315 TEST_P(FeatureInfoTest
, InitializeNV_blend_equations_advanced
) {
1316 SetupInitExpectations("GL_NV_blend_equation_advanced");
1317 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1318 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1321 TEST_P(FeatureInfoTest
, InitializeNoKHR_blend_equation_advanced_coherent
) {
1322 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility ", "", "4.3");
1323 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced_coherent
);
1324 EXPECT_THAT(info_
->extensions(),
1325 Not(HasSubstr("GL_KHR_blend_equation_advanced_coherent")));
1328 TEST_P(FeatureInfoTest
, InitializeKHR_blend_equations_advanced_coherent
) {
1329 SetupInitExpectations("GL_KHR_blend_equation_advanced_coherent");
1330 EXPECT_THAT(info_
->extensions(),
1331 HasSubstr("GL_KHR_blend_equation_advanced_coherent"));
1332 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1333 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced_coherent
);
1336 TEST_P(FeatureInfoTest
, InitializeEXT_texture_rgWithFloat
) {
1337 SetupInitExpectations(
1338 "GL_EXT_texture_rg GL_OES_texture_float GL_OES_texture_half_float");
1339 EXPECT_TRUE(info_
->feature_flags().ext_texture_rg
);
1341 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RED_EXT
));
1342 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RG_EXT
));
1343 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RED_EXT
));
1344 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RG_EXT
));
1345 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RED_EXT
));
1346 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RG_EXT
));
1347 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_R8_EXT
));
1348 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_RG8_EXT
));
1351 TEST_P(FeatureInfoTest
, InitializeARB_texture_rgNoFloat
) {
1352 SetupInitExpectations("GL_ARB_texture_rg");
1353 EXPECT_TRUE(info_
->feature_flags().ext_texture_rg
);
1355 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RED_EXT
));
1356 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RG_EXT
));
1357 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RED_EXT
));
1358 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RG_EXT
));
1359 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RED_EXT
));
1360 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RG_EXT
));
1361 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_R8_EXT
));
1362 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_RG8_EXT
));
1365 } // namespace gles2