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 23 #include <EGL/egl.h> 24 #include <EGL/eglext.h> 25 #include <GLES/gl.h> 26 #include <GLES/glext.h> 27 #include <utils/Singleton.h> 28 #include <utils/String8.h> 29 30 namespace android { 31 namespace renderengine { 32 namespace skia { 33 34 class GLExtensions : public Singleton<GLExtensions> { 35 public: hasNoConfigContext()36 bool hasNoConfigContext() const { return mHasNoConfigContext; } hasNativeFenceSync()37 bool hasNativeFenceSync() const { return mHasNativeFenceSync; } hasFenceSync()38 bool hasFenceSync() const { return mHasFenceSync; } hasWaitSync()39 bool hasWaitSync() const { return mHasWaitSync; } hasProtectedContent()40 bool hasProtectedContent() const { return mHasProtectedContent; } hasContextPriority()41 bool hasContextPriority() const { return mHasContextPriority; } hasSurfacelessContext()42 bool hasSurfacelessContext() const { return mHasSurfacelessContext; } hasProtectedTexture()43 bool hasProtectedTexture() const { return mHasProtectedTexture; } hasRealtimePriority()44 bool hasRealtimePriority() const { return mHasRealtimePriority; } 45 46 void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version, 47 GLubyte const* extensions); 48 char const* getVendor() const; 49 char const* getRenderer() const; 50 char const* getVersion() const; 51 char const* getExtensions() const; 52 53 void initWithEGLStrings(char const* eglVersion, char const* eglExtensions); 54 char const* getEGLVersion() const; 55 char const* getEGLExtensions() const; 56 57 protected: 58 GLExtensions() = default; 59 60 private: 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; 70 bool mHasProtectedTexture = false; 71 bool mHasRealtimePriority = false; 72 73 String8 mVendor; 74 String8 mRenderer; 75 String8 mVersion; 76 String8 mExtensions; 77 String8 mEGLVersion; 78 String8 mEGLExtensions; 79 80 GLExtensions(const GLExtensions&); 81 GLExtensions& operator=(const GLExtensions&); 82 }; 83 84 } // namespace skia 85 } // namespace renderengine 86 } // namespace android 87 88 #endif // ANDROID_SF_GLEXTENSION_H 89