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 <utils/Singleton.h> 21 #include <utils/SortedVector.h> 22 #include <utils/String8.h> 23 24 #include <GLES2/gl2.h> 25 #include <GLES2/gl2ext.h> 26 27 namespace android { 28 namespace uirenderer { 29 30 /////////////////////////////////////////////////////////////////////////////// 31 // Classes 32 /////////////////////////////////////////////////////////////////////////////// 33 34 class Extensions: public Singleton<Extensions> { 35 public: 36 Extensions(); 37 ~Extensions(); 38 hasNPot()39 inline bool hasNPot() const { return mHasNPot; } hasFramebufferFetch()40 inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; } hasDiscardFramebuffer()41 inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; } hasDebugMarker()42 inline bool hasDebugMarker() const { return mHasDebugMarker; } hasDebugLabel()43 inline bool hasDebugLabel() const { return mHasDebugLabel; } hasTiledRendering()44 inline bool hasTiledRendering() const { return mHasTiledRendering; } has1BitStencil()45 inline bool has1BitStencil() const { return mHas1BitStencil; } has4BitStencil()46 inline bool has4BitStencil() const { return mHas4BitStencil; } 47 getMajorGlVersion()48 inline int getMajorGlVersion() const { return mVersionMajor; } getMinorGlVersion()49 inline int getMinorGlVersion() const { return mVersionMinor; } 50 51 bool hasExtension(const char* extension) const; 52 53 void dump() const; 54 55 private: 56 friend class Singleton<Extensions>; 57 58 SortedVector<String8> mExtensionList; 59 60 char* mExtensions; 61 char* mVersion; 62 63 bool mHasNPot; 64 bool mHasFramebufferFetch; 65 bool mHasDiscardFramebuffer; 66 bool mHasDebugMarker; 67 bool mHasDebugLabel; 68 bool mHasTiledRendering; 69 bool mHas1BitStencil; 70 bool mHas4BitStencil; 71 72 int mVersionMajor; 73 int mVersionMinor; 74 }; // class Extensions 75 76 }; // namespace uirenderer 77 }; // namespace android 78 79 #endif // ANDROID_HWUI_EXTENSIONS_H 80