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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 void SetupInitExpectationsWithGLVersion( | 48 void SetupInitExpectationsWithGLVersion( |
49 const char* extensions, const char* renderer, const char* version) { | 49 const char* extensions, const char* renderer, const char* version) { |
50 GpuServiceTest::SetUpWithGLVersion(version, extensions); | 50 GpuServiceTest::SetUpWithGLVersion(version, extensions); |
51 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 51 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
52 gl_.get(), extensions, renderer, version); | 52 gl_.get(), extensions, renderer, version); |
53 info_ = new FeatureInfo(); | 53 info_ = new FeatureInfo(); |
54 info_->Initialize(); | 54 info_->Initialize(); |
55 } | 55 } |
56 | 56 |
57 void SetupWithCommandLine(const CommandLine& command_line) { | 57 void SetupWithCommandLine(const base::CommandLine& command_line) { |
58 GpuServiceTest::SetUp(); | 58 GpuServiceTest::SetUp(); |
59 info_ = new FeatureInfo(command_line); | 59 info_ = new FeatureInfo(command_line); |
60 } | 60 } |
61 | 61 |
62 void SetupInitExpectationsWithCommandLine( | 62 void SetupInitExpectationsWithCommandLine( |
63 const char* extensions, const CommandLine& command_line) { | 63 const char* extensions, |
| 64 const base::CommandLine& command_line) { |
64 GpuServiceTest::SetUpWithGLVersion("2.0", extensions); | 65 GpuServiceTest::SetUpWithGLVersion("2.0", extensions); |
65 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 66 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
66 gl_.get(), extensions, "", ""); | 67 gl_.get(), extensions, "", ""); |
67 info_ = new FeatureInfo(command_line); | 68 info_ = new FeatureInfo(command_line); |
68 info_->Initialize(); | 69 info_->Initialize(); |
69 } | 70 } |
70 | 71 |
71 void SetupWithoutInit() { | 72 void SetupWithoutInit() { |
72 GpuServiceTest::SetUp(); | 73 GpuServiceTest::SetUp(); |
73 info_ = new FeatureInfo(); | 74 info_ = new FeatureInfo(); |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 } | 1204 } |
1204 | 1205 |
1205 TEST_F(FeatureInfoTest, InitializeOES_element_index_uint) { | 1206 TEST_F(FeatureInfoTest, InitializeOES_element_index_uint) { |
1206 SetupInitExpectations("GL_OES_element_index_uint"); | 1207 SetupInitExpectations("GL_OES_element_index_uint"); |
1207 EXPECT_THAT(info_->extensions(), | 1208 EXPECT_THAT(info_->extensions(), |
1208 HasSubstr("GL_OES_element_index_uint")); | 1209 HasSubstr("GL_OES_element_index_uint")); |
1209 EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT)); | 1210 EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT)); |
1210 } | 1211 } |
1211 | 1212 |
1212 TEST_F(FeatureInfoTest, InitializeVAOsWithClientSideArrays) { | 1213 TEST_F(FeatureInfoTest, InitializeVAOsWithClientSideArrays) { |
1213 CommandLine command_line(0, NULL); | 1214 base::CommandLine command_line(0, NULL); |
1214 command_line.AppendSwitchASCII( | 1215 command_line.AppendSwitchASCII( |
1215 switches::kGpuDriverBugWorkarounds, | 1216 switches::kGpuDriverBugWorkarounds, |
1216 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); | 1217 base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); |
1217 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object", | 1218 SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object", |
1218 command_line); | 1219 command_line); |
1219 EXPECT_TRUE(info_->workarounds().use_client_side_arrays_for_stream_buffers); | 1220 EXPECT_TRUE(info_->workarounds().use_client_side_arrays_for_stream_buffers); |
1220 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object); | 1221 EXPECT_FALSE(info_->feature_flags().native_vertex_array_object); |
1221 } | 1222 } |
1222 | 1223 |
1223 TEST_F(FeatureInfoTest, InitializeEXT_blend_minmax) { | 1224 TEST_F(FeatureInfoTest, InitializeEXT_blend_minmax) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 EXPECT_TRUE(info_->feature_flags().chromium_sync_query); | 1296 EXPECT_TRUE(info_->feature_flags().chromium_sync_query); |
1296 EXPECT_TRUE(gfx::GLFence::IsSupported()); | 1297 EXPECT_TRUE(gfx::GLFence::IsSupported()); |
1297 } | 1298 } |
1298 | 1299 |
1299 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { | 1300 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { |
1300 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0"); | 1301 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0"); |
1301 EXPECT_FALSE(info_->feature_flags().enable_samplers); | 1302 EXPECT_FALSE(info_->feature_flags().enable_samplers); |
1302 } | 1303 } |
1303 | 1304 |
1304 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) { | 1305 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) { |
1305 CommandLine command_line(0, NULL); | 1306 base::CommandLine command_line(0, NULL); |
1306 command_line.AppendSwitchASCII( | 1307 command_line.AppendSwitchASCII( |
1307 switches::kGpuDriverBugWorkarounds, | 1308 switches::kGpuDriverBugWorkarounds, |
1308 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST)); | 1309 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST)); |
1309 // Workarounds should get parsed without the need for a context. | 1310 // Workarounds should get parsed without the need for a context. |
1310 SetupWithCommandLine(command_line); | 1311 SetupWithCommandLine(command_line); |
1311 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); | 1312 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); |
1312 } | 1313 } |
1313 | 1314 |
1314 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) { | 1315 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) { |
1315 CommandLine command_line(0, NULL); | 1316 base::CommandLine command_line(0, NULL); |
1316 command_line.AppendSwitchASCII( | 1317 command_line.AppendSwitchASCII( |
1317 switches::kGpuDriverBugWorkarounds, | 1318 switches::kGpuDriverBugWorkarounds, |
1318 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," + | 1319 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," + |
1319 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," + | 1320 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," + |
1320 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); | 1321 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); |
1321 // Workarounds should get parsed without the need for a context. | 1322 // Workarounds should get parsed without the need for a context. |
1322 SetupWithCommandLine(command_line); | 1323 SetupWithCommandLine(command_line); |
1323 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); | 1324 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); |
1324 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); | 1325 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); |
1325 EXPECT_EQ(4096, info_->workarounds().max_texture_size); | 1326 EXPECT_EQ(4096, info_->workarounds().max_texture_size); |
(...skipping 18 matching lines...) Expand all Loading... |
1344 } | 1345 } |
1345 | 1346 |
1346 TEST_F(FeatureInfoTest, InitializeWithPreferredEXTDrawBuffers) { | 1347 TEST_F(FeatureInfoTest, InitializeWithPreferredEXTDrawBuffers) { |
1347 SetupInitExpectationsWithGLVersion( | 1348 SetupInitExpectationsWithGLVersion( |
1348 "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0"); | 1349 "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0"); |
1349 EXPECT_FALSE(info_->feature_flags().nv_draw_buffers); | 1350 EXPECT_FALSE(info_->feature_flags().nv_draw_buffers); |
1350 EXPECT_TRUE(info_->feature_flags().ext_draw_buffers); | 1351 EXPECT_TRUE(info_->feature_flags().ext_draw_buffers); |
1351 } | 1352 } |
1352 | 1353 |
1353 TEST_F(FeatureInfoTest, ARBSyncDisabled) { | 1354 TEST_F(FeatureInfoTest, ARBSyncDisabled) { |
1354 CommandLine command_line(0, NULL); | 1355 base::CommandLine command_line(0, NULL); |
1355 command_line.AppendSwitchASCII( | 1356 command_line.AppendSwitchASCII( |
1356 switches::kGpuDriverBugWorkarounds, | 1357 switches::kGpuDriverBugWorkarounds, |
1357 base::IntToString(gpu::DISABLE_ARB_SYNC)); | 1358 base::IntToString(gpu::DISABLE_ARB_SYNC)); |
1358 SetupInitExpectationsWithCommandLine("GL_ARB_sync", command_line); | 1359 SetupInitExpectationsWithCommandLine("GL_ARB_sync", command_line); |
1359 EXPECT_FALSE(info_->feature_flags().chromium_sync_query); | 1360 EXPECT_FALSE(info_->feature_flags().chromium_sync_query); |
1360 EXPECT_FALSE(gfx::GLFence::IsSupported()); | 1361 EXPECT_FALSE(gfx::GLFence::IsSupported()); |
1361 } | 1362 } |
1362 | 1363 |
1363 TEST_F(FeatureInfoTest, InitializeCHROMIUM_path_rendering) { | 1364 TEST_F(FeatureInfoTest, InitializeCHROMIUM_path_rendering) { |
1364 SetupInitExpectationsWithGLVersion( | 1365 SetupInitExpectationsWithGLVersion( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 EXPECT_FALSE( | 1470 EXPECT_FALSE( |
1470 info_->GetTextureFormatValidator(GL_RG_EXT).IsValid(GL_HALF_FLOAT_OES)); | 1471 info_->GetTextureFormatValidator(GL_RG_EXT).IsValid(GL_HALF_FLOAT_OES)); |
1471 EXPECT_TRUE( | 1472 EXPECT_TRUE( |
1472 info_->GetTextureFormatValidator(GL_RED_EXT).IsValid(GL_UNSIGNED_BYTE)); | 1473 info_->GetTextureFormatValidator(GL_RED_EXT).IsValid(GL_UNSIGNED_BYTE)); |
1473 EXPECT_TRUE( | 1474 EXPECT_TRUE( |
1474 info_->GetTextureFormatValidator(GL_RG_EXT).IsValid(GL_UNSIGNED_BYTE)); | 1475 info_->GetTextureFormatValidator(GL_RG_EXT).IsValid(GL_UNSIGNED_BYTE)); |
1475 } | 1476 } |
1476 | 1477 |
1477 } // namespace gles2 | 1478 } // namespace gles2 |
1478 } // namespace gpu | 1479 } // namespace gpu |
OLD | NEW |