Skip to content

Commit

Permalink
Make most of VirtualGL auto-generated
Browse files Browse the repository at this point in the history
I'm not sure if this is the best way

GLApi is a pure virtual interface

GLApiBase is a class that calls driver->fnGLfunction
so it can be shared with RealGLApi and VirtualGLApi

RealGLApi is basically has nothing currenlty. It's just
GLApiBase but I guess the point is you can override something
if you need to

VirtualGLApi can now override just what it needs to so adding
new functions to generate_bindings.py no longer needs manual
editing

BUG=none
R=apatrick@chromium.org


Review URL: https://chromiumcodereview.appspot.com/11565005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173364 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
gman@chromium.org committed Dec 16, 2012
1 parent 2db0555 commit 95c9d11
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 987 deletions.
2 changes: 1 addition & 1 deletion ui/gl/generate_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ def GenerateSource(file, functions, set_name, used_extension_functions):
return_type = func['return_type']
arguments = func['arguments']
file.write('\n')
file.write('%s Real%sApi::%sFn(%s) {\n' %
file.write('%s %sApiBase::%sFn(%s) {\n' %
(return_type, set_name.upper(), names[0], arguments))
argument_names = re.sub(
r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', arguments)
Expand Down
13 changes: 12 additions & 1 deletion ui/gl/gl_egl_api_implementation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,25 @@ EGLApi::EGLApi() {
EGLApi::~EGLApi() {
}

EGLApiBase::EGLApiBase()
: driver_(NULL) {
}

EGLApiBase::~EGLApiBase() {
}

void EGLApiBase::InitializeBase(DriverEGL* driver) {
driver_ = driver;
}

RealEGLApi::RealEGLApi() {
}

RealEGLApi::~RealEGLApi() {
}

void RealEGLApi::Initialize(DriverEGL* driver) {
driver_ = driver;
InitializeBase(driver);
}

} // namespace gfx
Expand Down
19 changes: 13 additions & 6 deletions ui/gl/gl_egl_api_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,28 @@ void InitializeGLExtensionBindingsEGL(GLContext* context);
void InitializeDebugGLBindingsEGL();
void ClearGLBindingsEGL();

class GL_EXPORT RealEGLApi : public EGLApi {
class GL_EXPORT EGLApiBase : public EGLApi {
public:
RealEGLApi();
virtual ~RealEGLApi();
void Initialize(DriverEGL* driver);

// Include the auto-generated part of this class. We split this because
// it means we can easily edit the non-auto generated parts right here in
// this file instead of having to edit some template or the code generator.
#include "gl_bindings_api_autogen_egl.h"

private:
protected:
EGLApiBase();
virtual ~EGLApiBase();
void InitializeBase(DriverEGL* driver);

DriverEGL* driver_;
};

class GL_EXPORT RealEGLApi : public EGLApiBase {
public:
RealEGLApi();
virtual ~RealEGLApi();
void Initialize(DriverEGL* driver);
};

} // namespace gfx

#endif // UI_GL_EGL_API_IMPLEMENTATION_H_
Expand Down
Loading

0 comments on commit 95c9d11

Please sign in to comment.