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

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

Issue 2588263005: Change GLGetProcAddress typedef to function returning function pointer (Closed)
Patch Set: fix cast Created 3 years, 12 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_bindings_autogen_mock.cc ('k') | ui/gl/gl_implementation.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 17 matching lines...) Expand all
28 }; 28 };
29 29
30 struct GL_EXPORT GLWindowSystemBindingInfo { 30 struct GL_EXPORT GLWindowSystemBindingInfo {
31 GLWindowSystemBindingInfo(); 31 GLWindowSystemBindingInfo();
32 std::string vendor; 32 std::string vendor;
33 std::string version; 33 std::string version;
34 std::string extensions; 34 std::string extensions;
35 bool direct_rendering; 35 bool direct_rendering;
36 }; 36 };
37 37
38 using GLFunctionPointerType = void (*)();
Ken Russell (switch to Gerrit) 2016/12/21 16:45:17 Is it OK that this "using" statement doesn't inclu
38 #if defined(OS_WIN) 39 #if defined(OS_WIN)
39 typedef void* (WINAPI *GLGetProcAddressProc)(const char* name); 40 typedef GLFunctionPointerType(WINAPI* GLGetProcAddressProc)(const char* name);
40 #else 41 #else
41 typedef void* (*GLGetProcAddressProc)(const char* name); 42 typedef GLFunctionPointerType (*GLGetProcAddressProc)(const char* name);
42 #endif 43 #endif
43 44
44 // Initialize stub methods for drawing operations in the GL bindings. The 45 // Initialize stub methods for drawing operations in the GL bindings. The
45 // null draw bindings default to enabled, so that draw operations do nothing. 46 // null draw bindings default to enabled, so that draw operations do nothing.
46 GL_EXPORT void InitializeNullDrawGLBindings(); 47 GL_EXPORT void InitializeNullDrawGLBindings();
47 48
48 // TODO(danakj): Remove this when all test suites are using null-draw. 49 // TODO(danakj): Remove this when all test suites are using null-draw.
49 GL_EXPORT bool HasInitializedNullDrawGLBindings(); 50 GL_EXPORT bool HasInitializedNullDrawGLBindings();
50 51
51 // Filter a list of disabled_extensions from GL style space-separated 52 // Filter a list of disabled_extensions from GL style space-separated
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Exported so that tests may set the function used in the mock implementation. 93 // Exported so that tests may set the function used in the mock implementation.
93 GL_EXPORT void SetGLGetProcAddressProc(GLGetProcAddressProc proc); 94 GL_EXPORT void SetGLGetProcAddressProc(GLGetProcAddressProc proc);
94 95
95 // Find an entry point in the current GL implementation. Note that the function 96 // Find an entry point in the current GL implementation. Note that the function
96 // may return a non-null pointer to something else than the GL function if an 97 // may return a non-null pointer to something else than the GL function if an
97 // unsupported function is queried. Spec-compliant eglGetProcAddress and 98 // unsupported function is queried. Spec-compliant eglGetProcAddress and
98 // glxGetProcAddress are allowed to return garbage for unsupported functions, 99 // glxGetProcAddress are allowed to return garbage for unsupported functions,
99 // and when querying functions from the EGL library supplied by Android, it may 100 // and when querying functions from the EGL library supplied by Android, it may
100 // return a function that prints a log message about the function being 101 // return a function that prints a log message about the function being
101 // unsupported. 102 // unsupported.
102 GL_EXPORT void* GetGLProcAddress(const char* name); 103 GL_EXPORT GLFunctionPointerType GetGLProcAddress(const char* name);
103 104
104 // Helper for fetching the OpenGL extensions from the current context. 105 // Helper for fetching the OpenGL extensions from the current context.
105 // This helper abstracts over differences between the desktop OpenGL 106 // This helper abstracts over differences between the desktop OpenGL
106 // core profile, and OpenGL ES and the compatibility profile. It's 107 // core profile, and OpenGL ES and the compatibility profile. It's
107 // intended for users of the bindings, not the implementation of the 108 // intended for users of the bindings, not the implementation of the
108 // bindings themselves. This is a relatively expensive call, so 109 // bindings themselves. This is a relatively expensive call, so
109 // callers should cache the result. 110 // callers should cache the result.
110 GL_EXPORT std::string GetGLExtensionsFromCurrentContext(); 111 GL_EXPORT std::string GetGLExtensionsFromCurrentContext();
111 112
112 // Helper for the GL bindings implementation to understand whether 113 // Helper for the GL bindings implementation to understand whether
113 // glGetString(GL_EXTENSIONS) or glGetStringi(GL_EXTENSIONS, i) will 114 // glGetString(GL_EXTENSIONS) or glGetStringi(GL_EXTENSIONS, i) will
114 // be used in the function above. 115 // be used in the function above.
115 GL_EXPORT bool WillUseGLGetStringForExtensions(); 116 GL_EXPORT bool WillUseGLGetStringForExtensions();
116 117
117 // Helpers to load a library and log error on failure. 118 // Helpers to load a library and log error on failure.
118 GL_EXPORT base::NativeLibrary LoadLibraryAndPrintError( 119 GL_EXPORT base::NativeLibrary LoadLibraryAndPrintError(
119 const base::FilePath::CharType* filename); 120 const base::FilePath::CharType* filename);
120 GL_EXPORT base::NativeLibrary LoadLibraryAndPrintError( 121 GL_EXPORT base::NativeLibrary LoadLibraryAndPrintError(
121 const base::FilePath& filename); 122 const base::FilePath& filename);
122 123
123 } // namespace gl 124 } // namespace gl
124 125
125 #endif // UI_GL_GL_IMPLEMENTATION_H_ 126 #endif // UI_GL_GL_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_bindings_autogen_mock.cc ('k') | ui/gl/gl_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698