OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/small_map.h" | 12 #include "base/containers/small_map.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "gpu/perftests/measurements.h" | 16 #include "gpu/perftests/measurements.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "testing/perf/perf_test.h" | 19 #include "testing/perf/perf_test.h" |
20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
21 #include "ui/gfx/geometry/vector2d_f.h" | 21 #include "ui/gfx/geometry/vector2d_f.h" |
22 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
23 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
24 #include "ui/gl/gl_enums.h" | 24 #include "ui/gl/gl_enums.h" |
25 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
26 #include "ui/gl/gl_version_info.h" | 26 #include "ui/gl/gl_version_info.h" |
27 #include "ui/gl/gpu_timing.h" | 27 #include "ui/gl/gpu_timing.h" |
| 28 #include "ui/gl/init/gl_factory.h" |
28 #include "ui/gl/scoped_make_current.h" | 29 #include "ui/gl/scoped_make_current.h" |
29 | 30 |
30 #if defined(USE_OZONE) | 31 #if defined(USE_OZONE) |
31 #include "base/message_loop/message_loop.h" | 32 #include "base/message_loop/message_loop.h" |
32 #endif | 33 #endif |
33 | 34 |
34 namespace gpu { | 35 namespace gpu { |
35 namespace { | 36 namespace { |
36 | 37 |
37 const int kUploadPerfWarmupRuns = 5; | 38 const int kUploadPerfWarmupRuns = 5; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 public: | 177 public: |
177 TextureUploadPerfTest() : fbo_size_(1024, 1024) {} | 178 TextureUploadPerfTest() : fbo_size_(1024, 1024) {} |
178 | 179 |
179 // Overridden from testing::Test | 180 // Overridden from testing::Test |
180 void SetUp() override { | 181 void SetUp() override { |
181 #if defined(USE_OZONE) | 182 #if defined(USE_OZONE) |
182 // On Ozone, the backend initializes the event system using a UI | 183 // On Ozone, the backend initializes the event system using a UI |
183 // thread. | 184 // thread. |
184 base::MessageLoopForUI main_loop; | 185 base::MessageLoopForUI main_loop; |
185 #endif | 186 #endif |
186 static bool gl_initialized = gfx::GLSurface::InitializeOneOff(); | 187 static bool gl_initialized = gl::init::InitializeGLOneOff(); |
187 DCHECK(gl_initialized); | 188 DCHECK(gl_initialized); |
188 // Initialize an offscreen surface and a gl context. | 189 // Initialize an offscreen surface and a gl context. |
189 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 190 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); |
190 gl_context_ = gfx::GLContext::CreateGLContext(NULL, // share_group | 191 gl_context_ = |
191 surface_.get(), | 192 gl::init::CreateGLContext(nullptr, // share_group |
192 gfx::PreferIntegratedGpu); | 193 surface_.get(), gfx::PreferIntegratedGpu); |
193 ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get()); | 194 ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get()); |
194 glGenTextures(1, &color_texture_); | 195 glGenTextures(1, &color_texture_); |
195 glBindTexture(GL_TEXTURE_2D, color_texture_); | 196 glBindTexture(GL_TEXTURE_2D, color_texture_); |
196 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 200 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
200 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fbo_size_.width(), | 201 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fbo_size_.width(), |
201 fbo_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); | 202 fbo_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); |
202 | 203 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 gpu_timing_client_->CheckAndResetTimerErrors(); | 551 gpu_timing_client_->CheckAndResetTimerErrors(); |
551 if (!gpu_timer_errors) { | 552 if (!gpu_timer_errors) { |
552 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") | 553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") |
553 .PrintResult("renaming"); | 554 .PrintResult("renaming"); |
554 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); | 555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); |
555 } | 556 } |
556 } | 557 } |
557 | 558 |
558 } // namespace | 559 } // namespace |
559 } // namespace gpu | 560 } // namespace gpu |
OLD | NEW |