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