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