Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 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 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 17 | #ifndef ANDROID_HWUI_EXTENSIONS_H |
| 18 | #define ANDROID_HWUI_EXTENSIONS_H |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 19 | |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 20 | #include <cutils/compiler.h> |
| 21 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 22 | #include <utils/Singleton.h> |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 23 | #include <utils/SortedVector.h> |
| 24 | #include <utils/String8.h> |
| 25 | |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 26 | namespace android { |
| 27 | namespace uirenderer { |
| 28 | |
Romain Guy | a5aed0d | 2010-09-09 14:42:43 -0700 | [diff] [blame] | 29 | /////////////////////////////////////////////////////////////////////////////// |
Romain Guy | a60c388 | 2011-08-01 15:28:16 -0700 | [diff] [blame] | 30 | // Classes |
| 31 | /////////////////////////////////////////////////////////////////////////////// |
| 32 | |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 33 | class ANDROID_API Extensions: public Singleton<Extensions> { |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 34 | public: |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 35 | inline bool hasNPot() const { return mHasNPot; } |
Romain Guy | a5aed0d | 2010-09-09 14:42:43 -0700 | [diff] [blame] | 36 | inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; } |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 37 | inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; } |
Romain Guy | 13631f3 | 2012-01-30 17:41:55 -0800 | [diff] [blame] | 38 | inline bool hasDebugMarker() const { return mHasDebugMarker; } |
Romain Guy | dfa1046 | 2012-05-12 16:18:58 -0700 | [diff] [blame] | 39 | inline bool hasDebugLabel() const { return mHasDebugLabel; } |
Romain Guy | 85ef80d | 2012-09-13 20:26:50 -0700 | [diff] [blame] | 40 | inline bool hasTiledRendering() const { return mHasTiledRendering; } |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 41 | inline bool has1BitStencil() const { return mHas1BitStencil; } |
| 42 | inline bool has4BitStencil() const { return mHas4BitStencil; } |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 43 | inline bool hasNvSystemTime() const { return mHasNvSystemTime; } |
Romain Guy | 318ae7b | 2013-09-24 18:44:54 -0700 | [diff] [blame] | 44 | inline bool hasUnpackRowLength() const { return mVersionMajor >= 3; } |
Romain Guy | 7f43076 | 2013-06-13 14:29:40 -0700 | [diff] [blame] | 45 | inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; } |
| 46 | inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; } |
| 47 | inline bool hasFloatTextures() const { return mVersionMajor >= 3; } |
| 48 | |
Romain Guy | df1dc28 | 2013-03-29 18:32:29 -0700 | [diff] [blame] | 49 | inline int getMajorGlVersion() const { return mVersionMajor; } |
| 50 | inline int getMinorGlVersion() const { return mVersionMinor; } |
| 51 | |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 52 | bool hasGlExtension(const char* extension) const; |
| 53 | bool hasEglExtension(const char* extension) const; |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 54 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 55 | void dump() const; |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 56 | |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 57 | private: |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 58 | Extensions(); |
| 59 | ~Extensions(); |
| 60 | |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 61 | void findExtensions(const char* extensions, SortedVector<String8>& list) const; |
| 62 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 63 | friend class Singleton<Extensions>; |
| 64 | |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 65 | SortedVector<String8> mGlExtensionList; |
| 66 | SortedVector<String8> mEglExtensionList; |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 67 | |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 68 | bool mHasNPot; |
Romain Guy | a5aed0d | 2010-09-09 14:42:43 -0700 | [diff] [blame] | 69 | bool mHasFramebufferFetch; |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 70 | bool mHasDiscardFramebuffer; |
Romain Guy | 13631f3 | 2012-01-30 17:41:55 -0800 | [diff] [blame] | 71 | bool mHasDebugMarker; |
Romain Guy | dfa1046 | 2012-05-12 16:18:58 -0700 | [diff] [blame] | 72 | bool mHasDebugLabel; |
Romain Guy | 85ef80d | 2012-09-13 20:26:50 -0700 | [diff] [blame] | 73 | bool mHasTiledRendering; |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 74 | bool mHas1BitStencil; |
| 75 | bool mHas4BitStencil; |
Romain Guy | e9bc11f | 2013-05-23 12:47:26 -0700 | [diff] [blame] | 76 | bool mHasNvSystemTime; |
Romain Guy | df1dc28 | 2013-03-29 18:32:29 -0700 | [diff] [blame] | 77 | |
| 78 | int mVersionMajor; |
| 79 | int mVersionMinor; |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 80 | }; // class Extensions |
| 81 | |
| 82 | }; // namespace uirenderer |
| 83 | }; // namespace android |
| 84 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 85 | #endif // ANDROID_HWUI_EXTENSIONS_H |