• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   * Copyright (C) 2010 The Android Open Source Project
3   *
4   * Licensed under the Apache License, Version 2.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *      http://www.apache.org/licenses/LICENSE-2.0
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  #ifndef ANDROID_HWUI_EXTENSIONS_H
18  #define ANDROID_HWUI_EXTENSIONS_H
19  
20  #include <cutils/compiler.h>
21  
22  #include <utils/Singleton.h>
23  #include <utils/SortedVector.h>
24  #include <utils/String8.h>
25  
26  namespace android {
27  namespace uirenderer {
28  
29  ///////////////////////////////////////////////////////////////////////////////
30  // Classes
31  ///////////////////////////////////////////////////////////////////////////////
32  
33  class ANDROID_API Extensions: public Singleton<Extensions> {
34  public:
hasNPot()35      inline bool hasNPot() const { return mHasNPot; }
hasFramebufferFetch()36      inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; }
hasDiscardFramebuffer()37      inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
hasDebugMarker()38      inline bool hasDebugMarker() const { return mHasDebugMarker; }
hasDebugLabel()39      inline bool hasDebugLabel() const { return mHasDebugLabel; }
hasTiledRendering()40      inline bool hasTiledRendering() const { return mHasTiledRendering; }
has1BitStencil()41      inline bool has1BitStencil() const { return mHas1BitStencil; }
has4BitStencil()42      inline bool has4BitStencil() const { return mHas4BitStencil; }
hasNvSystemTime()43      inline bool hasNvSystemTime() const { return mHasNvSystemTime; }
hasUnpackRowLength()44      inline bool hasUnpackRowLength() const { return mVersionMajor >= 3; }
hasPixelBufferObjects()45      inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; }
hasOcclusionQueries()46      inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; }
hasFloatTextures()47      inline bool hasFloatTextures() const { return mVersionMajor >= 3; }
48  
getMajorGlVersion()49      inline int getMajorGlVersion() const { return mVersionMajor; }
getMinorGlVersion()50      inline int getMinorGlVersion() const { return mVersionMinor; }
51  
52      bool hasGlExtension(const char* extension) const;
53      bool hasEglExtension(const char* extension) const;
54  
55      void dump() const;
56  
57  private:
58      Extensions();
59      ~Extensions();
60  
61      void findExtensions(const char* extensions, SortedVector<String8>& list) const;
62  
63      friend class Singleton<Extensions>;
64  
65      SortedVector<String8> mGlExtensionList;
66      SortedVector<String8> mEglExtensionList;
67  
68      bool mHasNPot;
69      bool mHasFramebufferFetch;
70      bool mHasDiscardFramebuffer;
71      bool mHasDebugMarker;
72      bool mHasDebugLabel;
73      bool mHasTiledRendering;
74      bool mHas1BitStencil;
75      bool mHas4BitStencil;
76      bool mHasNvSystemTime;
77  
78      int mVersionMajor;
79      int mVersionMinor;
80  }; // class Extensions
81  
82  }; // namespace uirenderer
83  }; // namespace android
84  
85  #endif // ANDROID_HWUI_EXTENSIONS_H
86