1 //
2 // Copyright 2015 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // FunctionsGL.h: Defines the FuntionsGL class to contain loaded GL functions
8 
9 #ifndef LIBANGLE_RENDERER_GL_FUNCTIONSGL_H_
10 #define LIBANGLE_RENDERER_GL_FUNCTIONSGL_H_
11 
12 #include "common/debug.h"
13 #include "libANGLE/Version.h"
14 #include "libANGLE/renderer/gl/DispatchTableGL_autogen.h"
15 #include "libANGLE/renderer/gl/functionsgl_enums.h"
16 #include "libANGLE/renderer/gl/functionsgl_typedefs.h"
17 
18 namespace egl
19 {
20 class AttributeMap;
21 }  // namespace egl
22 
23 namespace rx
24 {
25 
26 enum StandardGL
27 {
28     STANDARD_GL_DESKTOP,
29     STANDARD_GL_ES,
30 };
31 
32 class FunctionsGL : public DispatchTableGL
33 {
34   public:
35     FunctionsGL();
36     ~FunctionsGL() override;
37 
38     void initialize(const egl::AttributeMap &displayAttributes);
39 
40     // Version information
41     gl::Version version;
42     StandardGL standard;
43     GLint profile;
44     bool isAtLeastGL(const gl::Version &glVersion) const;
45     bool isAtMostGL(const gl::Version &glVersion) const;
46     bool isAtLeastGLES(const gl::Version &glesVersion) const;
47     bool isAtMostGLES(const gl::Version &glesVersion) const;
48 
49     // Extensions
50     std::vector<std::string> extensions;
51     bool hasExtension(const std::string &ext) const;
52     bool hasGLExtension(const std::string &ext) const;
53     bool hasGLESExtension(const std::string &ext) const;
54 
55   private:
56     void *loadProcAddress(const std::string &function) const override = 0;
57     void initializeStubFunctionsForNULLDriver(const std::set<std::string> &extensionSet);
58 };
59 
60 }  // namespace rx
61 
62 #endif  // LIBANGLE_RENDERER_GL_FUNCTIONSGL_H_
63