• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 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 #ifndef BENCH_GL_WAFFLE_STUFF_H_
6 #define BENCH_GL_WAFFLE_STUFF_H_
7 
8 #include <waffle.h>
9 
10 #include "glinterface.h"
11 
12 class WaffleInterface : public GLInterface {
13  public:
14 
WaffleInterface()15   WaffleInterface() : display_(NULL),
16                    config_(NULL),
17                    surface_(NULL),
18                    context_(NULL) { }
~WaffleInterface()19   virtual ~WaffleInterface() {}
20 
21   virtual bool Init();
22   virtual void Cleanup();
23 
24   virtual void SwapBuffers();
25   virtual bool SwapInterval(int interval);
26 
27   virtual void CheckError();
28 
29   virtual bool MakeCurrent(const GLContext& context);
30   virtual const GLContext CreateContext();
31   virtual void DeleteContext(const GLContext& context);
GetMainContext()32   virtual const GLContext& GetMainContext() {
33     return context_;
34   }
35 
display()36   const struct waffle_display* display() const {
37     return display_;
38   }
39 
surface()40   const struct waffle_window* surface() const {
41     return surface_;
42   }
43 
44  private:
45   void InitOnce();
46   void GetSurfaceSize(GLint *width, GLint *height);
47 
48   struct waffle_display *display_;
49   struct waffle_config *config_;
50   struct waffle_window *surface_;
51   struct waffle_context *context_;
52 };
53 
54 #endif // BENCH_GL_WAFFLE_STUFF_H_
55