OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/feature_info.h" | 5 #include "gpu/command_buffer/service/feature_info.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "gpu/command_buffer/service/gpu_service_test.h" | 10 #include "gpu/command_buffer/service/gpu_service_test.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 break; | 69 break; |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void SetupInitExpectationsWithGLVersion( | 73 void SetupInitExpectationsWithGLVersion( |
74 const char* extensions, const char* renderer, const char* version) { | 74 const char* extensions, const char* renderer, const char* version) { |
75 GpuServiceTest::SetUpWithGLVersion(version, extensions); | 75 GpuServiceTest::SetUpWithGLVersion(version, extensions); |
76 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 76 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
77 gl_.get(), extensions, renderer, version); | 77 gl_.get(), extensions, renderer, version); |
78 info_ = new FeatureInfo(); | 78 info_ = new FeatureInfo(); |
79 info_->Initialize(); | 79 info_->InitializeForTesting(); |
80 } | 80 } |
81 | 81 |
82 void SetupInitExpectationsWithGLVersionAndCommandLine( | 82 void SetupInitExpectationsWithGLVersionAndCommandLine( |
83 const char* extensions, | 83 const char* extensions, |
84 const char* renderer, | 84 const char* renderer, |
85 const char* version, | 85 const char* version, |
86 const base::CommandLine& command_line) { | 86 const base::CommandLine& command_line) { |
87 GpuServiceTest::SetUpWithGLVersion(version, extensions); | 87 GpuServiceTest::SetUpWithGLVersion(version, extensions); |
88 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 88 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
89 gl_.get(), extensions, renderer, version); | 89 gl_.get(), extensions, renderer, version); |
90 info_ = new FeatureInfo(command_line); | 90 info_ = new FeatureInfo(command_line); |
91 info_->Initialize(); | 91 info_->InitializeForTesting(); |
| 92 } |
| 93 |
| 94 void SetupInitExpectationsWithGLVersionAndContextTypeAndCommandLine( |
| 95 const char* extensions, |
| 96 const char* renderer, |
| 97 const char* version, |
| 98 ContextType context_type, |
| 99 const base::CommandLine& command_line) { |
| 100 GpuServiceTest::SetUpWithGLVersion(version, extensions); |
| 101 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 102 gl_.get(), extensions, renderer, version); |
| 103 info_ = new FeatureInfo(command_line); |
| 104 info_->Initialize(context_type, DisallowedFeatures()); |
92 } | 105 } |
93 | 106 |
94 void SetupWithCommandLine(const base::CommandLine& command_line) { | 107 void SetupWithCommandLine(const base::CommandLine& command_line) { |
95 GpuServiceTest::SetUp(); | 108 GpuServiceTest::SetUp(); |
96 info_ = new FeatureInfo(command_line); | 109 info_ = new FeatureInfo(command_line); |
97 } | 110 } |
98 | 111 |
99 void SetupInitExpectationsWithCommandLine( | 112 void SetupInitExpectationsWithCommandLine( |
100 const char* extensions, | 113 const char* extensions, |
101 const base::CommandLine& command_line) { | 114 const base::CommandLine& command_line) { |
102 GpuServiceTest::SetUpWithGLVersion("2.0", extensions); | 115 GpuServiceTest::SetUpWithGLVersion("2.0", extensions); |
103 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 116 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
104 gl_.get(), extensions, "", ""); | 117 gl_.get(), extensions, "", ""); |
105 info_ = new FeatureInfo(command_line); | 118 info_ = new FeatureInfo(command_line); |
106 info_->Initialize(); | 119 info_->InitializeForTesting(); |
107 } | 120 } |
108 | 121 |
109 void SetupWithoutInit() { | 122 void SetupWithoutInit() { |
110 GpuServiceTest::SetUp(); | 123 GpuServiceTest::SetUp(); |
111 info_ = new FeatureInfo(); | 124 info_ = new FeatureInfo(); |
112 } | 125 } |
113 | 126 |
114 protected: | 127 protected: |
115 void SetUp() override { | 128 void SetUp() override { |
116 // Do nothing here, since we are using the explicit Setup*() functions. | 129 // Do nothing here, since we are using the explicit Setup*() functions. |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(GL_RG_EXT)); | 1375 EXPECT_TRUE(info_->validators()->read_pixel_format.IsValid(GL_RG_EXT)); |
1363 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_R8_EXT)); | 1376 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_R8_EXT)); |
1364 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_RG8_EXT)); | 1377 EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_RG8_EXT)); |
1365 } | 1378 } |
1366 | 1379 |
1367 TEST_P(FeatureInfoTest, InitializeCHROMIUM_ycbcr_422_imageTrue) { | 1380 TEST_P(FeatureInfoTest, InitializeCHROMIUM_ycbcr_422_imageTrue) { |
1368 SetupInitExpectations("GL_APPLE_ycbcr_422"); | 1381 SetupInitExpectations("GL_APPLE_ycbcr_422"); |
1369 EXPECT_TRUE(info_->feature_flags().chromium_image_ycbcr_422); | 1382 EXPECT_TRUE(info_->feature_flags().chromium_image_ycbcr_422); |
1370 } | 1383 } |
1371 | 1384 |
| 1385 TEST_P(FeatureInfoTest, DisableMsaaOnNonWebGLContexts) { |
| 1386 base::CommandLine command_line(0, NULL); |
| 1387 command_line.AppendSwitchASCII( |
| 1388 switches::kGpuDriverBugWorkarounds, |
| 1389 base::IntToString(gpu::DISABLE_MSAA_ON_NON_WEBGL_CONTEXTS)); |
| 1390 SetupInitExpectationsWithGLVersionAndContextTypeAndCommandLine( |
| 1391 "GL_EXT_multisampled_render_to_texture GL_EXT_framebuffer_multisample", |
| 1392 "", "", CONTEXT_TYPE_OPENGLES2, command_line); |
| 1393 EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture); |
| 1394 EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample); |
| 1395 } |
| 1396 |
| 1397 TEST_P(FeatureInfoTest, DontDisableMsaaOnWebGLContexts) { |
| 1398 base::CommandLine command_line(0, NULL); |
| 1399 command_line.AppendSwitchASCII( |
| 1400 switches::kGpuDriverBugWorkarounds, |
| 1401 base::IntToString(gpu::DISABLE_MSAA_ON_NON_WEBGL_CONTEXTS)); |
| 1402 SetupInitExpectationsWithGLVersionAndContextTypeAndCommandLine( |
| 1403 "GL_EXT_multisampled_render_to_texture GL_EXT_framebuffer_multisample", |
| 1404 "", "", CONTEXT_TYPE_WEBGL1, command_line); |
| 1405 EXPECT_TRUE(info_->feature_flags().multisampled_render_to_texture); |
| 1406 EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample); |
| 1407 } |
| 1408 |
1372 } // namespace gles2 | 1409 } // namespace gles2 |
1373 } // namespace gpu | 1410 } // namespace gpu |
OLD | NEW |