Extensions.h revision 3b748a44c6bd2ea05fe16839caf73dbe50bd7ae9
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 27namespace android { 28namespace uirenderer { 29 30/////////////////////////////////////////////////////////////////////////////// 31// Classes 32/////////////////////////////////////////////////////////////////////////////// 33 34class Extensions: public Singleton<Extensions> { 35public: 36 inline bool hasNPot() const { return mHasNPot; } 37 inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; } 38 inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; } 39 inline bool hasDebugMarker() const { return mHasDebugMarker; } 40 inline bool hasDebugLabel() const { return mHasDebugLabel; } 41 inline bool hasTiledRendering() const { return mHasTiledRendering; } 42 inline bool has1BitStencil() const { return mHas1BitStencil; } 43 inline bool has4BitStencil() const { return mHas4BitStencil; } 44 45 inline int getMajorGlVersion() const { return mVersionMajor; } 46 inline int getMinorGlVersion() const { return mVersionMinor; } 47 48 bool hasExtension(const char* extension) const; 49 50 void dump() const; 51 52private: 53 Extensions(); 54 ~Extensions(); 55 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