blob: 1ec0fd915f4fa4cd8be2a0df229781d1b500a09e [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 <utils/Singleton.h>
Chia-I Wub027f802017-11-29 14:00:52 -080024#include <utils/SortedVector.h>
25#include <utils/String8.h>
Mathias Agopian1f7bec62010-06-25 18:02:21 -070026
27#include <EGL/egl.h>
28#include <EGL/eglext.h>
29#include <GLES/gl.h>
30#include <GLES/glext.h>
31
32namespace android {
33// ---------------------------------------------------------------------------
34
Chia-I Wub027f802017-11-29 14:00:52 -080035class GLExtensions : public Singleton<GLExtensions> {
Mathias Agopian1f7bec62010-06-25 18:02:21 -070036 friend class Singleton<GLExtensions>;
37
Chia-I Wu767d7c92017-11-30 13:22:48 -080038 bool mHasNoConfigContext = false;
Chia-I Wu767fcf72017-11-30 22:07:38 -080039 bool mHasNativeFenceSync = false;
40 bool mHasFenceSync = false;
41 bool mHasWaitSync = false;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070042
43 String8 mVendor;
44 String8 mRenderer;
45 String8 mVersion;
46 String8 mExtensions;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070047 SortedVector<String8> mExtensionList;
48
Chia-I Wu767d7c92017-11-30 13:22:48 -080049 String8 mEGLVersion;
50 String8 mEGLExtensions;
51 SortedVector<String8> mEGLExtensionList;
52
53 static SortedVector<String8> parseExtensionString(char const* extensions);
54
Mathias Agopian1f7bec62010-06-25 18:02:21 -070055 GLExtensions(const GLExtensions&);
Chia-I Wub027f802017-11-29 14:00:52 -080056 GLExtensions& operator=(const GLExtensions&);
Mathias Agopian1f7bec62010-06-25 18:02:21 -070057
58protected:
Chia-I Wu767d7c92017-11-30 13:22:48 -080059 GLExtensions() = default;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070060
61public:
Chia-I Wu767d7c92017-11-30 13:22:48 -080062 bool hasNoConfigContext() const { return mHasNoConfigContext; }
Chia-I Wu767fcf72017-11-30 22:07:38 -080063 bool hasNativeFenceSync() const { return mHasNativeFenceSync; }
64 bool hasFenceSync() const { return mHasFenceSync; }
65 bool hasWaitSync() const { return mHasWaitSync; }
Mathias Agopian1f7bec62010-06-25 18:02:21 -070066
Chia-I Wub027f802017-11-29 14:00:52 -080067 void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version,
68 GLubyte const* extensions);
Mathias Agopian1f7bec62010-06-25 18:02:21 -070069 char const* getVendor() const;
70 char const* getRenderer() const;
71 char const* getVersion() const;
Chia-I Wu767d7c92017-11-30 13:22:48 -080072 char const* getExtensions() const;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070073 bool hasExtension(char const* extension) const;
Chia-I Wu767d7c92017-11-30 13:22:48 -080074
75 void initWithEGLStrings(char const* eglVersion, char const* eglExtensions);
76 char const* getEGLVersion() const;
77 char const* getEGLExtensions() const;
78 bool hasEGLExtension(char const* extension) const;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070079};
80
Mathias Agopian1f7bec62010-06-25 18:02:21 -070081// ---------------------------------------------------------------------------
82}; // namespace android
83
84#endif // ANDROID_SF_GLEXTENSION_H