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