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 391f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian bool mHaveTextureExternal : 1; 401f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian bool mHaveNpot : 1; 411f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian bool mHaveDirectTexture : 1; 421b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian bool mHaveFramebufferObject : 1; 431f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 441f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mVendor; 451f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mRenderer; 461f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mVersion; 471f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mExtensions; 481f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mEglVendor; 491f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mEglVersion; 501f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian String8 mEglExtensions; 511f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian SortedVector<String8> mExtensionList; 521f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 531f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLExtensions(const GLExtensions&); 541f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLExtensions& operator = (const GLExtensions&); 551f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 561f7bec634f19c123410a5155c8d282e177c01930Mathias Agopianprotected: 571f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLExtensions(); 581f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 591f7bec634f19c123410a5155c8d282e177c01930Mathias Agopianpublic: 601f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian inline bool haveTextureExternal() const { 611f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian return mHaveTextureExternal; 621f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian } 631f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian inline bool haveNpot() const { 641f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian return mHaveNpot; 651f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian } 661f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian inline bool haveDirectTexture() const { 671f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian return mHaveDirectTexture; 681f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian } 691f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 701b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian inline bool haveFramebufferObject() const { 711b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian return mHaveFramebufferObject; 721b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian } 731b0b30d04304392748a8a4ab5a69e52a19f51b3aMathias Agopian 741f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian void initWithGLStrings( 751f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLubyte const* vendor, 761f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLubyte const* renderer, 771f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLubyte const* version, 781f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian GLubyte const* extensions, 791f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* egl_vendor, 801f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* egl_version, 811f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* egl_extensions); 821f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 831f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getVendor() const; 841f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getRenderer() const; 851f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getVersion() const; 861f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getExtension() const; 871f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 881f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getEglVendor() const; 891f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getEglVersion() const; 901f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian char const* getEglExtension() const; 911f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 921f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian bool hasExtension(char const* extension) const; 931f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian}; 941f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 951f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 961f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian// --------------------------------------------------------------------------- 971f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian}; // namespace android 981f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian 991f7bec634f19c123410a5155c8d282e177c01930Mathias Agopian#endif // ANDROID_SF_GLEXTENSION_H 100