blob: bbb284e76892998d5516701171e17661802377a6 [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
23#include <utils/String8.h>
24#include <utils/SortedVector.h>
25#include <utils/Singleton.h>
26
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
35class GLExtensions : public Singleton<GLExtensions>
36{
37 friend class Singleton<GLExtensions>;
38
39 bool mHaveTextureExternal : 1;
40 bool mHaveNpot : 1;
41 bool mHaveDirectTexture : 1;
42
43 String8 mVendor;
44 String8 mRenderer;
45 String8 mVersion;
46 String8 mExtensions;
47 String8 mEglVendor;
48 String8 mEglVersion;
49 String8 mEglExtensions;
50 SortedVector<String8> mExtensionList;
51
52 GLExtensions(const GLExtensions&);
53 GLExtensions& operator = (const GLExtensions&);
54
55protected:
56 GLExtensions();
57
58public:
59 inline bool haveTextureExternal() const {
60 return mHaveTextureExternal;
61 }
62 inline bool haveNpot() const {
63 return mHaveNpot;
64 }
65 inline bool haveDirectTexture() const {
66 return mHaveDirectTexture;
67 }
68
69 void initWithGLStrings(
70 GLubyte const* vendor,
71 GLubyte const* renderer,
72 GLubyte const* version,
73 GLubyte const* extensions,
74 char const* egl_vendor,
75 char const* egl_version,
76 char const* egl_extensions);
77
78 char const* getVendor() const;
79 char const* getRenderer() const;
80 char const* getVersion() const;
81 char const* getExtension() const;
82
83 char const* getEglVendor() const;
84 char const* getEglVersion() const;
85 char const* getEglExtension() const;
86
87 bool hasExtension(char const* extension) const;
88};
89
90
91// ---------------------------------------------------------------------------
92}; // namespace android
93
94#endif // ANDROID_SF_GLEXTENSION_H