Extensions.h revision 318ae7bb92869d99a05388c598ad105e7aa4cdbd
1bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy/*
2bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * Copyright (C) 2010 The Android Open Source Project
3bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy *
4bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * Licensed under the Apache License, Version 2.0 (the "License");
5bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * you may not use this file except in compliance with the License.
6bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * You may obtain a copy of the License at
7bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy *
8bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy *      http://www.apache.org/licenses/LICENSE-2.0
9bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy *
10bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * Unless required by applicable law or agreed to in writing, software
11bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * distributed under the License is distributed on an "AS IS" BASIS,
12bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * See the License for the specific language governing permissions and
14bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy * limitations under the License.
15bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy */
16bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
175b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#ifndef ANDROID_HWUI_EXTENSIONS_H
185b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#define ANDROID_HWUI_EXTENSIONS_H
19bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
20e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy#include <cutils/compiler.h>
21e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy
223bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy#include <utils/Singleton.h>
23bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy#include <utils/SortedVector.h>
24bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy#include <utils/String8.h>
25bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
26bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guynamespace android {
27bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guynamespace uirenderer {
28bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
29a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy///////////////////////////////////////////////////////////////////////////////
30a60c3889718f4513a6c9d8b80f655db5d6346905Romain Guy// Classes
31a60c3889718f4513a6c9d8b80f655db5d6346905Romain Guy///////////////////////////////////////////////////////////////////////////////
32a60c3889718f4513a6c9d8b80f655db5d6346905Romain Guy
33e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guyclass ANDROID_API Extensions: public Singleton<Extensions> {
34bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guypublic:
35bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy    inline bool hasNPot() const { return mHasNPot; }
36a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy    inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; }
379c4b79af221b53f602f946faa9ff317a596a0c39Romain Guy    inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
3813631f3da855f200a151e7837ed9f6b079622b58Romain Guy    inline bool hasDebugMarker() const { return mHasDebugMarker; }
39dfa1046ecab165eb0daf5caa8475e993350f4a2bRomain Guy    inline bool hasDebugLabel() const { return mHasDebugLabel; }
4085ef80d8902afe8d26cb75fa7837fd9e6d019620Romain Guy    inline bool hasTiledRendering() const { return mHasTiledRendering; }
413bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    inline bool has1BitStencil() const { return mHas1BitStencil; }
423bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    inline bool has4BitStencil() const { return mHas4BitStencil; }
43e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    inline bool hasNvSystemTime() const { return mHasNvSystemTime; }
44318ae7bb92869d99a05388c598ad105e7aa4cdbdRomain Guy    inline bool hasUnpackRowLength() const { return mVersionMajor >= 3; }
457f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy    inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; }
467f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy    inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; }
477f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy    inline bool hasFloatTextures() const { return mVersionMajor >= 3; }
487f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy
49df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    inline int getMajorGlVersion() const { return mVersionMajor; }
50df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    inline int getMinorGlVersion() const { return mVersionMinor; }
51df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy
52e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    bool hasGlExtension(const char* extension) const;
53e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    bool hasEglExtension(const char* extension) const;
54bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
553bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    void dump() const;
5651769a68a5cb34e9564740c6a854fcb93018789dRomain Guy
57bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guyprivate:
583b748a44c6bd2ea05fe16839caf73dbe50bd7ae9Romain Guy    Extensions();
593b748a44c6bd2ea05fe16839caf73dbe50bd7ae9Romain Guy    ~Extensions();
603b748a44c6bd2ea05fe16839caf73dbe50bd7ae9Romain Guy
61e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    void findExtensions(const char* extensions, SortedVector<String8>& list) const;
623bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy
63e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    friend class Singleton<Extensions>;
64bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
65e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    SortedVector<String8> mGlExtensionList;
66e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    SortedVector<String8> mEglExtensionList;
6751769a68a5cb34e9564740c6a854fcb93018789dRomain Guy
68bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy    bool mHasNPot;
69a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy    bool mHasFramebufferFetch;
709c4b79af221b53f602f946faa9ff317a596a0c39Romain Guy    bool mHasDiscardFramebuffer;
7113631f3da855f200a151e7837ed9f6b079622b58Romain Guy    bool mHasDebugMarker;
72dfa1046ecab165eb0daf5caa8475e993350f4a2bRomain Guy    bool mHasDebugLabel;
7385ef80d8902afe8d26cb75fa7837fd9e6d019620Romain Guy    bool mHasTiledRendering;
743bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    bool mHas1BitStencil;
753bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    bool mHas4BitStencil;
76e9bc11f7121dbe373b0cbe5779ee6a12d824492cRomain Guy    bool mHasNvSystemTime;
77df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy
78df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    int mVersionMajor;
79df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    int mVersionMinor;
80bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy}; // class Extensions
81bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
82bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy}; // namespace uirenderer
83bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy}; // namespace android
84bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
855b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#endif // ANDROID_HWUI_EXTENSIONS_H
86