xref: /aosp_15_r20/frameworks/native/libs/renderengine/skia/GLExtensions.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker  * Copyright (C) 2010 The Android Open Source Project
3*38e8c45fSAndroid Build Coastguard Worker  *
4*38e8c45fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*38e8c45fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*38e8c45fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*38e8c45fSAndroid Build Coastguard Worker  *
8*38e8c45fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*38e8c45fSAndroid Build Coastguard Worker  *
10*38e8c45fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*38e8c45fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*38e8c45fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*38e8c45fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*38e8c45fSAndroid Build Coastguard Worker  * limitations under the License.
15*38e8c45fSAndroid Build Coastguard Worker  */
16*38e8c45fSAndroid Build Coastguard Worker 
17*38e8c45fSAndroid Build Coastguard Worker #ifndef ANDROID_SF_GLEXTENSION_H
18*38e8c45fSAndroid Build Coastguard Worker #define ANDROID_SF_GLEXTENSION_H
19*38e8c45fSAndroid Build Coastguard Worker 
20*38e8c45fSAndroid Build Coastguard Worker #include <stdint.h>
21*38e8c45fSAndroid Build Coastguard Worker #include <sys/types.h>
22*38e8c45fSAndroid Build Coastguard Worker 
23*38e8c45fSAndroid Build Coastguard Worker #include <EGL/egl.h>
24*38e8c45fSAndroid Build Coastguard Worker #include <EGL/eglext.h>
25*38e8c45fSAndroid Build Coastguard Worker #include <GLES/gl.h>
26*38e8c45fSAndroid Build Coastguard Worker #include <GLES/glext.h>
27*38e8c45fSAndroid Build Coastguard Worker #include <utils/Singleton.h>
28*38e8c45fSAndroid Build Coastguard Worker #include <utils/String8.h>
29*38e8c45fSAndroid Build Coastguard Worker 
30*38e8c45fSAndroid Build Coastguard Worker namespace android {
31*38e8c45fSAndroid Build Coastguard Worker namespace renderengine {
32*38e8c45fSAndroid Build Coastguard Worker namespace skia {
33*38e8c45fSAndroid Build Coastguard Worker 
34*38e8c45fSAndroid Build Coastguard Worker class GLExtensions : public Singleton<GLExtensions> {
35*38e8c45fSAndroid Build Coastguard Worker public:
hasNoConfigContext()36*38e8c45fSAndroid Build Coastguard Worker     bool hasNoConfigContext() const { return mHasNoConfigContext; }
hasNativeFenceSync()37*38e8c45fSAndroid Build Coastguard Worker     bool hasNativeFenceSync() const { return mHasNativeFenceSync; }
hasFenceSync()38*38e8c45fSAndroid Build Coastguard Worker     bool hasFenceSync() const { return mHasFenceSync; }
hasWaitSync()39*38e8c45fSAndroid Build Coastguard Worker     bool hasWaitSync() const { return mHasWaitSync; }
hasProtectedContent()40*38e8c45fSAndroid Build Coastguard Worker     bool hasProtectedContent() const { return mHasProtectedContent; }
hasContextPriority()41*38e8c45fSAndroid Build Coastguard Worker     bool hasContextPriority() const { return mHasContextPriority; }
hasSurfacelessContext()42*38e8c45fSAndroid Build Coastguard Worker     bool hasSurfacelessContext() const { return mHasSurfacelessContext; }
hasProtectedTexture()43*38e8c45fSAndroid Build Coastguard Worker     bool hasProtectedTexture() const { return mHasProtectedTexture; }
hasRealtimePriority()44*38e8c45fSAndroid Build Coastguard Worker     bool hasRealtimePriority() const { return mHasRealtimePriority; }
45*38e8c45fSAndroid Build Coastguard Worker 
46*38e8c45fSAndroid Build Coastguard Worker     void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version,
47*38e8c45fSAndroid Build Coastguard Worker                            GLubyte const* extensions);
48*38e8c45fSAndroid Build Coastguard Worker     char const* getVendor() const;
49*38e8c45fSAndroid Build Coastguard Worker     char const* getRenderer() const;
50*38e8c45fSAndroid Build Coastguard Worker     char const* getVersion() const;
51*38e8c45fSAndroid Build Coastguard Worker     char const* getExtensions() const;
52*38e8c45fSAndroid Build Coastguard Worker 
53*38e8c45fSAndroid Build Coastguard Worker     void initWithEGLStrings(char const* eglVersion, char const* eglExtensions);
54*38e8c45fSAndroid Build Coastguard Worker     char const* getEGLVersion() const;
55*38e8c45fSAndroid Build Coastguard Worker     char const* getEGLExtensions() const;
56*38e8c45fSAndroid Build Coastguard Worker 
57*38e8c45fSAndroid Build Coastguard Worker protected:
58*38e8c45fSAndroid Build Coastguard Worker     GLExtensions() = default;
59*38e8c45fSAndroid Build Coastguard Worker 
60*38e8c45fSAndroid Build Coastguard Worker private:
61*38e8c45fSAndroid Build Coastguard Worker     friend class Singleton<GLExtensions>;
62*38e8c45fSAndroid Build Coastguard Worker 
63*38e8c45fSAndroid Build Coastguard Worker     bool mHasNoConfigContext = false;
64*38e8c45fSAndroid Build Coastguard Worker     bool mHasNativeFenceSync = false;
65*38e8c45fSAndroid Build Coastguard Worker     bool mHasFenceSync = false;
66*38e8c45fSAndroid Build Coastguard Worker     bool mHasWaitSync = false;
67*38e8c45fSAndroid Build Coastguard Worker     bool mHasProtectedContent = false;
68*38e8c45fSAndroid Build Coastguard Worker     bool mHasContextPriority = false;
69*38e8c45fSAndroid Build Coastguard Worker     bool mHasSurfacelessContext = false;
70*38e8c45fSAndroid Build Coastguard Worker     bool mHasProtectedTexture = false;
71*38e8c45fSAndroid Build Coastguard Worker     bool mHasRealtimePriority = false;
72*38e8c45fSAndroid Build Coastguard Worker 
73*38e8c45fSAndroid Build Coastguard Worker     String8 mVendor;
74*38e8c45fSAndroid Build Coastguard Worker     String8 mRenderer;
75*38e8c45fSAndroid Build Coastguard Worker     String8 mVersion;
76*38e8c45fSAndroid Build Coastguard Worker     String8 mExtensions;
77*38e8c45fSAndroid Build Coastguard Worker     String8 mEGLVersion;
78*38e8c45fSAndroid Build Coastguard Worker     String8 mEGLExtensions;
79*38e8c45fSAndroid Build Coastguard Worker 
80*38e8c45fSAndroid Build Coastguard Worker     GLExtensions(const GLExtensions&);
81*38e8c45fSAndroid Build Coastguard Worker     GLExtensions& operator=(const GLExtensions&);
82*38e8c45fSAndroid Build Coastguard Worker };
83*38e8c45fSAndroid Build Coastguard Worker 
84*38e8c45fSAndroid Build Coastguard Worker } // namespace skia
85*38e8c45fSAndroid Build Coastguard Worker } // namespace renderengine
86*38e8c45fSAndroid Build Coastguard Worker } // namespace android
87*38e8c45fSAndroid Build Coastguard Worker 
88*38e8c45fSAndroid Build Coastguard Worker #endif // ANDROID_SF_GLEXTENSION_H
89