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> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 if (gpu_timing_client_->IsAvailable()) { | 215 if (gpu_timing_client_->IsAvailable()) { |
216 LOG(INFO) << "Gpu timing initialized with timer type: " | 216 LOG(INFO) << "Gpu timing initialized with timer type: " |
217 << gpu_timing_client_->GetTimerTypeName(); | 217 << gpu_timing_client_->GetTimerTypeName(); |
218 } else { | 218 } else { |
219 LOG(WARNING) << "Can't initialize gpu timing"; | 219 LOG(WARNING) << "Can't initialize gpu timing"; |
220 } | 220 } |
221 // Prepare a simple program and a vertex buffer that will be | 221 // Prepare a simple program and a vertex buffer that will be |
222 // used to draw a quad on the offscreen surface. | 222 // used to draw a quad on the offscreen surface. |
223 vertex_shader_ = LoadShader(GL_VERTEX_SHADER, kVertexShader); | 223 vertex_shader_ = LoadShader(GL_VERTEX_SHADER, kVertexShader); |
224 | 224 |
225 bool is_gles = gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2; | 225 bool is_gles = gl_context_->GetVersionInfo()->is_es; |
226 fragment_shader_ = LoadShader( | 226 fragment_shader_ = LoadShader( |
227 GL_FRAGMENT_SHADER, | 227 GL_FRAGMENT_SHADER, |
228 base::StringPrintf("%s%s", is_gles ? kShaderDefaultFloatPrecision : "", | 228 base::StringPrintf("%s%s", is_gles ? kShaderDefaultFloatPrecision : "", |
229 kFragmentShader).c_str()); | 229 kFragmentShader).c_str()); |
230 program_object_ = glCreateProgram(); | 230 program_object_ = glCreateProgram(); |
231 CHECK_NE(0u, program_object_); | 231 CHECK_NE(0u, program_object_); |
232 | 232 |
233 glAttachShader(program_object_, vertex_shader_); | 233 glAttachShader(program_object_, vertex_shader_); |
234 glAttachShader(program_object_, fragment_shader_); | 234 glAttachShader(program_object_, fragment_shader_); |
235 glBindAttribLocation(program_object_, 0, "a_position"); | 235 glBindAttribLocation(program_object_, 0, "a_position"); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 gpu_timing_client_->CheckAndResetTimerErrors(); | 551 gpu_timing_client_->CheckAndResetTimerErrors(); |
552 if (!gpu_timer_errors) { | 552 if (!gpu_timer_errors) { |
553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") | 553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") |
554 .PrintResult("renaming"); | 554 .PrintResult("renaming"); |
555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); | 555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); |
556 } | 556 } |
557 } | 557 } |
558 | 558 |
559 } // namespace | 559 } // namespace |
560 } // namespace gpu | 560 } // namespace gpu |
OLD | NEW |