Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: ui/gl/gl_gl_api_implementation.h

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_fence_arb.cc ('k') | ui/gl/gl_gl_api_implementation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_gl_api_implementation.h
diff --git a/ui/gl/gl_gl_api_implementation.h b/ui/gl/gl_gl_api_implementation.h
index 806f4535a4cd0dc05d7dd9727b52101847986441..ba66b85ddf639241beb3916df95e0cae6acc2418 100644
--- a/ui/gl/gl_gl_api_implementation.h
+++ b/ui/gl/gl_gl_api_implementation.h
@@ -5,6 +5,7 @@
#ifndef UI_GL_GL_GL_API_IMPLEMENTATION_H_
#define UI_GL_GL_GL_API_IMPLEMENTATION_H_
+#include <memory>
#include <vector>
#include "base/compiler_specific.h"
@@ -17,24 +18,18 @@ class CommandLine;
namespace gl {
-class GLContext;
struct GLVersionInfo;
GL_EXPORT void InitializeStaticGLBindingsGL();
-void InitializeDynamicGLBindingsGL(GLContext* context);
-GL_EXPORT void InitializeDebugGLBindingsGL();
-void InitializeNullDrawGLBindingsGL();
-// TODO(danakj): Remove this when all test suites are using null-draw.
-bool HasInitializedNullDrawGLBindingsGL();
-bool SetNullDrawGLBindingsEnabledGL(bool enabled);
GL_EXPORT void ClearBindingsGL();
-void SetGLToRealGLApi();
-void SetGLToStubGLApi();
-void SetGLApi(GLApi* api);
-void SetGLApiToNoContext();
-GLApi* GetCurrentGLApi();
-GL_EXPORT void SetStubGLApi(GLApi* api);
-const GLVersionInfo* GetGLVersionInfo();
+
+GL_EXPORT void InitializeDebugGLBindingsGL();
+bool GetDebugGLBindingsInitializedGL();
+
+bool SetNullDrawGLBindingsEnabled(bool enabled);
+bool GetNullDrawBindingsEnabled();
+
+void SetCurrentGL(CurrentGL* current);
class GL_EXPORT GLApiBase : public GLApi {
public:
@@ -64,7 +59,61 @@ class GL_EXPORT RealGLApi : public GLApiBase {
const GLubyte* glGetStringFn(GLenum name) override;
const GLubyte* glGetStringiFn(GLenum name, GLuint index) override;
+ void glTexImage2DFn(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void* pixels) override;
+
+ void glTexSubImage2DFn(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void* pixels) override;
+
+ void glTexStorage2DEXTFn(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height) override;
+
+ void glRenderbufferStorageEXTFn(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height) override;
+
+ void glRenderbufferStorageMultisampleEXTFn(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height) override;
+
+ void glRenderbufferStorageMultisampleFn(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height) override;
+
+ void glClearFn(GLbitfield mask) override;
+ void glDrawArraysFn(GLenum mode, GLint first, GLsizei count) override;
+ void glDrawElementsFn(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void* indices) override;
+
+ void glClearDepthFn(GLclampd depth) override;
+ void glDepthRangeFn(GLclampd z_near, GLclampd z_far) override;
+
void InitializeFilteredExtensions();
+ void set_version(std::unique_ptr<GLVersionInfo> version);
private:
// Filtered GL_EXTENSIONS we return to glGetString(i) calls.
@@ -72,6 +121,8 @@ class GL_EXPORT RealGLApi : public GLApiBase {
std::vector<std::string> filtered_exts_;
std::string filtered_exts_str_;
+ std::unique_ptr<GLVersionInfo> version_;
+
#if DCHECK_IS_ON()
bool filtered_exts_initialized_;
#endif
@@ -92,6 +143,21 @@ class TraceGLApi : public GLApi {
GLApi* gl_api_;
};
+// Logs debug information for every GL call.
+class DebugGLApi : public GLApi {
+ public:
+ DebugGLApi(GLApi* gl_api);
+ ~DebugGLApi() override;
+
+ // 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_gl.h"
+
+ private:
+ GLApi* gl_api_;
+};
+
// Catches incorrect usage when GL calls are made without a current context.
class NoContextGLApi : public GLApi {
public:
« no previous file with comments | « ui/gl/gl_fence_arb.cc ('k') | ui/gl/gl_gl_api_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698