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

Side by Side Diff: ui/gl/gl_implementation.h

Issue 2094513002: Move static GL binding initialization to //ui/gl/init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for comment. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « ui/gl/gl_glx_api_implementation.h ('k') | ui/gl/gl_implementation_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GL_GL_IMPLEMENTATION_H_ 5 #ifndef UI_GL_GL_IMPLEMENTATION_H_
6 #define UI_GL_GL_IMPLEMENTATION_H_ 6 #define UI_GL_GL_IMPLEMENTATION_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 GL_EXPORT void GetAllowedGLImplementations( 40 GL_EXPORT void GetAllowedGLImplementations(
41 std::vector<GLImplementation>* impls); 41 std::vector<GLImplementation>* impls);
42 42
43 #if defined(OS_WIN) 43 #if defined(OS_WIN)
44 typedef void* (WINAPI *GLGetProcAddressProc)(const char* name); 44 typedef void* (WINAPI *GLGetProcAddressProc)(const char* name);
45 #else 45 #else
46 typedef void* (*GLGetProcAddressProc)(const char* name); 46 typedef void* (*GLGetProcAddressProc)(const char* name);
47 #endif 47 #endif
48 48
49 // Initialize a particular GL implementation.
50 GL_EXPORT bool InitializeStaticGLBindings(GLImplementation implementation);
51
52 // Initialize function bindings that depend on the context for a GL 49 // Initialize function bindings that depend on the context for a GL
53 // implementation. 50 // implementation.
54 GL_EXPORT bool InitializeDynamicGLBindings(GLImplementation implementation, 51 GL_EXPORT bool InitializeDynamicGLBindings(GLImplementation implementation,
55 GLContext* context); 52 GLContext* context);
56 53
57 // Initialize Debug logging wrappers for GL bindings.
58 GL_EXPORT void InitializeDebugGLBindings();
59
60 // Initialize stub methods for drawing operations in the GL bindings. The 54 // Initialize stub methods for drawing operations in the GL bindings. The
61 // null draw bindings default to enabled, so that draw operations do nothing. 55 // null draw bindings default to enabled, so that draw operations do nothing.
62 GL_EXPORT void InitializeNullDrawGLBindings(); 56 GL_EXPORT void InitializeNullDrawGLBindings();
63 57
64 // TODO(danakj): Remove this when all test suites are using null-draw. 58 // TODO(danakj): Remove this when all test suites are using null-draw.
65 GL_EXPORT bool HasInitializedNullDrawGLBindings(); 59 GL_EXPORT bool HasInitializedNullDrawGLBindings();
66 60
67 // Filter a list of disabled_extensions from GL style space-separated 61 // Filter a list of disabled_extensions from GL style space-separated
68 // extension_list, returning a space separated list of filtered extensions, in 62 // extension_list, returning a space separated list of filtered extensions, in
69 // the same order as the input. 63 // the same order as the input.
70 GL_EXPORT std::string FilterGLExtensionList( 64 GL_EXPORT std::string FilterGLExtensionList(
71 const char* extension_list, 65 const char* extension_list,
72 const std::vector<std::string>& disabled_extensions); 66 const std::vector<std::string>& disabled_extensions);
73 67
74 // Once initialized, instantiating this turns the stub methods for drawing 68 // Once initialized, instantiating this turns the stub methods for drawing
75 // operations off allowing drawing will occur while the object is alive. 69 // operations off allowing drawing will occur while the object is alive.
76 class GL_EXPORT DisableNullDrawGLBindings { 70 class GL_EXPORT DisableNullDrawGLBindings {
77 public: 71 public:
78 DisableNullDrawGLBindings(); 72 DisableNullDrawGLBindings();
79 ~DisableNullDrawGLBindings(); 73 ~DisableNullDrawGLBindings();
80 74
81 private: 75 private:
82 bool initial_enabled_; 76 bool initial_enabled_;
83 }; 77 };
84 78
85 GL_EXPORT void ClearGLBindings();
86
87 // Set the current GL implementation. 79 // Set the current GL implementation.
88 GL_EXPORT void SetGLImplementation(GLImplementation implementation); 80 GL_EXPORT void SetGLImplementation(GLImplementation implementation);
89 81
90 // Get the current GL implementation. 82 // Get the current GL implementation.
91 GL_EXPORT GLImplementation GetGLImplementation(); 83 GL_EXPORT GLImplementation GetGLImplementation();
92 84
93 // Does the underlying GL support all features from Desktop GL 2.0 that were 85 // Does the underlying GL support all features from Desktop GL 2.0 that were
94 // removed from the ES 2.0 spec without requiring specific extension strings. 86 // removed from the ES 2.0 spec without requiring specific extension strings.
95 GL_EXPORT bool HasDesktopGLFeatures(); 87 GL_EXPORT bool HasDesktopGLFeatures();
96 88
97 // Get the GL implementation with a given name. 89 // Get the GL implementation with a given name.
98 GL_EXPORT GLImplementation GetNamedGLImplementation(const std::string& name); 90 GL_EXPORT GLImplementation GetNamedGLImplementation(const std::string& name);
99 91
100 // Get the name of a GL implementation. 92 // Get the name of a GL implementation.
101 GL_EXPORT const char* GetGLImplementationName(GLImplementation implementation); 93 GL_EXPORT const char* GetGLImplementationName(GLImplementation implementation);
102 94
103 // Add a native library to those searched for GL entry points. 95 // Add a native library to those searched for GL entry points.
104 void AddGLNativeLibrary(base::NativeLibrary library); 96 GL_EXPORT void AddGLNativeLibrary(base::NativeLibrary library);
105 97
106 // Unloads all native libraries. 98 // Unloads all native libraries.
107 void UnloadGLNativeLibraries(); 99 GL_EXPORT void UnloadGLNativeLibraries();
108 100
109 // Set an additional function that will be called to find GL entry points. 101 // Set an additional function that will be called to find GL entry points.
110 // Exported so that tests may set the function used in the mock implementation. 102 // Exported so that tests may set the function used in the mock implementation.
111 GL_EXPORT void SetGLGetProcAddressProc(GLGetProcAddressProc proc); 103 GL_EXPORT void SetGLGetProcAddressProc(GLGetProcAddressProc proc);
112 104
113 // Find an entry point in the current GL implementation. Note that the function 105 // Find an entry point in the current GL implementation. Note that the function
114 // may return a non-null pointer to something else than the GL function if an 106 // may return a non-null pointer to something else than the GL function if an
115 // unsupported function is queried. Spec-compliant eglGetProcAddress and 107 // unsupported function is queried. Spec-compliant eglGetProcAddress and
116 // glxGetProcAddress are allowed to return garbage for unsupported functions, 108 // glxGetProcAddress are allowed to return garbage for unsupported functions,
117 // and when querying functions from the EGL library supplied by Android, it may 109 // and when querying functions from the EGL library supplied by Android, it may
118 // return a function that prints a log message about the function being 110 // return a function that prints a log message about the function being
119 // unsupported. 111 // unsupported.
120 void* GetGLProcAddress(const char* name); 112 GL_EXPORT void* GetGLProcAddress(const char* name);
121 113
122 // Return information about the GL window system binding implementation (e.g., 114 // Return information about the GL window system binding implementation (e.g.,
123 // EGL, GLX, WGL). Returns true if the information was retrieved successfully. 115 // EGL, GLX, WGL). Returns true if the information was retrieved successfully.
124 GL_EXPORT bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info); 116 GL_EXPORT bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info);
125 117
126 // Helper for fetching the OpenGL extensions from the current context. 118 // Helper for fetching the OpenGL extensions from the current context.
127 // This helper abstracts over differences between the desktop OpenGL 119 // This helper abstracts over differences between the desktop OpenGL
128 // core profile, and OpenGL ES and the compatibility profile. It's 120 // core profile, and OpenGL ES and the compatibility profile. It's
129 // intended for users of the bindings, not the implementation of the 121 // intended for users of the bindings, not the implementation of the
130 // bindings themselves. This is a relatively expensive call, so 122 // bindings themselves. This is a relatively expensive call, so
131 // callers should cache the result. 123 // callers should cache the result.
132 GL_EXPORT std::string GetGLExtensionsFromCurrentContext(); 124 GL_EXPORT std::string GetGLExtensionsFromCurrentContext();
133 125
134 // Helper for the GL bindings implementation to understand whether 126 // Helper for the GL bindings implementation to understand whether
135 // glGetString(GL_EXTENSIONS) or glGetStringi(GL_EXTENSIONS, i) will 127 // glGetString(GL_EXTENSIONS) or glGetStringi(GL_EXTENSIONS, i) will
136 // be used in the function above. 128 // be used in the function above.
137 GL_EXPORT bool WillUseGLGetStringForExtensions(); 129 GL_EXPORT bool WillUseGLGetStringForExtensions();
138 130
139 // Helpers to load a library and log error on failure. 131 // Helpers to load a library and log error on failure.
140 base::NativeLibrary LoadLibraryAndPrintError( 132 GL_EXPORT base::NativeLibrary LoadLibraryAndPrintError(
141 const base::FilePath::CharType* filename); 133 const base::FilePath::CharType* filename);
142 base::NativeLibrary LoadLibraryAndPrintError(const base::FilePath& filename); 134 GL_EXPORT base::NativeLibrary LoadLibraryAndPrintError(
135 const base::FilePath& filename);
143 136
144 } // namespace gl 137 } // namespace gl
145 138
146 #endif // UI_GL_GL_IMPLEMENTATION_H_ 139 #endif // UI_GL_GL_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_glx_api_implementation.h ('k') | ui/gl/gl_implementation_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698