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

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

Issue 2794002: Added gflags switches: duration, tests, save, out. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: addressed comments Created 10 years, 6 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/testbase.cc ('k') | client/deps/glbench/src/trianglesetuptest.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 "base/logging.h" 5 #include "base/logging.h"
6 #include "base/scoped_ptr.h" 6 #include "base/scoped_ptr.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 8
9 #include "main.h" 9 #include "main.h"
10 #include "testbase.h" 10 #include "testbase.h"
11 #include "utils.h" 11 #include "utils.h"
12 12
13 namespace glbench { 13 namespace glbench {
14 14
15 static const int kNumberOfTextures = 8; 15 static const int kNumberOfTextures = 8;
16 16
17 class TextureUpdateTest : public TestBase { 17 class TextureUpdateTest : public TestBase {
18 public: 18 public:
19 TextureUpdateTest() {} 19 TextureUpdateTest() {}
20 virtual ~TextureUpdateTest() {} 20 virtual ~TextureUpdateTest() {}
21 bool TestFunc(int iter); 21 bool TestFunc(int iter);
22 virtual bool Run(); 22 virtual bool Run();
23 virtual const char* Name() const { return "texture_update"; }
23 24
24 enum UpdateFlavor { 25 enum UpdateFlavor {
25 TEX_IMAGE, 26 TEX_IMAGE,
26 TEX_SUBIMAGE 27 TEX_SUBIMAGE
27 }; 28 };
28 29
29 private: 30 private:
30 GLuint width_; 31 GLuint width_;
31 GLuint height_; 32 GLuint height_;
32 GLuint program_; 33 GLuint program_;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 glActiveTexture(GL_TEXTURE0); 116 glActiveTexture(GL_TEXTURE0);
116 117
117 GLuint texname; 118 GLuint texname;
118 glGenTextures(1, &texname); 119 glGenTextures(1, &texname);
119 glBindTexture(GL_TEXTURE_2D, texname); 120 glBindTexture(GL_TEXTURE_2D, texname);
120 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 121 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
121 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 122 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
122 123
123 124
124 UpdateFlavor flavors[] = {TEX_IMAGE, TEX_SUBIMAGE}; 125 UpdateFlavor flavors[] = {TEX_IMAGE, TEX_SUBIMAGE};
125 const std::string flavor_names[] = {"teximage2d", "texsubimage2d"}; 126 const std::string flavor_names[] = {
127 "texture_update_teximage2d", "texture_update_texsubimage2d"
128 };
126 for (unsigned int f = 0; f < arraysize(flavors); f++) { 129 for (unsigned int f = 0; f < arraysize(flavors); f++) {
127 flavor_ = flavors[f]; 130 flavor_ = flavors[f];
128 int sizes[] = {32, 128, 256, 512, 768, 1024, 1536, 2048}; 131 int sizes[] = {32, 128, 256, 512, 768, 1024, 1536, 2048};
129 for (unsigned int i = 0; i < arraysize(sizes); i++) { 132 for (unsigned int i = 0; i < arraysize(sizes); i++) {
130 std::string name = "mtexel_sec_" + flavor_names[f] + "_" + 133 std::string name = "mtexel_sec_" + flavor_names[f] + "_" +
131 IntToString(sizes[i]); 134 IntToString(sizes[i]);
132 width_ = height_ = sizes[i]; 135 width_ = height_ = sizes[i];
133 for (int i = 0; i < kNumberOfTextures; ++i) 136 for (int i = 0; i < kNumberOfTextures; ++i)
134 pixels_[i].reset(new char[width_ * height_]); 137 pixels_[i].reset(new char[width_ * height_]);
135 RunTest(this, name.c_str(), width_ * height_, true); 138 RunTest(this, name.c_str(), width_ * height_, true);
136 } 139 }
137 } 140 }
138 141
139 glDeleteTextures(1, &texname); 142 glDeleteTextures(1, &texname);
140 glDeleteProgram(program_); 143 glDeleteProgram(program_);
141 return true; 144 return true;
142 } 145 }
143 146
144 TestBase* GetTextureUpdateTest() { 147 TestBase* GetTextureUpdateTest() {
145 return new TextureUpdateTest; 148 return new TextureUpdateTest;
146 } 149 }
147 150
148 } // namespace glbench 151 } // namespace glbench
OLDNEW
« no previous file with comments | « client/deps/glbench/src/testbase.cc ('k') | client/deps/glbench/src/trianglesetuptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698