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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/containers/small_map.h" | 8 #include "base/containers/small_map.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 glGenFramebuffersEXT(1, &framebuffer_object_); | 115 glGenFramebuffersEXT(1, &framebuffer_object_); |
116 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_object_); | 116 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_object_); |
117 | 117 |
118 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 118 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
119 GL_TEXTURE_2D, color_texture_, 0); | 119 GL_TEXTURE_2D, color_texture_, 0); |
120 DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 120 DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
121 glCheckFramebufferStatusEXT(GL_FRAMEBUFFER)); | 121 glCheckFramebufferStatusEXT(GL_FRAMEBUFFER)); |
122 | 122 |
123 glViewport(0, 0, size_.width(), size_.height()); | 123 glViewport(0, 0, size_.width(), size_.height()); |
124 | 124 |
125 if (gpu_timing_.Initialize(gl_context_.get())) { | 125 gpu_timing_.Initialize(gl_context_.get()); |
126 if (gpu_timing_.IsAvailable()) { | |
126 LOG(INFO) << "Gpu timing initialized with timer type: " | 127 LOG(INFO) << "Gpu timing initialized with timer type: " |
127 << gpu_timing_.GetTimerTypeName(); | 128 << gpu_timing_.GetTimerTypeName(); |
128 gpu_timing_.CheckAndResetTimerErrors(); | |
Daniele Castagna
2015/02/23 22:21:19
This is needed to invalidate the disjoint error th
| |
129 gpu_timing_.InvalidateTimerOffset(); | 129 gpu_timing_.InvalidateTimerOffset(); |
130 } else { | 130 } else { |
131 LOG(WARNING) << "Can't initialize gpu timing"; | 131 LOG(WARNING) << "Can't initialize gpu timing"; |
132 } | 132 } |
133 // Prepare a simple program and a vertex buffer that will be | 133 // Prepare a simple program and a vertex buffer that will be |
134 // used to draw a quad on the offscreen surface. | 134 // used to draw a quad on the offscreen surface. |
135 vertex_shader_ = LoadShader(GL_VERTEX_SHADER, kVertexShader); | 135 vertex_shader_ = LoadShader(GL_VERTEX_SHADER, kVertexShader); |
136 fragment_shader_ = LoadShader(GL_FRAGMENT_SHADER, kFragmentShader); | 136 fragment_shader_ = LoadShader(GL_FRAGMENT_SHADER, kFragmentShader); |
137 program_object_ = glCreateProgram(); | 137 program_object_ = glCreateProgram(); |
138 CHECK_NE(0u, program_object_); | 138 CHECK_NE(0u, program_object_); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 } | 272 } |
273 | 273 |
274 for (const auto& entry : aggregates) { | 274 for (const auto& entry : aggregates) { |
275 const auto m = entry.second.Divide(kUploadPerfTestRuns); | 275 const auto m = entry.second.Divide(kUploadPerfTestRuns); |
276 m.PrintResult(); | 276 m.PrintResult(); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 } // namespace | 280 } // namespace |
281 } // namespace gpu | 281 } // namespace gpu |
OLD | NEW |