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

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

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