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 <string>
23 #include <unordered_set>
24 
25 namespace android {
26 namespace uirenderer {
27 
28 ///////////////////////////////////////////////////////////////////////////////
29 // Classes
30 ///////////////////////////////////////////////////////////////////////////////
31 
32 class Extensions {
33 public:
34     Extensions();
35 
hasNPot()36     inline bool hasNPot() const { return mHasNPot; }
hasFramebufferFetch()37     inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; }
hasDiscardFramebuffer()38     inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
hasDebugMarker()39     inline bool hasDebugMarker() const { return mHasDebugMarker; }
has1BitStencil()40     inline bool has1BitStencil() const { return mHas1BitStencil; }
has4BitStencil()41     inline bool has4BitStencil() const { return mHas4BitStencil; }
hasUnpackRowLength()42     inline bool hasUnpackRowLength() const { return mVersionMajor >= 3 || mHasUnpackSubImage; }
hasPixelBufferObjects()43     inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; }
hasOcclusionQueries()44     inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; }
hasFloatTextures()45     inline bool hasFloatTextures() const { return mVersionMajor >= 3; }
46 
getMajorGlVersion()47     inline int getMajorGlVersion() const { return mVersionMajor; }
getMinorGlVersion()48     inline int getMinorGlVersion() const { return mVersionMinor; }
49 
50 private:
51     bool mHasNPot;
52     bool mHasFramebufferFetch;
53     bool mHasDiscardFramebuffer;
54     bool mHasDebugMarker;
55     bool mHas1BitStencil;
56     bool mHas4BitStencil;
57     bool mHasUnpackSubImage;
58 
59     int mVersionMajor;
60     int mVersionMinor;
61 }; // class Extensions
62 
63 }; // namespace uirenderer
64 }; // namespace android
65 
66 #endif // ANDROID_HWUI_EXTENSIONS_H
67