1 /* 2 * Copyright (C) 2011 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 #ifndef _LIBRENDER_FBCONFIG_H 17 #define _LIBRENDER_FBCONFIG_H 18 19 #include <EGL/egl.h> 20 #include <GLES/gl.h> 21 22 class FrameBuffer; 23 24 enum InitConfigStatus { 25 INIT_CONFIG_FAILED = 0, 26 INIT_CONFIG_PASSED = 1 27 }; 28 29 class FBConfig 30 { 31 public: 32 static InitConfigStatus initConfigList(FrameBuffer *fb); 33 static const FBConfig *get(int p_config); 34 static int getNumConfigs(); getNumAttribs()35 static int getNumAttribs() { return s_numConfigAttribs; } 36 static void packConfigsInfo(GLuint *buffer); 37 static int chooseConfig(FrameBuffer *fb, EGLint * attribs, uint32_t * configs, uint32_t configs_size); 38 ~FBConfig(); 39 getEGLConfig()40 EGLConfig getEGLConfig() const { return m_eglConfig; } getDepthSize()41 GLuint getDepthSize() const { return (m_attribValues ? m_attribValues[0] : 0); } getStencilSize()42 GLuint getStencilSize() const { return (m_attribValues ? m_attribValues[1] : 0); } getRenderableType()43 GLuint getRenderableType() const { return (m_attribValues ? m_attribValues[2] : 0); } getSurfaceType()44 GLuint getSurfaceType() const { return (m_attribValues ? m_attribValues[3] : 0); } 45 46 private: 47 FBConfig(EGLDisplay p_eglDpy, EGLConfig p_eglCfg); 48 49 private: 50 static FBConfig **s_fbConfigs; 51 static int s_numConfigs; 52 static const int s_numConfigAttribs; 53 static const GLuint s_configAttribs[]; 54 55 private: 56 EGLConfig m_eglConfig; 57 GLint *m_attribValues; 58 }; 59 60 #endif 61