Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrGLExtensions.h
Go to the documentation of this file.
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
14
15#include <utility>
16
17struct GrGLInterface;
18class 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 */
27public:
29
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,
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.clear(); }
70
71 void dumpJSON(SkJSONWriter*) const;
72
73private:
74 bool fInitialized = false;
76};
77
78#endif
GrGLStandard
Definition GrGLTypes.h:19
void * GrEGLDisplay
Definition GrGLTypes.h:166
#define SK_API
Definition SkAPI.h:35
void swap(sk_sp< T > &a, sk_sp< T > &b)
Definition SkRefCnt.h:341
bool isInitialized() const
void swap(GrGLExtensions *that)