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