| OLD | NEW |
| 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 <gflags/gflags.h> | 5 #include <gflags/gflags.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void DrawArraysTestFunc::FillRateTestNormalSubWindow(const char* name, | 121 void DrawArraysTestFunc::FillRateTestNormalSubWindow(const char* name, |
| 122 float width, float height) | 122 float width, float height) |
| 123 { | 123 { |
| 124 const int buffer_len = 64; | 124 const int buffer_len = 64; |
| 125 char buffer[buffer_len]; | 125 char buffer[buffer_len]; |
| 126 snprintf(buffer, buffer_len, "mpixels_sec_%s", name); | 126 snprintf(buffer, buffer_len, "mpixels_sec_%s", name); |
| 127 RunTest(this, buffer, width * height, true); | 127 RunTest(this, buffer, width * height, true); |
| 128 } | 128 } |
| 129 | 129 |
| 130 | 130 |
| 131 #if defined(USE_OPENGL) | |
| 132 void DrawArraysTestFunc::FillRateTestBlendDepth(const char *name) { | 131 void DrawArraysTestFunc::FillRateTestBlendDepth(const char *name) { |
| 133 const int buffer_len = 64; | 132 const int buffer_len = 64; |
| 134 char buffer[buffer_len]; | 133 char buffer[buffer_len]; |
| 135 | 134 |
| 136 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 135 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 137 glEnable(GL_BLEND); | 136 glEnable(GL_BLEND); |
| 138 snprintf(buffer, buffer_len, "mpixels_sec_%s_blended", name); | 137 snprintf(buffer, buffer_len, "mpixels_sec_%s_blended", name); |
| 139 RunTest(this, buffer, g_width * g_height, true); | 138 RunTest(this, buffer, g_width * g_height, true); |
| 140 glDisable(GL_BLEND); | 139 glDisable(GL_BLEND); |
| 141 | 140 |
| 142 glEnable(GL_DEPTH_TEST); | 141 glEnable(GL_DEPTH_TEST); |
| 143 glDepthFunc(GL_NOTEQUAL); | 142 glDepthFunc(GL_NOTEQUAL); |
| 144 snprintf(buffer, buffer_len, "mpixels_sec_%s_depth_neq", name); | 143 snprintf(buffer, buffer_len, "mpixels_sec_%s_depth_neq", name); |
| 145 RunTest(this, buffer, g_width * g_height, true); | 144 RunTest(this, buffer, g_width * g_height, true); |
| 146 glDepthFunc(GL_NEVER); | 145 glDepthFunc(GL_NEVER); |
| 147 snprintf(buffer, buffer_len, "mpixels_sec_%s_depth_never", name); | 146 snprintf(buffer, buffer_len, "mpixels_sec_%s_depth_never", name); |
| 148 RunTest(this, buffer, g_width * g_height, true); | 147 RunTest(this, buffer, g_width * g_height, true); |
| 149 glDisable(GL_DEPTH_TEST); | 148 glDisable(GL_DEPTH_TEST); |
| 150 } | 149 } |
| 151 #endif | |
| 152 | 150 |
| 153 | 151 |
| 154 bool DrawElementsTestFunc::TestFunc(int iter) { | 152 bool DrawElementsTestFunc::TestFunc(int iter) { |
| 155 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0); | 153 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0); |
| 156 glFlush(); | 154 glFlush(); |
| 157 for (int i = 0 ; i < iter-1; ++i) { | 155 for (int i = 0 ; i < iter-1; ++i) { |
| 158 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0); | 156 glDrawElements(GL_TRIANGLES, count_, GL_UNSIGNED_INT, 0); |
| 159 } | 157 } |
| 160 return true; | 158 return true; |
| 161 } | 159 } |
| 162 | 160 |
| 163 } // namespace glbench | 161 } // namespace glbench |
| OLD | NEW |