1*8975f5c5SAndroid Build Coastguard Worker // 2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2002 The ANGLE Project Authors. All rights reserved. 3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker // 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Worker // Config.h: Defines the egl::Config class, describing the format, type 8*8975f5c5SAndroid Build Coastguard Worker // and size for an egl::Surface. Implements EGLConfig and related functionality. 9*8975f5c5SAndroid Build Coastguard Worker // [EGL 1.5] section 3.4 page 19. 10*8975f5c5SAndroid Build Coastguard Worker 11*8975f5c5SAndroid Build Coastguard Worker #ifndef INCLUDE_CONFIG_H_ 12*8975f5c5SAndroid Build Coastguard Worker #define INCLUDE_CONFIG_H_ 13*8975f5c5SAndroid Build Coastguard Worker 14*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/AttributeMap.h" 15*8975f5c5SAndroid Build Coastguard Worker 16*8975f5c5SAndroid Build Coastguard Worker #include "common/angleutils.h" 17*8975f5c5SAndroid Build Coastguard Worker 18*8975f5c5SAndroid Build Coastguard Worker #include <EGL/egl.h> 19*8975f5c5SAndroid Build Coastguard Worker #include <GLES2/gl2.h> 20*8975f5c5SAndroid Build Coastguard Worker 21*8975f5c5SAndroid Build Coastguard Worker #include <map> 22*8975f5c5SAndroid Build Coastguard Worker #include <vector> 23*8975f5c5SAndroid Build Coastguard Worker 24*8975f5c5SAndroid Build Coastguard Worker namespace egl 25*8975f5c5SAndroid Build Coastguard Worker { 26*8975f5c5SAndroid Build Coastguard Worker 27*8975f5c5SAndroid Build Coastguard Worker struct Config 28*8975f5c5SAndroid Build Coastguard Worker { 29*8975f5c5SAndroid Build Coastguard Worker Config(); 30*8975f5c5SAndroid Build Coastguard Worker ~Config(); 31*8975f5c5SAndroid Build Coastguard Worker Config(const Config &other); 32*8975f5c5SAndroid Build Coastguard Worker Config &operator=(const Config &other); 33*8975f5c5SAndroid Build Coastguard Worker 34*8975f5c5SAndroid Build Coastguard Worker GLenum renderTargetFormat; // TODO(geofflang): remove this 35*8975f5c5SAndroid Build Coastguard Worker GLenum depthStencilFormat; // TODO(geofflang): remove this 36*8975f5c5SAndroid Build Coastguard Worker 37*8975f5c5SAndroid Build Coastguard Worker EGLint bufferSize; // Depth of the color buffer 38*8975f5c5SAndroid Build Coastguard Worker EGLint redSize; // Bits of Red in the color buffer 39*8975f5c5SAndroid Build Coastguard Worker EGLint greenSize; // Bits of Green in the color buffer 40*8975f5c5SAndroid Build Coastguard Worker EGLint blueSize; // Bits of Blue in the color buffer 41*8975f5c5SAndroid Build Coastguard Worker EGLint luminanceSize; // Bits of Luminance in the color buffer 42*8975f5c5SAndroid Build Coastguard Worker EGLint alphaSize; // Bits of Alpha in the color buffer 43*8975f5c5SAndroid Build Coastguard Worker EGLint alphaMaskSize; // Bits of Alpha Mask in the mask buffer 44*8975f5c5SAndroid Build Coastguard Worker EGLBoolean bindToTextureRGB; // True if bindable to RGB textures. 45*8975f5c5SAndroid Build Coastguard Worker EGLBoolean bindToTextureRGBA; // True if bindable to RGBA textures. 46*8975f5c5SAndroid Build Coastguard Worker EGLenum bindToTextureTarget; // Which texture target should be used for pbuffers 47*8975f5c5SAndroid Build Coastguard Worker EGLenum colorBufferType; // Color buffer type 48*8975f5c5SAndroid Build Coastguard Worker EGLenum configCaveat; // Any caveats for the configuration 49*8975f5c5SAndroid Build Coastguard Worker EGLint configID; // Unique EGLConfig identifier 50*8975f5c5SAndroid Build Coastguard Worker EGLint conformant; // Whether contexts created with this config are conformant 51*8975f5c5SAndroid Build Coastguard Worker EGLint depthSize; // Bits of Z in the depth buffer 52*8975f5c5SAndroid Build Coastguard Worker EGLint level; // Frame buffer level 53*8975f5c5SAndroid Build Coastguard Worker EGLBoolean matchNativePixmap; // Match the native pixmap format 54*8975f5c5SAndroid Build Coastguard Worker EGLint maxPBufferWidth; // Maximum width of pbuffer 55*8975f5c5SAndroid Build Coastguard Worker EGLint maxPBufferHeight; // Maximum height of pbuffer 56*8975f5c5SAndroid Build Coastguard Worker EGLint maxPBufferPixels; // Maximum size of pbuffer 57*8975f5c5SAndroid Build Coastguard Worker EGLint maxSwapInterval; // Maximum swap interval 58*8975f5c5SAndroid Build Coastguard Worker EGLint minSwapInterval; // Minimum swap interval 59*8975f5c5SAndroid Build Coastguard Worker EGLBoolean nativeRenderable; // EGL_TRUE if native rendering APIs can render to surface 60*8975f5c5SAndroid Build Coastguard Worker EGLint nativeVisualID; // Handle of corresponding native visual 61*8975f5c5SAndroid Build Coastguard Worker EGLint nativeVisualType; // Native visual type of the associated visual 62*8975f5c5SAndroid Build Coastguard Worker EGLint renderableType; // Which client rendering APIs are supported. 63*8975f5c5SAndroid Build Coastguard Worker EGLint sampleBuffers; // Number of multisample buffers 64*8975f5c5SAndroid Build Coastguard Worker EGLint samples; // Number of samples per pixel 65*8975f5c5SAndroid Build Coastguard Worker EGLint stencilSize; // Bits of Stencil in the stencil buffer 66*8975f5c5SAndroid Build Coastguard Worker EGLint surfaceType; // Which types of EGL surfaces are supported. 67*8975f5c5SAndroid Build Coastguard Worker EGLenum transparentType; // Type of transparency supported 68*8975f5c5SAndroid Build Coastguard Worker EGLint transparentRedValue; // Transparent red value 69*8975f5c5SAndroid Build Coastguard Worker EGLint transparentGreenValue; // Transparent green value 70*8975f5c5SAndroid Build Coastguard Worker EGLint transparentBlueValue; // Transparent blue value 71*8975f5c5SAndroid Build Coastguard Worker EGLint optimalOrientation; // Optimal window surface orientation 72*8975f5c5SAndroid Build Coastguard Worker EGLenum colorComponentType; // Color component type 73*8975f5c5SAndroid Build Coastguard Worker EGLBoolean recordable; // EGL_TRUE if a surface can support recording on Android 74*8975f5c5SAndroid Build Coastguard Worker EGLBoolean framebufferTarget; // EGL_TRUE if the config supports rendering to a ANativeWindow 75*8975f5c5SAndroid Build Coastguard Worker // for which the buffers are passed to the HWComposer HAL as a 76*8975f5c5SAndroid Build Coastguard Worker // framebuffer target layer. 77*8975f5c5SAndroid Build Coastguard Worker EGLBoolean yInverted; // True if the drawable's framebuffer is y-inverted. This can be used to 78*8975f5c5SAndroid Build Coastguard Worker // determine if y-inverted texture coordinates need to be used when 79*8975f5c5SAndroid Build Coastguard Worker // texturing from this drawable when it is bound to a texture target. 80*8975f5c5SAndroid Build Coastguard Worker EGLint matchFormat; // LockSurface match format. 81*8975f5c5SAndroid Build Coastguard Worker }; 82*8975f5c5SAndroid Build Coastguard Worker 83*8975f5c5SAndroid Build Coastguard Worker class ConfigSet 84*8975f5c5SAndroid Build Coastguard Worker { 85*8975f5c5SAndroid Build Coastguard Worker private: 86*8975f5c5SAndroid Build Coastguard Worker typedef std::map<EGLint, Config> ConfigMap; 87*8975f5c5SAndroid Build Coastguard Worker 88*8975f5c5SAndroid Build Coastguard Worker public: 89*8975f5c5SAndroid Build Coastguard Worker ConfigSet(); 90*8975f5c5SAndroid Build Coastguard Worker ConfigSet(const ConfigSet &other); 91*8975f5c5SAndroid Build Coastguard Worker ~ConfigSet(); 92*8975f5c5SAndroid Build Coastguard Worker ConfigSet &operator=(const ConfigSet &other); 93*8975f5c5SAndroid Build Coastguard Worker 94*8975f5c5SAndroid Build Coastguard Worker EGLint add(const Config &config); 95*8975f5c5SAndroid Build Coastguard Worker const Config &get(EGLint id) const; 96*8975f5c5SAndroid Build Coastguard Worker 97*8975f5c5SAndroid Build Coastguard Worker void clear(); 98*8975f5c5SAndroid Build Coastguard Worker 99*8975f5c5SAndroid Build Coastguard Worker size_t size() const; 100*8975f5c5SAndroid Build Coastguard Worker 101*8975f5c5SAndroid Build Coastguard Worker bool contains(const Config *config) const; 102*8975f5c5SAndroid Build Coastguard Worker 103*8975f5c5SAndroid Build Coastguard Worker // Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29 104*8975f5c5SAndroid Build Coastguard Worker std::vector<const Config *> filter(const AttributeMap &attributeMap) const; 105*8975f5c5SAndroid Build Coastguard Worker 106*8975f5c5SAndroid Build Coastguard Worker ConfigMap::iterator begin(); 107*8975f5c5SAndroid Build Coastguard Worker ConfigMap::iterator end(); 108*8975f5c5SAndroid Build Coastguard Worker 109*8975f5c5SAndroid Build Coastguard Worker private: 110*8975f5c5SAndroid Build Coastguard Worker ConfigMap mConfigs; 111*8975f5c5SAndroid Build Coastguard Worker }; 112*8975f5c5SAndroid Build Coastguard Worker 113*8975f5c5SAndroid Build Coastguard Worker } // namespace egl 114*8975f5c5SAndroid Build Coastguard Worker 115*8975f5c5SAndroid Build Coastguard Worker #endif // INCLUDE_CONFIG_H_ 116