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 : display_(NULL), config_(NULL), surface_(NULL), context_(NULL) {} 16 virtual ~WaffleInterface() {} 17 18 virtual bool Init(); 19 virtual void Cleanup(); 20 21 virtual void SwapBuffers(); 22 virtual bool SwapInterval(int interval); 23 24 virtual void CheckError(); 25 26 virtual bool MakeCurrent(const GLContext& context); 27 virtual const GLContext CreateContext(); 28 virtual void DeleteContext(const GLContext& context); 29 virtual const GLContext& GetMainContext() { return context_; } 30 31 const struct waffle_display* display() const { return display_; } 32 const struct waffle_window* surface() const { return surface_; } 33 34 private: 35 void InitOnce(); 36 void GetSurfaceSize(GLint* width, GLint* height); 37 38 struct waffle_display* display_; 39 struct waffle_config* config_; 40 struct waffle_window* surface_; 41 struct waffle_context* context_; 42 }; 43 44 #endif // BENCH_GL_WAFFLE_STUFF_H_ 45