blob: 0cb1bda0df59bdf484d7f83362c3da03529bda5f [file] [log] [blame]
Mathias Agopian1f7bec62010-06-25 18:02:21 -07001/*
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_SF_GLEXTENSION_H
18#define ANDROID_SF_GLEXTENSION_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
Mathias Agopian1f7bec62010-06-25 18:02:21 -070023#include <EGL/egl.h>
24#include <EGL/eglext.h>
25#include <GLES/gl.h>
26#include <GLES/glext.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070027#include <utils/Singleton.h>
Peiyong Lincbc184f2018-08-22 13:24:10 -070028#include <utils/String8.h>
29
Mathias Agopian1f7bec62010-06-25 18:02:21 -070030namespace android {
Peiyong Lin833074a2018-08-28 11:53:54 -070031namespace renderengine {
Alec Mourie2b61c62023-08-15 19:04:54 +000032namespace skia {
Mathias Agopian1f7bec62010-06-25 18:02:21 -070033
Chia-I Wub027f802017-11-29 14:00:52 -080034class GLExtensions : public Singleton<GLExtensions> {
Mathias Agopian1f7bec62010-06-25 18:02:21 -070035public:
Chia-I Wu767d7c92017-11-30 13:22:48 -080036 bool hasNoConfigContext() const { return mHasNoConfigContext; }
Chia-I Wu767fcf72017-11-30 22:07:38 -080037 bool hasNativeFenceSync() const { return mHasNativeFenceSync; }
38 bool hasFenceSync() const { return mHasFenceSync; }
39 bool hasWaitSync() const { return mHasWaitSync; }
Chia-I Wu401ef832017-12-01 10:52:22 -080040 bool hasProtectedContent() const { return mHasProtectedContent; }
Jorim Jaggi5b15ef62018-01-17 18:31:39 +010041 bool hasContextPriority() const { return mHasContextPriority; }
Peiyong Lina5e9f1b2018-11-27 22:49:37 -080042 bool hasSurfacelessContext() const { return mHasSurfacelessContext; }
Peiyong Linfb530cf2018-12-15 05:07:38 +000043 bool hasProtectedTexture() const { return mHasProtectedTexture; }
Alec Mourid6f09462020-12-07 11:18:17 -080044 bool hasRealtimePriority() const { return mHasRealtimePriority; }
Mathias Agopian1f7bec62010-06-25 18:02:21 -070045
Chia-I Wub027f802017-11-29 14:00:52 -080046 void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version,
47 GLubyte const* extensions);
Mathias Agopian1f7bec62010-06-25 18:02:21 -070048 char const* getVendor() const;
49 char const* getRenderer() const;
50 char const* getVersion() const;
Chia-I Wu767d7c92017-11-30 13:22:48 -080051 char const* getExtensions() const;
Chia-I Wu767d7c92017-11-30 13:22:48 -080052
53 void initWithEGLStrings(char const* eglVersion, char const* eglExtensions);
54 char const* getEGLVersion() const;
55 char const* getEGLExtensions() const;
Peiyong Lina5e9f1b2018-11-27 22:49:37 -080056
57protected:
58 GLExtensions() = default;
59
60private:
61 friend class Singleton<GLExtensions>;
62
63 bool mHasNoConfigContext = false;
64 bool mHasNativeFenceSync = false;
65 bool mHasFenceSync = false;
66 bool mHasWaitSync = false;
67 bool mHasProtectedContent = false;
68 bool mHasContextPriority = false;
69 bool mHasSurfacelessContext = false;
Peiyong Linfb530cf2018-12-15 05:07:38 +000070 bool mHasProtectedTexture = false;
Alec Mourid6f09462020-12-07 11:18:17 -080071 bool mHasRealtimePriority = false;
Peiyong Lina5e9f1b2018-11-27 22:49:37 -080072
73 String8 mVendor;
74 String8 mRenderer;
75 String8 mVersion;
76 String8 mExtensions;
Peiyong Lina5e9f1b2018-11-27 22:49:37 -080077 String8 mEGLVersion;
78 String8 mEGLExtensions;
79
80 GLExtensions(const GLExtensions&);
81 GLExtensions& operator=(const GLExtensions&);
Mathias Agopian1f7bec62010-06-25 18:02:21 -070082};
83
Alec Mourie2b61c62023-08-15 19:04:54 +000084} // namespace skia
Peiyong Lin46080ef2018-10-26 18:43:14 -070085} // namespace renderengine
86} // namespace android
Mathias Agopian1f7bec62010-06-25 18:02:21 -070087
88#endif // ANDROID_SF_GLEXTENSION_H