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 #include <GLES2/gl2.h> 27 28 namespace android { 29 namespace uirenderer { 30 31 /////////////////////////////////////////////////////////////////////////////// 32 // Classes 33 /////////////////////////////////////////////////////////////////////////////// 34 35 class ANDROID_API Extensions { 36 public: 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; } hasTiledRendering()43 inline bool hasTiledRendering() const { return mHasTiledRendering; } has1BitStencil()44 inline bool has1BitStencil() const { return mHas1BitStencil; } has4BitStencil()45 inline bool has4BitStencil() const { return mHas4BitStencil; } hasNvSystemTime()46 inline bool hasNvSystemTime() const { return mHasNvSystemTime; } hasUnpackRowLength()47 inline bool hasUnpackRowLength() const { return mVersionMajor >= 3; } hasPixelBufferObjects()48 inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; } hasOcclusionQueries()49 inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; } hasFloatTextures()50 inline bool hasFloatTextures() const { return mVersionMajor >= 3; } 51 getMajorGlVersion()52 inline int getMajorGlVersion() const { return mVersionMajor; } getMinorGlVersion()53 inline int getMinorGlVersion() const { return mVersionMinor; } 54 55 bool hasGlExtension(const char* extension) const; 56 bool hasEglExtension(const char* extension) const; 57 58 void dump() const; 59 60 private: 61 void findExtensions(const char* extensions, SortedVector<String8>& list) const; 62 63 SortedVector<String8> mGlExtensionList; 64 SortedVector<String8> mEglExtensionList; 65 66 bool mHasNPot; 67 bool mHasFramebufferFetch; 68 bool mHasDiscardFramebuffer; 69 bool mHasDebugMarker; 70 bool mHasTiledRendering; 71 bool mHas1BitStencil; 72 bool mHas4BitStencil; 73 bool mHasNvSystemTime; 74 75 int mVersionMajor; 76 int mVersionMinor; 77 }; // class Extensions 78 79 }; // namespace uirenderer 80 }; // namespace android 81 82 #endif // ANDROID_HWUI_EXTENSIONS_H 83