gfx/skia/trunk/include/gpu/gl/GrGLExtensions.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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  */
     8 #ifndef GrGLExtensions_DEFINED
     9 #define GrGLExtensions_DEFINED
    11 #include "GrGLFunctions.h"
    12 #include "SkString.h"
    13 #include "SkTArray.h"
    15 struct GrGLInterface;
    17 /**
    18  * This helper queries the current GL context for its extensions, remembers them, and can be
    19  * queried. It supports both glGetString- and glGetStringi-style extension string APIs and will
    20  * use the latter if it is available.
    21  */
    22 class SK_API GrGLExtensions {
    23 public:
    24     GrGLExtensions() : fInitialized(false), fStrings(SkNEW(SkTArray<SkString>)) {}
    26     GrGLExtensions(const GrGLExtensions&);
    28     GrGLExtensions& operator=(const GrGLExtensions&);
    30     void swap(GrGLExtensions* that) {
    31         fStrings.swap(&that->fStrings);
    32         SkTSwap(fInitialized, that->fInitialized);
    33     }
    35     /**
    36      * We sometimes need to use this class without having yet created a GrGLInterface. This version
    37      * of init expects that getString is always non-NULL while getIntegerv and getStringi are non-
    38      * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail.
    39      */
    40     bool init(GrGLStandard standard,
    41               GrGLGetStringProc getString,
    42               GrGLGetStringiProc getStringi,
    43               GrGLGetIntegervProc getIntegerv);
    45     bool isInitialized() const { return fInitialized; }
    47     /**
    48      * Queries whether an extension is present. This will fail if init() has not been called.
    49      */
    50     bool has(const char[]) const;
    52     /**
    53      * Removes an extension if present. Returns true if the extension was present before the call.
    54      */
    55     bool remove(const char[]);
    57     /**
    58      * Adds an extension to list
    59      */
    60     void add(const char[]);
    62     void reset() { fStrings->reset(); }
    64     void print(const char* sep = "\n") const;
    66 private:
    67     bool                                fInitialized;
    68     SkAutoTDelete<SkTArray<SkString> >  fStrings;
    69 };
    71 #endif

mercurial