Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 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_SF_GLEXTENSION_H |
| 18 | #define ANDROID_SF_GLEXTENSION_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 23 | #include <EGL/egl.h> |
| 24 | #include <EGL/eglext.h> |
| 25 | #include <GLES/gl.h> |
| 26 | #include <GLES/glext.h> |
Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 27 | #include <utils/Singleton.h> |
Peiyong Lin | cbc184f | 2018-08-22 13:24:10 -0700 | [diff] [blame] | 28 | #include <utils/String8.h> |
| 29 | |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 30 | namespace android { |
Peiyong Lin | 833074a | 2018-08-28 11:53:54 -0700 | [diff] [blame] | 31 | namespace renderengine { |
| 32 | namespace gl { |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 33 | |
Chia-I Wu | b027f80 | 2017-11-29 14:00:52 -0800 | [diff] [blame] | 34 | class GLExtensions : public Singleton<GLExtensions> { |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 35 | public: |
Chia-I Wu | 767d7c9 | 2017-11-30 13:22:48 -0800 | [diff] [blame] | 36 | bool hasNoConfigContext() const { return mHasNoConfigContext; } |
Chia-I Wu | 767fcf7 | 2017-11-30 22:07:38 -0800 | [diff] [blame] | 37 | bool hasNativeFenceSync() const { return mHasNativeFenceSync; } |
| 38 | bool hasFenceSync() const { return mHasFenceSync; } |
| 39 | bool hasWaitSync() const { return mHasWaitSync; } |
Chia-I Wu | 401ef83 | 2017-12-01 10:52:22 -0800 | [diff] [blame] | 40 | bool hasProtectedContent() const { return mHasProtectedContent; } |
Jorim Jaggi | 5b15ef6 | 2018-01-17 18:31:39 +0100 | [diff] [blame] | 41 | bool hasContextPriority() const { return mHasContextPriority; } |
Peiyong Lin | a5e9f1b | 2018-11-27 22:49:37 -0800 | [diff] [blame] | 42 | bool hasSurfacelessContext() const { return mHasSurfacelessContext; } |
Peiyong Lin | fb530cf | 2018-12-15 05:07:38 +0000 | [diff] [blame] | 43 | bool hasProtectedTexture() const { return mHasProtectedTexture; } |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 44 | |
Chia-I Wu | b027f80 | 2017-11-29 14:00:52 -0800 | [diff] [blame] | 45 | void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version, |
| 46 | GLubyte const* extensions); |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 47 | char const* getVendor() const; |
| 48 | char const* getRenderer() const; |
| 49 | char const* getVersion() const; |
Chia-I Wu | 767d7c9 | 2017-11-30 13:22:48 -0800 | [diff] [blame] | 50 | char const* getExtensions() const; |
Chia-I Wu | 767d7c9 | 2017-11-30 13:22:48 -0800 | [diff] [blame] | 51 | |
| 52 | void initWithEGLStrings(char const* eglVersion, char const* eglExtensions); |
| 53 | char const* getEGLVersion() const; |
| 54 | char const* getEGLExtensions() const; |
Peiyong Lin | a5e9f1b | 2018-11-27 22:49:37 -0800 | [diff] [blame] | 55 | |
| 56 | protected: |
| 57 | GLExtensions() = default; |
| 58 | |
| 59 | private: |
| 60 | friend class Singleton<GLExtensions>; |
| 61 | |
| 62 | bool mHasNoConfigContext = false; |
| 63 | bool mHasNativeFenceSync = false; |
| 64 | bool mHasFenceSync = false; |
| 65 | bool mHasWaitSync = false; |
| 66 | bool mHasProtectedContent = false; |
| 67 | bool mHasContextPriority = false; |
| 68 | bool mHasSurfacelessContext = false; |
Peiyong Lin | fb530cf | 2018-12-15 05:07:38 +0000 | [diff] [blame] | 69 | bool mHasProtectedTexture = false; |
Peiyong Lin | a5e9f1b | 2018-11-27 22:49:37 -0800 | [diff] [blame] | 70 | |
| 71 | String8 mVendor; |
| 72 | String8 mRenderer; |
| 73 | String8 mVersion; |
| 74 | String8 mExtensions; |
Peiyong Lin | a5e9f1b | 2018-11-27 22:49:37 -0800 | [diff] [blame] | 75 | String8 mEGLVersion; |
| 76 | String8 mEGLExtensions; |
| 77 | |
| 78 | GLExtensions(const GLExtensions&); |
| 79 | GLExtensions& operator=(const GLExtensions&); |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
Peiyong Lin | 46080ef | 2018-10-26 18:43:14 -0700 | [diff] [blame] | 82 | } // namespace gl |
| 83 | } // namespace renderengine |
| 84 | } // namespace android |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 85 | |
| 86 | #endif // ANDROID_SF_GLEXTENSION_H |