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/test_helper.h"
12 #include "gpu/command_buffer/service/texture_manager.h"
13 #include "gpu/config/gpu_driver_bug_workaround_type.h"
14 #include "gpu/config/gpu_switches.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gl/gl_fence.h"
17 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_mock.h"
21 using ::testing::DoAll
;
22 using ::testing::HasSubstr
;
23 using ::testing::InSequence
;
24 using ::testing::MatcherCast
;
26 using ::testing::Pointee
;
27 using ::testing::Return
;
28 using ::testing::SetArrayArgument
;
29 using ::testing::SetArgumentPointee
;
30 using ::testing::StrEq
;
36 const char kGLRendererStringANGLE
[] = "ANGLE (some renderer)";
37 } // anonymous namespace
39 enum MockedGLVersionKind
{
41 Version3_2Compatibility
45 : public GpuServiceTest
,
46 public ::testing::WithParamInterface
<MockedGLVersionKind
> {
51 void SetupInitExpectations(const char* extensions
) {
52 std::string extensions_str
= extensions
;
53 // Most of the tests' expectations currently assume the desktop
54 // OpenGL compatibility profile.
57 SetupInitExpectationsWithGLVersion(extensions_str
.c_str(), "", "3.0");
59 case Version3_2Compatibility
:
60 if (extensions_str
.find("GL_ARB_compatibility") == std::string::npos
) {
61 extensions_str
+= " GL_ARB_compatibility";
63 SetupInitExpectationsWithGLVersion(extensions_str
.c_str(), "", "3.2");
71 void SetupInitExpectationsWithGLVersion(
72 const char* extensions
, const char* renderer
, const char* version
) {
73 GpuServiceTest::SetUpWithGLVersion(version
, extensions
);
74 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
75 gl_
.get(), extensions
, renderer
, version
);
76 info_
= new FeatureInfo();
80 void SetupWithCommandLine(const base::CommandLine
& command_line
) {
81 GpuServiceTest::SetUp();
82 info_
= new FeatureInfo(command_line
);
85 void SetupInitExpectationsWithCommandLine(
86 const char* extensions
,
87 const base::CommandLine
& command_line
) {
88 GpuServiceTest::SetUpWithGLVersion("2.0", extensions
);
89 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
90 gl_
.get(), extensions
, "", "");
91 info_
= new FeatureInfo(command_line
);
95 void SetupWithoutInit() {
96 GpuServiceTest::SetUp();
97 info_
= new FeatureInfo();
101 void SetUp() override
{
102 // Do nothing here, since we are using the explicit Setup*() functions.
105 void TearDown() override
{
107 GpuServiceTest::TearDown();
110 scoped_refptr
<FeatureInfo
> info_
;
121 } // anonymous namespace.
123 static const MockedGLVersionKind kGLVersionKinds
[] = {
125 Version3_2Compatibility
128 INSTANTIATE_TEST_CASE_P(Service
,
130 ::testing::ValuesIn(kGLVersionKinds
));
132 TEST_P(FeatureInfoTest
, Basic
) {
134 // Test it starts off uninitialized.
135 EXPECT_FALSE(info_
->feature_flags().chromium_framebuffer_multisample
);
136 EXPECT_FALSE(info_
->feature_flags().use_core_framebuffer_multisample
);
137 EXPECT_FALSE(info_
->feature_flags().multisampled_render_to_texture
);
138 EXPECT_FALSE(info_
->feature_flags(
139 ).use_img_for_multisampled_render_to_texture
);
140 EXPECT_FALSE(info_
->feature_flags().oes_standard_derivatives
);
141 EXPECT_FALSE(info_
->feature_flags().npot_ok
);
142 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
143 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
144 EXPECT_FALSE(info_
->feature_flags().oes_egl_image_external
);
145 EXPECT_FALSE(info_
->feature_flags().oes_depth24
);
146 EXPECT_FALSE(info_
->feature_flags().packed_depth24_stencil8
);
147 EXPECT_FALSE(info_
->feature_flags().angle_translated_shader_source
);
148 EXPECT_FALSE(info_
->feature_flags().angle_pack_reverse_row_order
);
149 EXPECT_FALSE(info_
->feature_flags().arb_texture_rectangle
);
150 EXPECT_FALSE(info_
->feature_flags().angle_instanced_arrays
);
151 EXPECT_FALSE(info_
->feature_flags().occlusion_query_boolean
);
152 EXPECT_FALSE(info_
->feature_flags(
153 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
154 EXPECT_FALSE(info_
->feature_flags(
155 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
156 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
157 EXPECT_FALSE(info_
->feature_flags().map_buffer_range
);
158 EXPECT_FALSE(info_
->feature_flags().use_async_readpixels
);
159 EXPECT_FALSE(info_
->feature_flags().ext_draw_buffers
);
160 EXPECT_FALSE(info_
->feature_flags().nv_draw_buffers
);
161 EXPECT_FALSE(info_
->feature_flags().ext_discard_framebuffer
);
162 EXPECT_FALSE(info_
->feature_flags().angle_depth_texture
);
164 #define GPU_OP(type, name) EXPECT_FALSE(info_->workarounds().name);
165 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP
)
167 EXPECT_EQ(0, info_
->workarounds().max_texture_size
);
168 EXPECT_EQ(0, info_
->workarounds().max_cube_map_texture_size
);
169 EXPECT_FALSE(info_
->workarounds().gl_clear_broken
);
172 TEST_P(FeatureInfoTest
, InitializeNoExtensions
) {
173 SetupInitExpectations("");
174 // Check default extensions are there
175 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_resource_safe"));
176 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs"));
177 EXPECT_THAT(info_
->extensions(),
178 HasSubstr("GL_ANGLE_translated_shader_source"));
179 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_trace_marker"));
181 // Check a couple of random extensions that should not be there.
182 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_npot")));
183 EXPECT_THAT(info_
->extensions(),
184 Not(HasSubstr("GL_EXT_texture_compression_dxt1")));
185 EXPECT_THAT(info_
->extensions(),
186 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3")));
187 EXPECT_THAT(info_
->extensions(),
188 Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5")));
189 EXPECT_THAT(info_
->extensions(),
190 Not(HasSubstr("GL_ANGLE_texture_usage")));
191 EXPECT_THAT(info_
->extensions(),
192 Not(HasSubstr("GL_EXT_texture_storage")));
193 EXPECT_THAT(info_
->extensions(),
194 Not(HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")));
195 EXPECT_THAT(info_
->extensions(),
196 Not(HasSubstr("GL_AMD_compressed_ATC_texture")));
197 EXPECT_THAT(info_
->extensions(),
198 Not(HasSubstr("GL_IMG_texture_compression_pvrtc")));
199 EXPECT_THAT(info_
->extensions(),
200 Not(HasSubstr("GL_EXT_sRGB")));
201 EXPECT_FALSE(info_
->feature_flags().npot_ok
);
202 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
203 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
204 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
205 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
206 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
207 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
208 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
209 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
210 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
212 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
214 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
215 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
));
216 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
217 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
));
218 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
219 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
));
220 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
221 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
));
222 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
223 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
));
224 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
225 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
));
226 EXPECT_FALSE(info_
->validators()->read_pixel_format
.IsValid(
228 EXPECT_FALSE(info_
->validators()->texture_parameter
.IsValid(
229 GL_TEXTURE_MAX_ANISOTROPY_EXT
));
230 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
231 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
));
232 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
233 GL_READ_FRAMEBUFFER_EXT
));
234 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
235 GL_DRAW_FRAMEBUFFER_EXT
));
236 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
237 GL_READ_FRAMEBUFFER_BINDING_EXT
));
238 EXPECT_FALSE(info_
->validators()->render_buffer_parameter
.IsValid(
239 GL_MAX_SAMPLES_EXT
));
240 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
241 GL_DEPTH_COMPONENT
));
242 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
243 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
244 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
245 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
246 GL_DEPTH24_STENCIL8
));
247 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
249 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
251 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
253 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
255 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(
256 GL_UNSIGNED_INT_24_8
));
257 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
258 GL_DEPTH_COMPONENT24
));
259 EXPECT_FALSE(info_
->validators()->texture_parameter
.IsValid(
260 GL_TEXTURE_USAGE_ANGLE
));
261 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
262 GL_DEPTH_COMPONENT16
));
263 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
264 GL_DEPTH_COMPONENT32_OES
));
265 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
266 GL_DEPTH24_STENCIL8_OES
));
267 EXPECT_FALSE(info_
->validators()->equation
.IsValid(GL_MIN_EXT
));
268 EXPECT_FALSE(info_
->validators()->equation
.IsValid(GL_MAX_EXT
));
269 EXPECT_FALSE(info_
->feature_flags().chromium_sync_query
);
270 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
272 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
274 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
276 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
278 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
279 GL_SRGB8_ALPHA8_EXT
));
280 EXPECT_FALSE(info_
->validators()->frame_buffer_parameter
.IsValid(
281 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
284 TEST_P(FeatureInfoTest
, InitializeWithANGLE
) {
285 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE
, "");
286 EXPECT_TRUE(info_
->gl_version_info().is_angle
);
289 TEST_P(FeatureInfoTest
, InitializeNPOTExtensionGLES
) {
290 SetupInitExpectations("GL_OES_texture_npot");
291 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_npot"));
292 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
295 TEST_P(FeatureInfoTest
, InitializeNPOTExtensionGL
) {
296 SetupInitExpectations("GL_ARB_texture_non_power_of_two");
297 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_npot"));
298 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
301 TEST_P(FeatureInfoTest
, InitializeDXTExtensionGLES2
) {
302 SetupInitExpectations("GL_EXT_texture_compression_dxt1");
303 EXPECT_THAT(info_
->extensions(),
304 HasSubstr("GL_EXT_texture_compression_dxt1"));
305 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
306 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
307 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
308 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
309 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
310 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
311 EXPECT_FALSE(info_
->validators()->compressed_texture_format
.IsValid(
312 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
315 TEST_P(FeatureInfoTest
, InitializeDXTExtensionGL
) {
316 SetupInitExpectations("GL_EXT_texture_compression_s3tc");
317 EXPECT_THAT(info_
->extensions(),
318 HasSubstr("GL_EXT_texture_compression_dxt1"));
319 EXPECT_THAT(info_
->extensions(),
320 HasSubstr("GL_CHROMIUM_texture_compression_dxt3"));
321 EXPECT_THAT(info_
->extensions(),
322 HasSubstr("GL_CHROMIUM_texture_compression_dxt5"));
323 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
324 GL_COMPRESSED_RGB_S3TC_DXT1_EXT
));
325 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
326 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
));
327 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
328 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
));
329 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
330 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
));
333 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888GLES2
) {
334 SetupInitExpectations("GL_EXT_texture_format_BGRA8888");
335 EXPECT_THAT(info_
->extensions(),
336 HasSubstr("GL_EXT_texture_format_BGRA8888"));
337 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
339 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
341 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
345 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888GL
) {
346 SetupInitExpectations("GL_EXT_bgra");
347 EXPECT_THAT(info_
->extensions(),
348 HasSubstr("GL_EXT_texture_format_BGRA8888"));
349 EXPECT_THAT(info_
->extensions(),
350 HasSubstr("GL_EXT_read_format_bgra"));
351 EXPECT_THAT(info_
->extensions(),
352 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
353 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
355 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
357 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
359 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
363 TEST_P(FeatureInfoTest
, InitializeEXT_texture_format_BGRA8888Apple
) {
364 SetupInitExpectations("GL_APPLE_texture_format_BGRA8888");
365 EXPECT_THAT(info_
->extensions(),
366 HasSubstr("GL_EXT_texture_format_BGRA8888"));
367 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
369 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
371 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
375 TEST_P(FeatureInfoTest
, InitializeEXT_read_format_bgra
) {
376 SetupInitExpectations("GL_EXT_read_format_bgra");
377 EXPECT_THAT(info_
->extensions(),
378 HasSubstr("GL_EXT_read_format_bgra"));
379 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
381 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
383 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(
385 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
389 TEST_P(FeatureInfoTest
, InitializeEXT_sRGB
) {
390 SetupInitExpectations("GL_EXT_sRGB GL_OES_rgb8_rgba8");
391 EXPECT_THAT(info_
->extensions(),
392 HasSubstr("GL_EXT_sRGB"));
393 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
395 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
397 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
399 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
401 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
402 GL_SRGB8_ALPHA8_EXT
));
403 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
404 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
407 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage
) {
408 SetupInitExpectations("GL_EXT_texture_storage");
409 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
410 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
411 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
412 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
413 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
415 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
417 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
419 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
421 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
422 GL_LUMINANCE32F_EXT
));
423 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
424 GL_LUMINANCE_ALPHA32F_EXT
));
425 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
427 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
429 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
431 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
432 GL_LUMINANCE16F_EXT
));
433 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
434 GL_LUMINANCE_ALPHA16F_EXT
));
437 TEST_P(FeatureInfoTest
, InitializeARB_texture_storage
) {
438 SetupInitExpectations("GL_ARB_texture_storage");
439 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
440 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
441 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
442 GL_TEXTURE_IMMUTABLE_FORMAT_EXT
));
445 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_BGRA
) {
446 SetupInitExpectations("GL_EXT_texture_storage GL_EXT_bgra");
447 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
448 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
449 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
451 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
454 TEST_P(FeatureInfoTest
, InitializeARB_texture_storage_BGRA
) {
455 SetupInitExpectations("GL_ARB_texture_storage GL_EXT_bgra");
456 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
457 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
458 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
460 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
463 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_BGRA8888
) {
464 SetupInitExpectations(
465 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888");
466 EXPECT_TRUE(info_
->feature_flags().ext_texture_storage
);
467 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
468 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
469 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
471 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
474 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_float
) {
475 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_float");
476 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
477 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
478 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
480 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
482 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
484 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
485 GL_LUMINANCE32F_EXT
));
486 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
487 GL_LUMINANCE_ALPHA32F_EXT
));
490 TEST_P(FeatureInfoTest
, InitializeEXT_texture_storage_half_float
) {
491 SetupInitExpectations("GL_EXT_texture_storage GL_OES_texture_half_float");
492 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
493 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
494 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
496 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
498 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
500 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
501 GL_LUMINANCE16F_EXT
));
502 EXPECT_TRUE(info_
->validators()->texture_internal_format_storage
.IsValid(
503 GL_LUMINANCE_ALPHA16F_EXT
));
506 // Check how to handle ES, texture_storage and BGRA combination; 10 tests.
508 // 1- ES2 + GL_EXT_texture_storage -> GL_EXT_texture_storage (and no
509 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8 in
510 // glTexStorage2DEXT)
511 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_storage
) {
512 SetupInitExpectationsWithGLVersion(
513 "GL_EXT_texture_storage", "", "OpenGL ES 2.0");
514 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
515 EXPECT_THAT(info_
->extensions(),
516 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
519 // 2- ES2 + GL_EXT_texture_storage + (GL_EXT_texture_format_BGRA8888 or
520 // GL_APPLE_texture_format_bgra8888)
521 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_storage_BGRA
) {
522 SetupInitExpectationsWithGLVersion(
523 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
526 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
527 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
530 // 3- ES2 + GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_bgra8888
531 TEST_P(FeatureInfoTest
, InitializeGLES2_texture_format_BGRA
) {
532 SetupInitExpectationsWithGLVersion(
533 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 2.0");
534 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
535 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
538 // 4- ES2 (neither GL_EXT_texture_storage nor GL_EXT_texture_format_BGRA8888) ->
540 TEST_P(FeatureInfoTest
, InitializeGLES2_neither_texture_storage_nor_BGRA
) {
541 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
542 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
543 EXPECT_THAT(info_
->extensions(),
544 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
547 // 5- ES3 + GL_EXT_texture_format_BGRA8888 -> GL_EXT_texture_format_BGRA8888
548 // (we can't expose GL_EXT_texture_storage because we fail the GL_BGRA8
550 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage_EXT_BGRA
) {
551 SetupInitExpectationsWithGLVersion(
552 "GL_EXT_texture_format_BGRA8888", "", "OpenGL ES 3.0");
553 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_texture_storage")));
554 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
557 // 6- ES3 + GL_APPLE_texture_format_bgra8888 -> GL_EXT_texture_storage +
558 // GL_EXT_texture_format_BGRA8888 (driver promises to handle GL_BGRA8 by
559 // exposing GL_APPLE_texture_format_bgra8888)
560 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage_APPLE_BGRA
) {
561 SetupInitExpectationsWithGLVersion(
562 "GL_APPLE_texture_format_BGRA8888", "", "OpenGL ES 3.0");
563 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
564 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
567 // 7- ES3 + GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 ->
568 // GL_EXT_texture_storage + GL_EXT_texture_format_BGRA8888 (driver promises to
569 // handle GL_BGRA8 by exposing GL_EXT_texture_storage)
570 TEST_P(FeatureInfoTest
, InitializeGLES3_EXT_texture_storage_EXT_BGRA
) {
571 SetupInitExpectationsWithGLVersion(
572 "GL_EXT_texture_storage GL_EXT_texture_format_BGRA8888",
575 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
576 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888"));
579 // 8- ES3 + none of the above -> GL_EXT_texture_storage (and no
580 // GL_EXT_texture_format_BGRA8888 - we don't claim to handle GL_BGRA8)
581 TEST_P(FeatureInfoTest
, InitializeGLES3_texture_storage
) {
582 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
583 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_texture_storage"));
584 EXPECT_THAT(info_
->extensions(),
585 Not(HasSubstr("GL_EXT_texture_format_BGRA8888")));
588 // 9- ANGLE will add the GL_CHROMIUM_renderbuffer_format_BGRA8888 extension and
589 // the GL_BGRA8_EXT render buffer format.
590 TEST_P(FeatureInfoTest
, InitializeWithANGLE_BGRA8
) {
591 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE
, "");
592 EXPECT_TRUE(info_
->gl_version_info().is_angle
);
593 EXPECT_THAT(info_
->extensions(),
594 HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888"));
595 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_BGRA8_EXT
));
598 // 10- vanilla opengl es means no GL_CHROMIUM_renderbuffer_format_BGRA8888
599 TEST_P(FeatureInfoTest
,
600 InitializeGLES2_no_CHROMIUM_renderbuffer_format_BGRA8888
) {
601 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 2.0");
602 EXPECT_THAT(info_
->extensions(),
603 Not(HasSubstr("GL_CHROMIUM_renderbuffer_format_BGRA8888")));
606 TEST_P(FeatureInfoTest
, InitializeARB_texture_float
) {
607 SetupInitExpectations("GL_ARB_texture_float");
608 EXPECT_TRUE(info_
->feature_flags().chromium_color_buffer_float_rgba
);
609 EXPECT_TRUE(info_
->feature_flags().chromium_color_buffer_float_rgb
);
610 std::string extensions
= info_
->extensions() + " ";
611 EXPECT_THAT(extensions
, HasSubstr("GL_CHROMIUM_color_buffer_float_rgb "));
612 EXPECT_THAT(extensions
, HasSubstr("GL_CHROMIUM_color_buffer_float_rgba"));
613 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
615 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
619 TEST_P(FeatureInfoTest
, Initialize_texture_floatGLES3
) {
620 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
621 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
622 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
623 EXPECT_THAT(info_
->extensions(),
624 Not(HasSubstr("GL_OES_texture_float_linear")));
625 EXPECT_THAT(info_
->extensions(),
626 Not(HasSubstr("GL_OES_texture_half_float_linear")));
629 TEST_P(FeatureInfoTest
, Initialize_sRGBGLES3
) {
630 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
631 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_EXT_sRGB")));
632 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
634 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(
636 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
638 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
640 EXPECT_FALSE(info_
->validators()->render_buffer_format
.IsValid(
641 GL_SRGB8_ALPHA8_EXT
));
642 EXPECT_FALSE(info_
->validators()->frame_buffer_parameter
.IsValid(
643 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT
));
646 TEST_P(FeatureInfoTest
, InitializeOES_texture_floatGLES2
) {
647 SetupInitExpectations("GL_OES_texture_float");
648 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
649 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
650 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
651 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
652 EXPECT_THAT(info_
->extensions(),
653 Not(HasSubstr("GL_OES_texture_float_linear")));
654 EXPECT_THAT(info_
->extensions(),
655 Not(HasSubstr("GL_OES_texture_half_float_linear")));
656 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
657 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
660 TEST_P(FeatureInfoTest
, InitializeOES_texture_float_linearGLES2
) {
661 SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear");
662 EXPECT_TRUE(info_
->feature_flags().enable_texture_float_linear
);
663 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
664 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float"));
665 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
666 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_float_linear"));
667 EXPECT_THAT(info_
->extensions(),
668 Not(HasSubstr("GL_OES_texture_half_float_linear")));
669 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
670 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
673 TEST_P(FeatureInfoTest
, InitializeOES_texture_half_floatGLES2
) {
674 SetupInitExpectations("GL_OES_texture_half_float");
675 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
676 EXPECT_FALSE(info_
->feature_flags().enable_texture_half_float_linear
);
677 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
678 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
679 EXPECT_THAT(info_
->extensions(),
680 Not(HasSubstr("GL_OES_texture_float_linear")));
681 EXPECT_THAT(info_
->extensions(),
682 Not(HasSubstr("GL_OES_texture_half_float_linear")));
683 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
684 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
687 TEST_P(FeatureInfoTest
, InitializeOES_texture_half_float_linearGLES2
) {
688 SetupInitExpectations(
689 "GL_OES_texture_half_float GL_OES_texture_half_float_linear");
690 EXPECT_FALSE(info_
->feature_flags().enable_texture_float_linear
);
691 EXPECT_TRUE(info_
->feature_flags().enable_texture_half_float_linear
);
692 EXPECT_THAT(info_
->extensions(), Not(HasSubstr("GL_OES_texture_float")));
693 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_texture_half_float"));
694 EXPECT_THAT(info_
->extensions(),
695 Not(HasSubstr("GL_OES_texture_float_linear")));
696 EXPECT_THAT(info_
->extensions(),
697 HasSubstr("GL_OES_texture_half_float_linear"));
698 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_FLOAT
));
699 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_HALF_FLOAT_OES
));
702 TEST_P(FeatureInfoTest
, InitializeEXT_framebuffer_multisample
) {
703 SetupInitExpectations("GL_EXT_framebuffer_multisample");
704 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
705 EXPECT_THAT(info_
->extensions(),
706 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
707 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
708 GL_READ_FRAMEBUFFER_EXT
));
709 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
710 GL_DRAW_FRAMEBUFFER_EXT
));
711 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
712 GL_READ_FRAMEBUFFER_BINDING_EXT
));
713 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
714 GL_MAX_SAMPLES_EXT
));
715 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
716 GL_RENDERBUFFER_SAMPLES_EXT
));
719 TEST_P(FeatureInfoTest
, InitializeANGLE_framebuffer_multisample
) {
720 SetupInitExpectationsWithGLVersion(
721 "GL_ANGLE_framebuffer_multisample", kGLRendererStringANGLE
, "");
722 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
723 EXPECT_THAT(info_
->extensions(),
724 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
725 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
726 GL_READ_FRAMEBUFFER_EXT
));
727 EXPECT_TRUE(info_
->validators()->frame_buffer_target
.IsValid(
728 GL_DRAW_FRAMEBUFFER_EXT
));
729 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
730 GL_READ_FRAMEBUFFER_BINDING_EXT
));
731 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
732 GL_MAX_SAMPLES_EXT
));
733 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
734 GL_RENDERBUFFER_SAMPLES_EXT
));
737 // We don't allow ANGLE_framebuffer_multisample on non-ANGLE implementations,
738 // because we wouldn't be choosing the right driver entry point and because the
739 // extension was falsely advertised on some Android devices (crbug.com/165736).
740 TEST_P(FeatureInfoTest
, InitializeANGLE_framebuffer_multisampleWithoutANGLE
) {
741 SetupInitExpectations("GL_ANGLE_framebuffer_multisample");
742 EXPECT_FALSE(info_
->feature_flags().chromium_framebuffer_multisample
);
743 EXPECT_THAT(info_
->extensions(),
744 Not(HasSubstr("GL_CHROMIUM_framebuffer_multisample")));
745 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
746 GL_READ_FRAMEBUFFER_EXT
));
747 EXPECT_FALSE(info_
->validators()->frame_buffer_target
.IsValid(
748 GL_DRAW_FRAMEBUFFER_EXT
));
749 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
750 GL_READ_FRAMEBUFFER_BINDING_EXT
));
751 EXPECT_FALSE(info_
->validators()->g_l_state
.IsValid(
752 GL_MAX_SAMPLES_EXT
));
753 EXPECT_FALSE(info_
->validators()->render_buffer_parameter
.IsValid(
754 GL_RENDERBUFFER_SAMPLES_EXT
));
757 TEST_P(FeatureInfoTest
, InitializeEXT_multisampled_render_to_texture
) {
758 SetupInitExpectations("GL_EXT_multisampled_render_to_texture");
759 EXPECT_TRUE(info_
->feature_flags(
760 ).multisampled_render_to_texture
);
761 EXPECT_FALSE(info_
->feature_flags(
762 ).use_img_for_multisampled_render_to_texture
);
763 EXPECT_THAT(info_
->extensions(),
764 HasSubstr("GL_EXT_multisampled_render_to_texture"));
765 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
766 GL_MAX_SAMPLES_EXT
));
767 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
768 GL_RENDERBUFFER_SAMPLES_EXT
));
769 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
770 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT
));
773 TEST_P(FeatureInfoTest
, InitializeIMG_multisampled_render_to_texture
) {
774 SetupInitExpectations("GL_IMG_multisampled_render_to_texture");
775 EXPECT_TRUE(info_
->feature_flags(
776 ).multisampled_render_to_texture
);
777 EXPECT_TRUE(info_
->feature_flags(
778 ).use_img_for_multisampled_render_to_texture
);
779 EXPECT_THAT(info_
->extensions(),
780 HasSubstr("GL_EXT_multisampled_render_to_texture"));
781 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
782 GL_MAX_SAMPLES_EXT
));
783 EXPECT_TRUE(info_
->validators()->render_buffer_parameter
.IsValid(
784 GL_RENDERBUFFER_SAMPLES_EXT
));
785 EXPECT_TRUE(info_
->validators()->frame_buffer_parameter
.IsValid(
786 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT
));
789 TEST_P(FeatureInfoTest
, InitializeEXT_texture_filter_anisotropic
) {
790 SetupInitExpectations("GL_EXT_texture_filter_anisotropic");
791 EXPECT_THAT(info_
->extensions(),
792 HasSubstr("GL_EXT_texture_filter_anisotropic"));
793 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
794 GL_TEXTURE_MAX_ANISOTROPY_EXT
));
795 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
796 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
));
799 TEST_P(FeatureInfoTest
, InitializeEXT_ARB_depth_texture
) {
800 SetupInitExpectations("GL_ARB_depth_texture");
801 EXPECT_THAT(info_
->extensions(),
802 HasSubstr("GL_GOOGLE_depth_texture"));
803 EXPECT_THAT(info_
->extensions(),
804 HasSubstr("GL_CHROMIUM_depth_texture"));
805 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
806 GL_DEPTH_COMPONENT
));
807 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
808 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
809 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
810 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
813 TEST_P(FeatureInfoTest
, InitializeOES_ARB_depth_texture
) {
814 SetupInitExpectations("GL_OES_depth_texture");
815 EXPECT_THAT(info_
->extensions(),
816 HasSubstr("GL_GOOGLE_depth_texture"));
817 EXPECT_THAT(info_
->extensions(),
818 HasSubstr("GL_CHROMIUM_depth_texture"));
819 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
820 GL_DEPTH_COMPONENT
));
821 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
822 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
823 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
824 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
827 TEST_P(FeatureInfoTest
, InitializeANGLE_depth_texture
) {
828 SetupInitExpectations("GL_ANGLE_depth_texture");
829 EXPECT_THAT(info_
->extensions(),
830 HasSubstr("GL_GOOGLE_depth_texture"));
831 EXPECT_THAT(info_
->extensions(),
832 HasSubstr("GL_CHROMIUM_depth_texture"));
833 EXPECT_THAT(info_
->extensions(),
834 Not(HasSubstr("GL_ANGLE_depth_texture")));
835 EXPECT_TRUE(info_
->feature_flags().angle_depth_texture
);
836 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
837 GL_DEPTH_COMPONENT
));
838 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
839 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
840 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
841 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
842 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
843 GL_DEPTH_COMPONENT16
));
844 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
845 GL_DEPTH_COMPONENT32_OES
));
846 EXPECT_FALSE(info_
->validators()->texture_internal_format_storage
.IsValid(
847 GL_DEPTH24_STENCIL8_OES
));
850 TEST_P(FeatureInfoTest
, InitializeEXT_packed_depth_stencil
) {
851 SetupInitExpectations("GL_EXT_packed_depth_stencil");
852 EXPECT_THAT(info_
->extensions(),
853 HasSubstr("GL_OES_packed_depth_stencil"));
854 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
855 GL_DEPTH24_STENCIL8
));
856 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
857 GL_DEPTH_COMPONENT
));
858 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
859 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
860 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
863 TEST_P(FeatureInfoTest
, InitializeOES_packed_depth_stencil
) {
864 SetupInitExpectations("GL_OES_packed_depth_stencil");
865 EXPECT_THAT(info_
->extensions(),
866 HasSubstr("GL_OES_packed_depth_stencil"));
867 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
868 GL_DEPTH24_STENCIL8
));
869 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
870 GL_DEPTH_COMPONENT
));
871 EXPECT_FALSE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
872 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
873 EXPECT_FALSE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
876 TEST_P(FeatureInfoTest
,
877 InitializeOES_packed_depth_stencil_and_GL_ARB_depth_texture
) {
878 SetupInitExpectations("GL_OES_packed_depth_stencil GL_ARB_depth_texture");
879 EXPECT_THAT(info_
->extensions(),
880 HasSubstr("GL_OES_packed_depth_stencil"));
881 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
882 GL_DEPTH24_STENCIL8
));
883 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(
885 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(
887 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(
888 GL_UNSIGNED_INT_24_8
));
891 TEST_P(FeatureInfoTest
, InitializeOES_depth24
) {
892 SetupInitExpectations("GL_OES_depth24");
893 EXPECT_TRUE(info_
->feature_flags().oes_depth24
);
894 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_depth24"));
895 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
896 GL_DEPTH_COMPONENT24
));
899 TEST_P(FeatureInfoTest
, InitializeOES_standard_derivatives
) {
900 SetupInitExpectations("GL_OES_standard_derivatives");
901 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_standard_derivatives"));
902 EXPECT_TRUE(info_
->feature_flags().oes_standard_derivatives
);
903 EXPECT_TRUE(info_
->validators()->hint_target
.IsValid(
904 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
));
905 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
906 GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
));
909 TEST_P(FeatureInfoTest
, InitializeOES_rgb8_rgba8
) {
910 SetupInitExpectations("GL_OES_rgb8_rgba8");
911 EXPECT_THAT(info_
->extensions(),
912 HasSubstr("GL_OES_rgb8_rgba8"));
913 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
915 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(
919 TEST_P(FeatureInfoTest
, InitializeOES_EGL_image_external
) {
920 SetupInitExpectations("GL_OES_EGL_image_external");
921 EXPECT_THAT(info_
->extensions(),
922 HasSubstr("GL_OES_EGL_image_external"));
923 EXPECT_TRUE(info_
->feature_flags().oes_egl_image_external
);
924 EXPECT_TRUE(info_
->validators()->texture_bind_target
.IsValid(
925 GL_TEXTURE_EXTERNAL_OES
));
926 EXPECT_TRUE(info_
->validators()->get_tex_param_target
.IsValid(
927 GL_TEXTURE_EXTERNAL_OES
));
928 EXPECT_TRUE(info_
->validators()->texture_parameter
.IsValid(
929 GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES
));
930 EXPECT_TRUE(info_
->validators()->g_l_state
.IsValid(
931 GL_TEXTURE_BINDING_EXTERNAL_OES
));
934 TEST_P(FeatureInfoTest
, InitializeOES_compressed_ETC1_RGB8_texture
) {
935 SetupInitExpectations("GL_OES_compressed_ETC1_RGB8_texture");
936 EXPECT_THAT(info_
->extensions(),
937 HasSubstr("GL_OES_compressed_ETC1_RGB8_texture"));
938 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
940 EXPECT_FALSE(info_
->validators()->texture_internal_format
.IsValid(
944 TEST_P(FeatureInfoTest
, InitializeAMD_compressed_ATC_texture
) {
945 SetupInitExpectations("GL_AMD_compressed_ATC_texture");
946 EXPECT_THAT(info_
->extensions(),
947 HasSubstr("GL_AMD_compressed_ATC_texture"));
948 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
950 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
951 GL_ATC_RGBA_EXPLICIT_ALPHA_AMD
));
952 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
953 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
));
956 TEST_P(FeatureInfoTest
, InitializeIMG_texture_compression_pvrtc
) {
957 SetupInitExpectations("GL_IMG_texture_compression_pvrtc");
958 EXPECT_THAT(info_
->extensions(),
959 HasSubstr("GL_IMG_texture_compression_pvrtc"));
960 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
961 GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
));
962 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
963 GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
));
964 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
965 GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
));
966 EXPECT_TRUE(info_
->validators()->compressed_texture_format
.IsValid(
967 GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
));
970 TEST_P(FeatureInfoTest
, InitializeEXT_occlusion_query_boolean
) {
971 SetupInitExpectations("GL_EXT_occlusion_query_boolean");
972 EXPECT_THAT(info_
->extensions(),
973 HasSubstr("GL_EXT_occlusion_query_boolean"));
974 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
975 EXPECT_FALSE(info_
->feature_flags(
976 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
977 EXPECT_FALSE(info_
->feature_flags(
978 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
981 TEST_P(FeatureInfoTest
, InitializeARB_occlusion_query
) {
982 SetupInitExpectations("GL_ARB_occlusion_query");
983 EXPECT_THAT(info_
->extensions(),
984 HasSubstr("GL_EXT_occlusion_query_boolean"));
985 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
986 EXPECT_FALSE(info_
->feature_flags(
987 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
988 EXPECT_TRUE(info_
->feature_flags(
989 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
992 TEST_P(FeatureInfoTest
, InitializeARB_occlusion_query2
) {
993 SetupInitExpectations("GL_ARB_occlusion_query2 GL_ARB_occlusion_query2");
994 EXPECT_THAT(info_
->extensions(),
995 HasSubstr("GL_EXT_occlusion_query_boolean"));
996 EXPECT_TRUE(info_
->feature_flags().occlusion_query_boolean
);
997 EXPECT_TRUE(info_
->feature_flags(
998 ).use_arb_occlusion_query2_for_occlusion_query_boolean
);
999 EXPECT_FALSE(info_
->feature_flags(
1000 ).use_arb_occlusion_query_for_occlusion_query_boolean
);
1003 TEST_P(FeatureInfoTest
, InitializeOES_vertex_array_object
) {
1004 SetupInitExpectations("GL_OES_vertex_array_object");
1005 EXPECT_THAT(info_
->extensions(),
1006 HasSubstr("GL_OES_vertex_array_object"));
1007 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1010 TEST_P(FeatureInfoTest
, InitializeARB_vertex_array_object
) {
1011 SetupInitExpectations("GL_ARB_vertex_array_object");
1012 EXPECT_THAT(info_
->extensions(),
1013 HasSubstr("GL_OES_vertex_array_object"));
1014 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1017 TEST_P(FeatureInfoTest
, InitializeAPPLE_vertex_array_object
) {
1018 SetupInitExpectations("GL_APPLE_vertex_array_object");
1019 EXPECT_THAT(info_
->extensions(),
1020 HasSubstr("GL_OES_vertex_array_object"));
1021 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1024 TEST_P(FeatureInfoTest
, InitializeNo_vertex_array_object
) {
1025 SetupInitExpectations("");
1026 // Even if the native extensions are not available the implementation
1027 // may still emulate the GL_OES_vertex_array_object functionality. In this
1028 // scenario native_vertex_array_object must be false.
1029 EXPECT_THAT(info_
->extensions(),
1030 HasSubstr("GL_OES_vertex_array_object"));
1031 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
1034 TEST_P(FeatureInfoTest
, InitializeOES_element_index_uint
) {
1035 SetupInitExpectations("GL_OES_element_index_uint");
1036 EXPECT_THAT(info_
->extensions(),
1037 HasSubstr("GL_OES_element_index_uint"));
1038 EXPECT_TRUE(info_
->validators()->index_type
.IsValid(GL_UNSIGNED_INT
));
1041 TEST_P(FeatureInfoTest
, InitializeVAOsWithClientSideArrays
) {
1042 base::CommandLine
command_line(0, NULL
);
1043 command_line
.AppendSwitchASCII(
1044 switches::kGpuDriverBugWorkarounds
,
1045 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS
));
1046 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object",
1048 EXPECT_TRUE(info_
->workarounds().use_client_side_arrays_for_stream_buffers
);
1049 EXPECT_FALSE(info_
->feature_flags().native_vertex_array_object
);
1052 TEST_P(FeatureInfoTest
, InitializeEXT_blend_minmax
) {
1053 SetupInitExpectations("GL_EXT_blend_minmax");
1054 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_blend_minmax"));
1055 EXPECT_TRUE(info_
->validators()->equation
.IsValid(GL_MIN_EXT
));
1056 EXPECT_TRUE(info_
->validators()->equation
.IsValid(GL_MAX_EXT
));
1059 TEST_P(FeatureInfoTest
, InitializeEXT_frag_depth
) {
1060 SetupInitExpectations("GL_EXT_frag_depth");
1061 EXPECT_TRUE(info_
->feature_flags().ext_frag_depth
);
1062 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_frag_depth"));
1065 TEST_P(FeatureInfoTest
, InitializeEXT_shader_texture_lod
) {
1066 SetupInitExpectations("GL_EXT_shader_texture_lod");
1067 EXPECT_TRUE(info_
->feature_flags().ext_shader_texture_lod
);
1068 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_shader_texture_lod"));
1071 TEST_P(FeatureInfoTest
, InitializeEXT_discard_framebuffer
) {
1072 SetupInitExpectations("GL_EXT_discard_framebuffer");
1073 EXPECT_TRUE(info_
->feature_flags().ext_discard_framebuffer
);
1074 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1077 TEST_P(FeatureInfoTest
, InitializeSamplersWithARBSamplerObjects
) {
1078 SetupInitExpectationsWithGLVersion(
1079 "GL_ARB_sampler_objects", "", "OpenGL 3.0");
1080 EXPECT_TRUE(info_
->feature_flags().enable_samplers
);
1083 TEST_P(FeatureInfoTest
, InitializeWithES3
) {
1084 SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
1085 EXPECT_TRUE(info_
->feature_flags().chromium_framebuffer_multisample
);
1086 EXPECT_TRUE(info_
->feature_flags().use_core_framebuffer_multisample
);
1087 EXPECT_THAT(info_
->extensions(),
1088 HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
1089 EXPECT_TRUE(info_
->feature_flags().use_async_readpixels
);
1090 EXPECT_TRUE(info_
->feature_flags().oes_standard_derivatives
);
1091 EXPECT_TRUE(info_
->feature_flags().oes_depth24
);
1092 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
1093 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
1095 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_COMPONENT
));
1097 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_STENCIL
));
1098 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_COMPONENT
));
1099 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
1100 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_SHORT
));
1101 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT
));
1102 EXPECT_TRUE(info_
->validators()->pixel_type
.IsValid(GL_UNSIGNED_INT_24_8
));
1103 EXPECT_TRUE(info_
->feature_flags().packed_depth24_stencil8
);
1104 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_OES_depth24"));
1106 info_
->validators()->render_buffer_format
.IsValid(GL_DEPTH_COMPONENT24
));
1108 info_
->validators()->render_buffer_format
.IsValid(GL_DEPTH24_STENCIL8
));
1110 info_
->validators()->texture_internal_format
.IsValid(GL_DEPTH_STENCIL
));
1111 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_DEPTH_STENCIL
));
1112 EXPECT_TRUE(info_
->feature_flags().npot_ok
);
1113 EXPECT_TRUE(info_
->feature_flags().native_vertex_array_object
);
1114 EXPECT_TRUE(info_
->feature_flags().enable_samplers
);
1115 EXPECT_TRUE(info_
->feature_flags().map_buffer_range
);
1116 EXPECT_TRUE(info_
->feature_flags().ext_discard_framebuffer
);
1117 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
1118 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1119 EXPECT_TRUE(gfx::GLFence::IsSupported());
1122 TEST_P(FeatureInfoTest
, InitializeWithoutSamplers
) {
1123 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0");
1124 EXPECT_FALSE(info_
->feature_flags().enable_samplers
);
1127 TEST_P(FeatureInfoTest
, ParseDriverBugWorkaroundsSingle
) {
1128 base::CommandLine
command_line(0, NULL
);
1129 command_line
.AppendSwitchASCII(
1130 switches::kGpuDriverBugWorkarounds
,
1131 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST
));
1132 // Workarounds should get parsed without the need for a context.
1133 SetupWithCommandLine(command_line
);
1134 EXPECT_TRUE(info_
->workarounds().exit_on_context_lost
);
1137 TEST_P(FeatureInfoTest
, ParseDriverBugWorkaroundsMultiple
) {
1138 base::CommandLine
command_line(0, NULL
);
1139 command_line
.AppendSwitchASCII(
1140 switches::kGpuDriverBugWorkarounds
,
1141 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST
) + "," +
1142 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024
) + "," +
1143 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096
));
1144 // Workarounds should get parsed without the need for a context.
1145 SetupWithCommandLine(command_line
);
1146 EXPECT_TRUE(info_
->workarounds().exit_on_context_lost
);
1147 EXPECT_EQ(1024, info_
->workarounds().max_cube_map_texture_size
);
1148 EXPECT_EQ(4096, info_
->workarounds().max_texture_size
);
1151 TEST_P(FeatureInfoTest
, InitializeWithARBSync
) {
1152 SetupInitExpectations("GL_ARB_sync");
1153 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1154 EXPECT_TRUE(gfx::GLFence::IsSupported());
1157 TEST_P(FeatureInfoTest
, InitializeWithNVFence
) {
1158 SetupInitExpectations("GL_NV_fence");
1159 EXPECT_TRUE(info_
->feature_flags().chromium_sync_query
);
1160 EXPECT_TRUE(gfx::GLFence::IsSupported());
1163 TEST_P(FeatureInfoTest
, InitializeWithNVDrawBuffers
) {
1164 SetupInitExpectationsWithGLVersion("GL_NV_draw_buffers", "", "OpenGL ES 3.0");
1165 EXPECT_TRUE(info_
->feature_flags().nv_draw_buffers
);
1166 EXPECT_TRUE(info_
->feature_flags().ext_draw_buffers
);
1169 TEST_P(FeatureInfoTest
, InitializeWithPreferredEXTDrawBuffers
) {
1170 SetupInitExpectationsWithGLVersion(
1171 "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0");
1172 EXPECT_FALSE(info_
->feature_flags().nv_draw_buffers
);
1173 EXPECT_TRUE(info_
->feature_flags().ext_draw_buffers
);
1176 TEST_P(FeatureInfoTest
, ARBSyncDisabled
) {
1177 base::CommandLine
command_line(0, NULL
);
1178 command_line
.AppendSwitchASCII(
1179 switches::kGpuDriverBugWorkarounds
,
1180 base::IntToString(gpu::DISABLE_ARB_SYNC
));
1181 SetupInitExpectationsWithCommandLine("GL_ARB_sync", command_line
);
1182 EXPECT_FALSE(info_
->feature_flags().chromium_sync_query
);
1183 EXPECT_FALSE(gfx::GLFence::IsSupported());
1186 TEST_P(FeatureInfoTest
, BlendEquationAdvancedDisabled
) {
1187 base::CommandLine
command_line(0, NULL
);
1188 command_line
.AppendSwitchASCII(
1189 switches::kGpuDriverBugWorkarounds
,
1190 base::IntToString(gpu::DISABLE_BLEND_EQUATION_ADVANCED
));
1191 SetupInitExpectationsWithCommandLine(
1192 "GL_KHR_blend_equation_advanced_coherent GL_KHR_blend_equation_advanced",
1194 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced
);
1195 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced_coherent
);
1198 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering
) {
1199 SetupInitExpectationsWithGLVersion(
1200 "GL_ARB_compatibility GL_NV_path_rendering GL_EXT_direct_state_access",
1202 EXPECT_TRUE(info_
->feature_flags().chromium_path_rendering
);
1203 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1206 TEST_P(FeatureInfoTest
, InitializeCHROMIUM_path_rendering2
) {
1207 SetupInitExpectationsWithGLVersion(
1208 "GL_NV_path_rendering", "", "OpenGL ES 3.1");
1209 EXPECT_TRUE(info_
->feature_flags().chromium_path_rendering
);
1210 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_CHROMIUM_path_rendering"));
1213 TEST_P(FeatureInfoTest
, InitializeNoCHROMIUM_path_rendering
) {
1214 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility", "", "4.3");
1215 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1216 EXPECT_THAT(info_
->extensions(),
1217 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1220 TEST_P(FeatureInfoTest
, InitializeNoCHROMIUM_path_rendering2
) {
1221 SetupInitExpectationsWithGLVersion(
1222 "GL_ARB_compatibility GL_NV_path_rendering", "", "4.3");
1223 EXPECT_FALSE(info_
->feature_flags().chromium_path_rendering
);
1224 EXPECT_THAT(info_
->extensions(),
1225 Not(HasSubstr("GL_CHROMIUM_path_rendering")));
1228 TEST_P(FeatureInfoTest
, InitializeNoKHR_blend_equation_advanced
) {
1229 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility", "", "4.3");
1230 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced
);
1231 EXPECT_THAT(info_
->extensions(),
1232 Not(HasSubstr("GL_KHR_blend_equation_advanced")));
1235 TEST_P(FeatureInfoTest
, InitializeKHR_blend_equations_advanced
) {
1236 SetupInitExpectations("GL_KHR_blend_equation_advanced");
1237 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1238 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1241 TEST_P(FeatureInfoTest
, InitializeNV_blend_equations_advanced
) {
1242 SetupInitExpectations("GL_NV_blend_equation_advanced");
1243 EXPECT_THAT(info_
->extensions(), HasSubstr("GL_KHR_blend_equation_advanced"));
1244 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1247 TEST_P(FeatureInfoTest
, InitializeNoKHR_blend_equation_advanced_coherent
) {
1248 SetupInitExpectationsWithGLVersion("GL_ARB_compatibility ", "", "4.3");
1249 EXPECT_FALSE(info_
->feature_flags().blend_equation_advanced_coherent
);
1250 EXPECT_THAT(info_
->extensions(),
1251 Not(HasSubstr("GL_KHR_blend_equation_advanced_coherent")));
1254 TEST_P(FeatureInfoTest
, InitializeKHR_blend_equations_advanced_coherent
) {
1255 SetupInitExpectations("GL_KHR_blend_equation_advanced_coherent");
1256 EXPECT_THAT(info_
->extensions(),
1257 HasSubstr("GL_KHR_blend_equation_advanced_coherent"));
1258 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced
);
1259 EXPECT_TRUE(info_
->feature_flags().blend_equation_advanced_coherent
);
1262 TEST_P(FeatureInfoTest
, InitializeEXT_texture_rgWithFloat
) {
1263 SetupInitExpectations(
1264 "GL_EXT_texture_rg GL_OES_texture_float GL_OES_texture_half_float");
1265 EXPECT_TRUE(info_
->feature_flags().ext_texture_rg
);
1267 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RED_EXT
));
1268 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RG_EXT
));
1269 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RED_EXT
));
1270 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RG_EXT
));
1271 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RED_EXT
));
1272 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RG_EXT
));
1273 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_R8_EXT
));
1274 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_RG8_EXT
));
1277 TEST_P(FeatureInfoTest
, InitializeARB_texture_rgNoFloat
) {
1278 SetupInitExpectations("GL_ARB_texture_rg");
1279 EXPECT_TRUE(info_
->feature_flags().ext_texture_rg
);
1281 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RED_EXT
));
1282 EXPECT_TRUE(info_
->validators()->texture_format
.IsValid(GL_RG_EXT
));
1283 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RED_EXT
));
1284 EXPECT_TRUE(info_
->validators()->texture_internal_format
.IsValid(GL_RG_EXT
));
1285 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RED_EXT
));
1286 EXPECT_TRUE(info_
->validators()->read_pixel_format
.IsValid(GL_RG_EXT
));
1287 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_R8_EXT
));
1288 EXPECT_TRUE(info_
->validators()->render_buffer_format
.IsValid(GL_RG8_EXT
));
1291 } // namespace gles2