Chromium Code Reviews| 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" |
| 11 #include "gpu/command_buffer/service/gpu_switches.h" | 11 #include "gpu/command_buffer/service/gpu_switches.h" |
| 12 #include "gpu/command_buffer/service/test_helper.h" | 12 #include "gpu/command_buffer/service/test_helper.h" |
| 13 #include "gpu/command_buffer/service/texture_manager.h" | 13 #include "gpu/command_buffer/service/texture_manager.h" |
| 14 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 14 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/gl/gl_fence.h" | |
| 16 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
| 17 #include "ui/gl/gl_mock.h" | 18 #include "ui/gl/gl_mock.h" |
| 18 | 19 |
| 19 using ::testing::_; | 20 using ::testing::_; |
| 20 using ::testing::DoAll; | 21 using ::testing::DoAll; |
| 21 using ::testing::HasSubstr; | 22 using ::testing::HasSubstr; |
| 22 using ::testing::InSequence; | 23 using ::testing::InSequence; |
| 23 using ::testing::MatcherCast; | 24 using ::testing::MatcherCast; |
| 24 using ::testing::Not; | 25 using ::testing::Not; |
| 25 using ::testing::Pointee; | 26 using ::testing::Pointee; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 EXPECT_FALSE(info_->validators()->texture_parameter.IsValid( | 304 EXPECT_FALSE(info_->validators()->texture_parameter.IsValid( |
| 304 GL_TEXTURE_USAGE_ANGLE)); | 305 GL_TEXTURE_USAGE_ANGLE)); |
| 305 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid( | 306 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid( |
| 306 GL_DEPTH_COMPONENT16)); | 307 GL_DEPTH_COMPONENT16)); |
| 307 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid( | 308 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid( |
| 308 GL_DEPTH_COMPONENT32_OES)); | 309 GL_DEPTH_COMPONENT32_OES)); |
| 309 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid( | 310 EXPECT_FALSE(info_->validators()->texture_internal_format_storage.IsValid( |
| 310 GL_DEPTH24_STENCIL8_OES)); | 311 GL_DEPTH24_STENCIL8_OES)); |
| 311 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MIN_EXT)); | 312 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MIN_EXT)); |
| 312 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MAX_EXT)); | 313 EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MAX_EXT)); |
| 314 EXPECT_FALSE(info_->feature_flags().chromium_sync_query); | |
| 313 } | 315 } |
| 314 | 316 |
| 315 TEST_F(FeatureInfoTest, InitializeWithANGLE) { | 317 TEST_F(FeatureInfoTest, InitializeWithANGLE) { |
| 316 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE, ""); | 318 SetupInitExpectationsWithGLVersion("", kGLRendererStringANGLE, ""); |
| 317 EXPECT_TRUE(info_->feature_flags().is_angle); | 319 EXPECT_TRUE(info_->feature_flags().is_angle); |
| 318 } | 320 } |
| 319 | 321 |
| 320 TEST_F(FeatureInfoTest, InitializeNPOTExtensionGLES) { | 322 TEST_F(FeatureInfoTest, InitializeNPOTExtensionGLES) { |
| 321 SetupInitExpectations("GL_OES_texture_npot"); | 323 SetupInitExpectations("GL_OES_texture_npot"); |
| 322 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot")); | 324 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot")); |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 .IsValid(GL_UNSIGNED_INT_24_8)); | 1002 .IsValid(GL_UNSIGNED_INT_24_8)); |
| 1001 EXPECT_TRUE(info_->feature_flags().packed_depth24_stencil8); | 1003 EXPECT_TRUE(info_->feature_flags().packed_depth24_stencil8); |
| 1002 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24")); | 1004 EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24")); |
| 1003 EXPECT_TRUE( | 1005 EXPECT_TRUE( |
| 1004 info_->validators()->render_buffer_format.IsValid(GL_DEPTH_COMPONENT24)); | 1006 info_->validators()->render_buffer_format.IsValid(GL_DEPTH_COMPONENT24)); |
| 1005 EXPECT_TRUE( | 1007 EXPECT_TRUE( |
| 1006 info_->validators()->render_buffer_format.IsValid(GL_DEPTH24_STENCIL8)); | 1008 info_->validators()->render_buffer_format.IsValid(GL_DEPTH24_STENCIL8)); |
| 1007 EXPECT_TRUE( | 1009 EXPECT_TRUE( |
| 1008 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL)); | 1010 info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL)); |
| 1009 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL)); | 1011 EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL)); |
| 1012 EXPECT_TRUE(info_->feature_flags().chromium_sync_query); | |
| 1013 EXPECT_TRUE(gfx::GLFence::IsSupported()); | |
| 1010 } | 1014 } |
| 1011 | 1015 |
| 1012 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { | 1016 TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { |
| 1013 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0"); | 1017 SetupInitExpectationsWithGLVersion("", "", "OpenGL GL 3.0"); |
| 1014 EXPECT_FALSE(info_->feature_flags().enable_samplers); | 1018 EXPECT_FALSE(info_->feature_flags().enable_samplers); |
| 1015 } | 1019 } |
| 1016 | 1020 |
| 1017 TEST_F(FeatureInfoTest, InitializeWithES3AndFences) { | |
| 1018 SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "", "OpenGL ES 3.0"); | |
| 1019 EXPECT_TRUE(info_->feature_flags().use_async_readpixels); | |
|
no sievers
2014/06/16 22:43:54
This test is bad. EGL_KHR_fence_sync is not a GL e
| |
| 1020 } | |
| 1021 | |
| 1022 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) { | 1021 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) { |
| 1023 CommandLine command_line(0, NULL); | 1022 CommandLine command_line(0, NULL); |
| 1024 command_line.AppendSwitchASCII( | 1023 command_line.AppendSwitchASCII( |
| 1025 switches::kGpuDriverBugWorkarounds, | 1024 switches::kGpuDriverBugWorkarounds, |
| 1026 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST)); | 1025 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST)); |
| 1027 // Workarounds should get parsed without the need for a context. | 1026 // Workarounds should get parsed without the need for a context. |
| 1028 SetupWithCommandLine(command_line); | 1027 SetupWithCommandLine(command_line); |
| 1029 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); | 1028 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); |
| 1030 } | 1029 } |
| 1031 | 1030 |
| 1032 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) { | 1031 TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) { |
| 1033 CommandLine command_line(0, NULL); | 1032 CommandLine command_line(0, NULL); |
| 1034 command_line.AppendSwitchASCII( | 1033 command_line.AppendSwitchASCII( |
| 1035 switches::kGpuDriverBugWorkarounds, | 1034 switches::kGpuDriverBugWorkarounds, |
| 1036 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," + | 1035 base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," + |
| 1037 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," + | 1036 base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," + |
| 1038 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); | 1037 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); |
| 1039 // Workarounds should get parsed without the need for a context. | 1038 // Workarounds should get parsed without the need for a context. |
| 1040 SetupWithCommandLine(command_line); | 1039 SetupWithCommandLine(command_line); |
| 1041 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); | 1040 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); |
| 1042 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); | 1041 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); |
| 1043 EXPECT_EQ(4096, info_->workarounds().max_texture_size); | 1042 EXPECT_EQ(4096, info_->workarounds().max_texture_size); |
| 1044 } | 1043 } |
| 1045 | 1044 |
| 1045 TEST_F(FeatureInfoTest, InitializeWithARBSync) { | |
| 1046 SetupInitExpectations("GL_ARB_sync"); | |
| 1047 EXPECT_TRUE(info_->feature_flags().chromium_sync_query); | |
| 1048 EXPECT_TRUE(gfx::GLFence::IsSupported()); | |
| 1049 } | |
| 1050 | |
| 1051 TEST_F(FeatureInfoTest, InitializeWithNVFence) { | |
| 1052 SetupInitExpectations("GL_NV_fence"); | |
| 1053 EXPECT_TRUE(info_->feature_flags().chromium_sync_query); | |
| 1054 EXPECT_TRUE(gfx::GLFence::IsSupported()); | |
| 1055 } | |
| 1056 | |
| 1057 TEST_F(FeatureInfoTest, ARBSyncDisabled) { | |
| 1058 CommandLine command_line(0, NULL); | |
| 1059 command_line.AppendSwitchASCII( | |
| 1060 switches::kGpuDriverBugWorkarounds, | |
| 1061 base::IntToString(gpu::DISABLE_ARB_SYNC)); | |
| 1062 SetupInitExpectationsWithCommandLine("GL_ARB_sync", command_line); | |
| 1063 EXPECT_FALSE(info_->feature_flags().chromium_sync_query); | |
| 1064 EXPECT_FALSE(gfx::GLFence::IsSupported()); | |
| 1065 } | |
| 1066 | |
| 1046 } // namespace gles2 | 1067 } // namespace gles2 |
| 1047 } // namespace gpu | 1068 } // namespace gpu |
| OLD | NEW |