Home | History | Annotate | Download | only in src
      1 // Copyright (c) 2012 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 "base/callback.h"
      6 
      7 #include "testbase.h"
      8 #include "utils.h"
      9 
     10 namespace glbench {
     11 
     12 class GLInterfaceTest : public TestBase {
     13  public:
     14   GLInterfaceTest() : index_buffer_object_(0),
     15                vertex_buffer_object_(0),
     16                num_indices_(0),
     17                shader_program_(0),
     18                attribute_index_(0) {}
     19   virtual ~GLInterfaceTest() {}
     20   virtual bool TestFunc(uint64_t iterations) = 0;
     21   virtual bool Run();
     22   virtual const char* Name() const = 0;
     23   virtual bool IsDrawTest() const { return !render_func_.is_null(); }
     24   virtual const char* Unit() const { return "us"; }
     25 
     26  protected:
     27   // Callback for GL rendering function to be run before GLX/EGL calls.
     28   base::Callback<void(void)> render_func_;
     29   void SetupGLRendering();
     30 
     31  private:
     32   // For calling some GL operations before GLX/EGL calls.
     33   void RenderGLSimple();
     34   void CleanupGLRendering();
     35 
     36   // For GL rendering.
     37   GLuint index_buffer_object_;
     38   GLuint vertex_buffer_object_;
     39   GLsizei num_indices_;
     40   GLuint shader_program_;
     41   GLint attribute_index_;
     42 
     43   DISALLOW_COPY_AND_ASSIGN(GLInterfaceTest);
     44 };
     45 
     46 } // namespace glbench
     47