Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / include / gpu / gl / GrGLExtensions.h
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7
8 #ifndef GrGLExtensions_DEFINED
9 #define GrGLExtensions_DEFINED
10
11 #include "include/core/SkString.h"
12 #include "include/gpu/gl/GrGLFunctions.h"
13 #include "include/private/SkTArray.h"
14
15 #include <utility>
16
17 struct GrGLInterface;
18 class SkJSONWriter;
19
20 /**
21  * This helper queries the current GL context for its extensions, remembers them, and can be
22  * queried. It supports both glGetString- and glGetStringi-style extension string APIs and will
23  * use the latter if it is available. It also will query for EGL extensions if a eglQueryString
24  * implementation is provided.
25  */
26 class SK_API GrGLExtensions {
27 public:
28     GrGLExtensions() {}
29
30     GrGLExtensions(const GrGLExtensions&);
31
32     GrGLExtensions& operator=(const GrGLExtensions&);
33
34     void swap(GrGLExtensions* that) {
35         using std::swap;
36         swap(fStrings, that->fStrings);
37         swap(fInitialized, that->fInitialized);
38     }
39
40     /**
41      * We sometimes need to use this class without having yet created a GrGLInterface. This version
42      * of init expects that getString is always non-NULL while getIntegerv and getStringi are non-
43      * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail.
44      */
45     bool init(GrGLStandard standard,
46               GrGLFunction<GrGLGetStringFn> getString,
47               GrGLFunction<GrGLGetStringiFn> getStringi,
48               GrGLFunction<GrGLGetIntegervFn> getIntegerv,
49               GrGLFunction<GrEGLQueryStringFn> queryString = nullptr,
50               GrEGLDisplay eglDisplay = nullptr);
51
52     bool isInitialized() const { return fInitialized; }
53
54     /**
55      * Queries whether an extension is present. This will fail if init() has not been called.
56      */
57     bool has(const char[]) const;
58
59     /**
60      * Removes an extension if present. Returns true if the extension was present before the call.
61      */
62     bool remove(const char[]);
63
64     /**
65      * Adds an extension to list
66      */
67     void add(const char[]);
68
69     void reset() { fStrings.reset(); }
70
71     void dumpJSON(SkJSONWriter*) const;
72
73 private:
74     bool fInitialized = false;
75     SkTArray<SkString> fStrings;
76 };
77
78 #endif