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