c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
79 lines
2.2 KiB
C++
79 lines
2.2 KiB
C++
/*
|
|
* Copyright 2013 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef GrGLExtensions_DEFINED
|
|
#define GrGLExtensions_DEFINED
|
|
|
|
#include "include/core/SkString.h"
|
|
#include "include/gpu/gl/GrGLFunctions.h"
|
|
#include "include/private/SkTArray.h"
|
|
|
|
#include <utility>
|
|
|
|
struct GrGLInterface;
|
|
class SkJSONWriter;
|
|
|
|
/**
|
|
* This helper queries the current GL context for its extensions, remembers them, and can be
|
|
* queried. It supports both glGetString- and glGetStringi-style extension string APIs and will
|
|
* use the latter if it is available. It also will query for EGL extensions if a eglQueryString
|
|
* implementation is provided.
|
|
*/
|
|
class SK_API GrGLExtensions {
|
|
public:
|
|
GrGLExtensions() {}
|
|
|
|
GrGLExtensions(const GrGLExtensions&);
|
|
|
|
GrGLExtensions& operator=(const GrGLExtensions&);
|
|
|
|
void swap(GrGLExtensions* that) {
|
|
using std::swap;
|
|
swap(fStrings, that->fStrings);
|
|
swap(fInitialized, that->fInitialized);
|
|
}
|
|
|
|
/**
|
|
* We sometimes need to use this class without having yet created a GrGLInterface. This version
|
|
* of init expects that getString is always non-NULL while getIntegerv and getStringi are non-
|
|
* NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail.
|
|
*/
|
|
bool init(GrGLStandard standard,
|
|
GrGLFunction<GrGLGetStringFn> getString,
|
|
GrGLFunction<GrGLGetStringiFn> getStringi,
|
|
GrGLFunction<GrGLGetIntegervFn> getIntegerv,
|
|
GrGLFunction<GrEGLQueryStringFn> queryString = nullptr,
|
|
GrEGLDisplay eglDisplay = nullptr);
|
|
|
|
bool isInitialized() const { return fInitialized; }
|
|
|
|
/**
|
|
* Queries whether an extension is present. This will fail if init() has not been called.
|
|
*/
|
|
bool has(const char[]) const;
|
|
|
|
/**
|
|
* Removes an extension if present. Returns true if the extension was present before the call.
|
|
*/
|
|
bool remove(const char[]);
|
|
|
|
/**
|
|
* Adds an extension to list
|
|
*/
|
|
void add(const char[]);
|
|
|
|
void reset() { fStrings.reset(); }
|
|
|
|
void dumpJSON(SkJSONWriter*) const;
|
|
|
|
private:
|
|
bool fInitialized = false;
|
|
SkTArray<SkString> fStrings;
|
|
};
|
|
|
|
#endif
|