Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / gfx / gl / GLLibraryLoader.h
blob0d18a1428d49cec81dc46afdc38deccd64a88709
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef GLLIBRARYLOADER_H_
6 #define GLLIBRARYLOADER_H_
8 #include <stdio.h>
10 #ifdef WIN32
11 #include <windows.h>
12 #endif
14 #include "GLDefs.h"
15 #include "nscore.h"
16 #include "prlink.h"
18 namespace mozilla {
19 namespace gl {
21 class GLLibraryLoader
23 public:
24 bool OpenLibrary(const char *library);
26 typedef PRFuncPtr (GLAPIENTRY * PlatformLookupFunction) (const char *);
28 enum {
29 MAX_SYMBOL_NAMES = 6,
30 MAX_SYMBOL_LENGTH = 128
33 typedef struct {
34 PRFuncPtr *symPointer;
35 const char *symNames[MAX_SYMBOL_NAMES];
36 } SymLoadStruct;
38 bool LoadSymbols(SymLoadStruct *firstStruct,
39 bool tryplatform = false,
40 const char *prefix = nullptr,
41 bool warnOnFailure = true);
44 * Static version of the functions in this class
46 static PRFuncPtr LookupSymbol(PRLibrary *lib,
47 const char *symname,
48 PlatformLookupFunction lookupFunction = nullptr);
49 static bool LoadSymbols(PRLibrary *lib,
50 SymLoadStruct *firstStruct,
51 PlatformLookupFunction lookupFunction = nullptr,
52 const char *prefix = nullptr,
53 bool warnOnFailure = true);
54 protected:
55 GLLibraryLoader() {
56 mLibrary = nullptr;
57 mLookupFunc = nullptr;
60 PRLibrary *mLibrary;
61 PlatformLookupFunction mLookupFunc;
64 } /* namespace gl */
65 } /* namespace mozilla */
67 #endif /* GLLIBRARYLOADER_H_ */