Home | History | Annotate | Download | only in hwui
      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 namespace android {
     21 namespace uirenderer {
     22 
     23 ///////////////////////////////////////////////////////////////////////////////
     24 // Classes
     25 ///////////////////////////////////////////////////////////////////////////////
     26 
     27 class Extensions {
     28 public:
     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 hasRenderableFloatTextures() const {
     42         return (mVersionMajor >= 3 && mVersionMinor >= 2) || mHasRenderableFloatTexture;
     43     }
     44     inline bool hasSRGB() const { return mHasSRGB; }
     45     inline bool hasSRGBWriteControl() const { return hasSRGB() && mHasSRGBWriteControl; }
     46     inline bool hasLinearBlending() const { return hasSRGB() && mHasLinearBlending; }
     47 
     48     inline int getMajorGlVersion() const { return mVersionMajor; }
     49     inline int getMinorGlVersion() const { return mVersionMinor; }
     50 
     51 private:
     52     bool mHasNPot;
     53     bool mHasFramebufferFetch;
     54     bool mHasDiscardFramebuffer;
     55     bool mHasDebugMarker;
     56     bool mHas1BitStencil;
     57     bool mHas4BitStencil;
     58     bool mHasUnpackSubImage;
     59     bool mHasSRGB;
     60     bool mHasSRGBWriteControl;
     61     bool mHasLinearBlending;
     62     bool mHasRenderableFloatTexture;
     63 
     64     int mVersionMajor;
     65     int mVersionMinor;
     66 };  // class Extensions
     67 
     68 };  // namespace uirenderer
     69 };  // namespace android
     70 
     71 #endif  // ANDROID_HWUI_EXTENSIONS_H
     72