blob: ee7b4462d5575d4f30a0395e3c7d19a974e51aad [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
Mathias Agopian1b0b30d2010-09-24 11:26:58 -070038 bool mHaveFramebufferObject : 1;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070039
40 String8 mVendor;
41 String8 mRenderer;
42 String8 mVersion;
43 String8 mExtensions;
Mathias Agopian1f7bec62010-06-25 18:02:21 -070044 SortedVector<String8> mExtensionList;
45
46 GLExtensions(const GLExtensions&);
Chia-I Wub027f802017-11-29 14:00:52 -080047 GLExtensions& operator=(const GLExtensions&);
Mathias Agopian1f7bec62010-06-25 18:02:21 -070048
49protected:
50 GLExtensions();
51
52public:
Chia-I Wub027f802017-11-29 14:00:52 -080053 inline bool haveFramebufferObject() const { return mHaveFramebufferObject; }
Mathias Agopian1f7bec62010-06-25 18:02:21 -070054
Chia-I Wub027f802017-11-29 14:00:52 -080055 void initWithGLStrings(GLubyte const* vendor, GLubyte const* renderer, GLubyte const* version,
56 GLubyte const* extensions);
Mathias Agopian1f7bec62010-06-25 18:02:21 -070057
58 char const* getVendor() const;
59 char const* getRenderer() const;
60 char const* getVersion() const;
61 char const* getExtension() const;
62
Mathias Agopian1f7bec62010-06-25 18:02:21 -070063 bool hasExtension(char const* extension) const;
64};
65
Mathias Agopian1f7bec62010-06-25 18:02:21 -070066// ---------------------------------------------------------------------------
67}; // namespace android
68
69#endif // ANDROID_SF_GLEXTENSION_H