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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 const GLenum format, | 401 const GLenum format, |
402 const bool subimage) { | 402 const bool subimage) { |
403 std::vector<uint8_t> pixels; | 403 std::vector<uint8_t> pixels; |
404 base::SmallMap<std::map<std::string, Measurement>> | 404 base::SmallMap<std::map<std::string, Measurement>> |
405 aggregates; // indexed by name | 405 aggregates; // indexed by name |
406 int successful_runs = 0; | 406 int successful_runs = 0; |
407 GLuint texture_id = CreateGLTexture(format, size, subimage); | 407 GLuint texture_id = CreateGLTexture(format, size, subimage); |
408 for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) { | 408 for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) { |
409 GenerateTextureData(size, GLFormatBytePerPixel(format), i + 1, &pixels); | 409 GenerateTextureData(size, GLFormatBytePerPixel(format), i + 1, &pixels); |
410 auto run = UploadAndDraw(texture_id, size, pixels, format, subimage); | 410 auto run = UploadAndDraw(texture_id, size, pixels, format, subimage); |
411 if (i < kUploadPerfWarmupRuns || !run.size()) { | 411 if (i < kUploadPerfWarmupRuns || run.empty()) { |
412 continue; | 412 continue; |
413 } | 413 } |
414 successful_runs++; | 414 successful_runs++; |
415 for (const Measurement& measurement : run) { | 415 for (const Measurement& measurement : run) { |
416 auto& aggregate = aggregates[measurement.name]; | 416 auto& aggregate = aggregates[measurement.name]; |
417 aggregate.name = measurement.name; | 417 aggregate.name = measurement.name; |
418 aggregate.Increment(measurement); | 418 aggregate.Increment(measurement); |
419 } | 419 } |
420 } | 420 } |
421 glDeleteTextures(1, &texture_id); | 421 glDeleteTextures(1, &texture_id); |
(...skipping 129 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 |