OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <cmath> | 6 #include <cmath> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
11 #include <GLES2/gl2ext.h> | 11 #include <GLES2/gl2ext.h> |
12 #include <GLES2/gl2extchromium.h> | 12 #include <GLES2/gl2extchromium.h> |
13 | 13 |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/debug/trace_event.h" | 17 #include "base/debug/trace_event.h" |
18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
19 #include "base/json/json_reader.h" | 19 #include "base/json/json_reader.h" |
20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
21 #include "base/run_loop.h" | 21 #include "base/run_loop.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "content/common/gpu/client/gl_helper.h" | 25 #include "content/common/gpu/client/gl_helper.h" |
| 26 #include "content/common/gpu/client/gl_helper_readback_support.h" |
26 #include "content/common/gpu/client/gl_helper_scaling.h" | 27 #include "content/common/gpu/client/gl_helper_scaling.h" |
27 #include "content/public/test/unittest_test_suite.h" | 28 #include "content/public/test/unittest_test_suite.h" |
28 #include "content/test/content_test_suite.h" | 29 #include "content/test/content_test_suite.h" |
29 #include "gpu/config/gpu_util.h" | 30 #include "gpu/config/gpu_util.h" |
30 #include "media/base/video_frame.h" | 31 #include "media/base/video_frame.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
32 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
33 #include "third_party/skia/include/core/SkTypes.h" | 34 #include "third_party/skia/include/core/SkTypes.h" |
34 #include "ui/gl/gl_implementation.h" | 35 #include "ui/gl/gl_implementation.h" |
35 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 36 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 gfx::Rect(src_size), | 995 gfx::Rect(src_size), |
995 pixels, | 996 pixels, |
996 bitmap_config); | 997 bitmap_config); |
997 } | 998 } |
998 } | 999 } |
999 | 1000 |
1000 // Test basic format readback. | 1001 // Test basic format readback. |
1001 bool TestTextureFormatReadback(const gfx::Size& src_size, | 1002 bool TestTextureFormatReadback(const gfx::Size& src_size, |
1002 SkBitmap::Config bitmap_config, | 1003 SkBitmap::Config bitmap_config, |
1003 bool async) { | 1004 bool async) { |
1004 DCHECK((bitmap_config == SkBitmap::kRGB_565_Config) || | 1005 if (!helper_->IsReadbackConfigSupported(bitmap_config)) { |
1005 (bitmap_config == SkBitmap::kARGB_8888_Config)); | 1006 LOG(INFO) << "Skipping test format not supported" << bitmap_config; |
1006 bool rgb565_format = (bitmap_config == SkBitmap::kRGB_565_Config); | |
1007 if (rgb565_format && !helper_->CanUseRgb565Readback()) { | |
1008 LOG(INFO) << "RGB565 Format Not supported on this platform"; | |
1009 LOG(INFO) << "Skipping RGB565ReadBackTest"; | |
1010 return true; | 1007 return true; |
1011 } | 1008 } |
1012 WebGLId src_texture = context_->createTexture(); | 1009 WebGLId src_texture = context_->createTexture(); |
1013 SkBitmap input_pixels; | 1010 SkBitmap input_pixels; |
1014 input_pixels.setConfig(bitmap_config, src_size.width(), | 1011 input_pixels.setConfig(bitmap_config, src_size.width(), |
1015 src_size.height()); | 1012 src_size.height()); |
1016 input_pixels.allocPixels(); | 1013 input_pixels.allocPixels(); |
1017 SkAutoLockPixels lock1(input_pixels); | 1014 SkAutoLockPixels lock1(input_pixels); |
1018 // Test Pattern-1, Fill with Plain color pattern. | 1015 // Test Pattern-1, Fill with Plain color pattern. |
1019 // Erase the input bitmap with red color. | 1016 // Erase the input bitmap with red color. |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 #endif | 1672 #endif |
1676 #if defined(TOOLKIT_GTK) | 1673 #if defined(TOOLKIT_GTK) |
1677 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 1674 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
1678 #endif | 1675 #endif |
1679 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); | 1676 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); |
1680 | 1677 |
1681 content::UnitTestTestSuite runner(suite); | 1678 content::UnitTestTestSuite runner(suite); |
1682 base::MessageLoop message_loop; | 1679 base::MessageLoop message_loop; |
1683 return runner.Run(); | 1680 return runner.Run(); |
1684 } | 1681 } |
OLD | NEW |