11f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian/*
21f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * Copyright (C) 2010 The Android Open Source Project
31f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian *
41f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
51f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * you may not use this file except in compliance with the License.
61f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * You may obtain a copy of the License at
71f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian *
81f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
91f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian *
101f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * Unless required by applicable law or agreed to in writing, software
111f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
121f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * See the License for the specific language governing permissions and
141f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian * limitations under the License.
151f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian */
161f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
171f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#ifndef ANDROID_SF_GLEXTENSION_H
181f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#define ANDROID_SF_GLEXTENSION_H
191f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
201f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <stdint.h>
211f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <sys/types.h>
221f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
231f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <utils/String8.h>
241f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <utils/SortedVector.h>
251f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <utils/Singleton.h>
261f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
271f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <EGL/egl.h>
281f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <EGL/eglext.h>
291f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <GLES/gl.h>
301f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#include <GLES/glext.h>
311f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
321f7bec634f19c123410a5155c8d282e177c01930Mathias Agopiannamespace android {
331f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian// ---------------------------------------------------------------------------
341f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
351f7bec634f19c123410a5155c8d282e177c01930Mathias Agopianclass GLExtensions : public Singleton<GLExtensions>
361f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian{
371f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    friend class Singleton<GLExtensions>;
381f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
391b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian    bool mHaveFramebufferObject : 1;
401f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
411f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    String8 mVendor;
421f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    String8 mRenderer;
431f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    String8 mVersion;
441f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    String8 mExtensions;
451f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    SortedVector<String8> mExtensionList;
461f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
471f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    GLExtensions(const GLExtensions&);
481f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    GLExtensions& operator = (const GLExtensions&);
491f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
501f7bec634f19c123410a5155c8d282e177c01930Mathias Agopianprotected:
511f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    GLExtensions();
521f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
531f7bec634f19c123410a5155c8d282e177c01930Mathias Agopianpublic:
541f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
551b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian    inline bool haveFramebufferObject() const {
561b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian        return mHaveFramebufferObject;
571b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian    }
581b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian
591f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    void initWithGLStrings(
601f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian            GLubyte const* vendor,
611f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian            GLubyte const* renderer,
621f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian            GLubyte const* version,
63875d8e1323536e16dcfc90c9674d7ad32116a69aMathias Agopian            GLubyte const* extensions);
641f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
651f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    char const* getVendor() const;
661f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    char const* getRenderer() const;
671f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    char const* getVersion() const;
681f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    char const* getExtension() const;
691f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
701f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian    bool hasExtension(char const* extension) const;
711f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian};
721f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
731f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
741f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian// ---------------------------------------------------------------------------
751f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian}; // namespace android
761f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian
771f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#endif // ANDROID_SF_GLEXTENSION_H
78