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
20bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guynamespace android {
21bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guynamespace uirenderer {
22bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
23a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy///////////////////////////////////////////////////////////////////////////////
24a60c3889718f4513a6c9d8b80f655db5d6346905Romain Guy// Classes
25a60c3889718f4513a6c9d8b80f655db5d6346905Romain Guy///////////////////////////////////////////////////////////////////////////////
26a60c3889718f4513a6c9d8b80f655db5d6346905Romain Guy
27704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckclass Extensions {
28bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guypublic:
291540153198fc59e5f344b363c198acf5b65251aaJohn Reck    Extensions();
30117bdbcfa3e8306dad21e7e01fa71b00cdfa7265Chris Craik
31bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy    inline bool hasNPot() const { return mHasNPot; }
32a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy    inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; }
339c4b79af221b53f602f946faa9ff317a596a0c39Romain Guy    inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
3413631f3da855f200a151e7837ed9f6b079622b58Romain Guy    inline bool hasDebugMarker() const { return mHasDebugMarker; }
353bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    inline bool has1BitStencil() const { return mHas1BitStencil; }
363bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    inline bool has4BitStencil() const { return mHas4BitStencil; }
37d538d30e2f498de12a46e2aa3b0814c8d9526226xiaozhengdong    inline bool hasUnpackRowLength() const { return mVersionMajor >= 3 || mHasUnpackSubImage; }
387f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy    inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; }
397f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy    inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; }
407f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy    inline bool hasFloatTextures() const { return mVersionMajor >= 3; }
418472ac67fd1d815022874f5addace0c4334ae9f6Romain Guy    inline bool hasRenderableFloatTextures() const {
428472ac67fd1d815022874f5addace0c4334ae9f6Romain Guy        return (mVersionMajor >= 3 && mVersionMinor >= 2) || mHasRenderableFloatTexture;
438472ac67fd1d815022874f5addace0c4334ae9f6Romain Guy    }
448762e332e3797fb41929a1c6069207f4906ca329Romain Guy    inline bool hasSRGB() const { return mHasSRGB; }
45253f2c213f6ecda63b6872aee77bd30d5ec07c82Romain Guy    inline bool hasSRGBWriteControl() const { return hasSRGB() && mHasSRGBWriteControl; }
46efb4b06493fe7b1604c762a448b13c7af2845a8dRomain Guy    inline bool hasLinearBlending() const { return hasSRGB() && mHasLinearBlending; }
477f4307668b10467ee39d41c7ea29cf1ff238a835Romain Guy
48df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    inline int getMajorGlVersion() const { return mVersionMajor; }
49df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    inline int getMinorGlVersion() const { return mVersionMinor; }
50df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy
51bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guyprivate:
52bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy    bool mHasNPot;
53a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy    bool mHasFramebufferFetch;
549c4b79af221b53f602f946faa9ff317a596a0c39Romain Guy    bool mHasDiscardFramebuffer;
5513631f3da855f200a151e7837ed9f6b079622b58Romain Guy    bool mHasDebugMarker;
563bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    bool mHas1BitStencil;
573bbacf27c0be1bae4e4483577fc89ae3113abe5dRomain Guy    bool mHas4BitStencil;
58d538d30e2f498de12a46e2aa3b0814c8d9526226xiaozhengdong    bool mHasUnpackSubImage;
59253f2c213f6ecda63b6872aee77bd30d5ec07c82Romain Guy    bool mHasSRGB;
60253f2c213f6ecda63b6872aee77bd30d5ec07c82Romain Guy    bool mHasSRGBWriteControl;
61efb4b06493fe7b1604c762a448b13c7af2845a8dRomain Guy    bool mHasLinearBlending;
628472ac67fd1d815022874f5addace0c4334ae9f6Romain Guy    bool mHasRenderableFloatTexture;
63df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy
64df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    int mVersionMajor;
65df1dc28ba0c63b195016ad0453fc58025ee82acbRomain Guy    int mVersionMinor;
661bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck};  // class Extensions
67bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
681bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck};  // namespace uirenderer
691bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck};  // namespace android
70bd0e6aa0ff0bd8b376772c3e23513a6021bdda87Romain Guy
711bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52John Reck#endif  // ANDROID_HWUI_EXTENSIONS_H
72