OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "main.h" |
| 6 #include "testbase.h" |
| 7 |
| 8 |
| 9 namespace glbench { |
| 10 |
| 11 |
| 12 class ClearTest : public TestBase { |
| 13 public: |
| 14 ClearTest() : mask_(0) {} |
| 15 virtual ~ClearTest() {} |
| 16 virtual bool TestFunc(int iter); |
| 17 virtual bool Run(); |
| 18 |
| 19 private: |
| 20 GLbitfield mask_; |
| 21 DISALLOW_COPY_AND_ASSIGN(ClearTest); |
| 22 }; |
| 23 |
| 24 |
| 25 bool ClearTest::TestFunc(int iter) { |
| 26 GLbitfield mask = mask_; |
| 27 glClear(mask); |
| 28 glFlush(); // Kick GPU as soon as possible |
| 29 for (int i = 0 ; i < iter-1; ++i) { |
| 30 glClear(mask); |
| 31 } |
| 32 return true; |
| 33 } |
| 34 |
| 35 |
| 36 bool ClearTest::Run() { |
| 37 mask_ = GL_COLOR_BUFFER_BIT; |
| 38 RunTest(this, "mpixels_sec_clear_color", g_width * g_height, true); |
| 39 |
| 40 mask_ = GL_DEPTH_BUFFER_BIT; |
| 41 RunTest(this, "mpixels_sec_clear_depth", g_width * g_height, true); |
| 42 |
| 43 mask_ = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT; |
| 44 RunTest(this, "mpixels_sec_clear_colordepth", |
| 45 g_width * g_height, true); |
| 46 |
| 47 mask_ = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; |
| 48 RunTest(this, "mpixels_sec_clear_depthstencil", |
| 49 g_width * g_height, true); |
| 50 |
| 51 mask_ = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; |
| 52 RunTest(this, "mpixels_sec_clear_colordepthstencil", |
| 53 g_width * g_height, true); |
| 54 return true; |
| 55 } |
| 56 |
| 57 |
| 58 TestBase* GetClearTest() { |
| 59 return new ClearTest; |
| 60 } |
| 61 |
| 62 } // namespace glbench |
OLD | NEW |