Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: client/deps/glbench/src/testbase.cc

Issue 2115012: Added texture update test. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: C++ enum Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/deps/glbench/src/main.cc ('k') | client/deps/glbench/src/textureupdatetest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 6
7 #include "testbase.h" 7 #include "testbase.h"
8 8
9 namespace glbench { 9 namespace glbench {
10 10
11 uint64_t TimeTest(TestBase* test, int iter) { 11 uint64_t TimeTest(TestBase* test, int iter) {
12 SwapBuffers(); 12 SwapBuffers();
13 glFinish(); 13 glFinish();
14 uint64_t time1 = GetUTime(); 14 uint64_t time1 = GetUTime();
15 test->TestFunc(iter); 15 if (!test->TestFunc(iter))
16 return ~0;
16 glFinish(); 17 glFinish();
17 uint64_t time2 = GetUTime(); 18 uint64_t time2 = GetUTime();
18 return time2 - time1; 19 return time2 - time1;
19 } 20 }
20 21
21 #define MAX_ITERATION_DURATION_MS 100000 22 #define MAX_ITERATION_DURATION_MS 100000
22 23
23 // Benchmark some draw commands, by running it many times. 24 // Benchmark some draw commands, by running it many times.
24 // We want to measure the marginal cost, so we try more and more iterations 25 // We want to measure the marginal cost, so we try more and more iterations
25 // until we get a somewhat linear response (to eliminate constant cost), and we 26 // until we get a somewhat linear response (to eliminate constant cost), and we
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 bool DrawElementsTestFunc::TestFunc(int iter) { 133 bool DrawElementsTestFunc::TestFunc(int iter) {
133 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0); 134 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0);
134 glFlush(); 135 glFlush();
135 for (int i = 0 ; i < iter-1; ++i) { 136 for (int i = 0 ; i < iter-1; ++i) {
136 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0); 137 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0);
137 } 138 }
138 return true; 139 return true;
139 } 140 }
140 141
141 } // namespace glbench 142 } // namespace glbench
OLDNEW
« no previous file with comments | « client/deps/glbench/src/main.cc ('k') | client/deps/glbench/src/textureupdatetest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698