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 31 GLenum renderTargetFormat; // TODO(geofflang): remove this 32 GLenum depthStencilFormat; // TODO(geofflang): remove this 33 34 EGLint bufferSize; // Depth of the color buffer 35 EGLint redSize; // Bits of Red in the color buffer 36 EGLint greenSize; // Bits of Green in the color buffer 37 EGLint blueSize; // Bits of Blue in the color buffer 38 EGLint luminanceSize; // Bits of Luminance in the color buffer 39 EGLint alphaSize; // Bits of Alpha in the color buffer 40 EGLint alphaMaskSize; // Bits of Alpha Mask in the mask buffer 41 EGLBoolean bindToTextureRGB; // True if bindable to RGB textures. 42 EGLBoolean bindToTextureRGBA; // True if bindable to RGBA textures. 43 EGLenum colorBufferType; // Color buffer type 44 EGLenum configCaveat; // Any caveats for the configuration 45 EGLint configID; // Unique EGLConfig identifier 46 EGLint conformant; // Whether contexts created with this config are conformant 47 EGLint depthSize; // Bits of Z in the depth buffer 48 EGLint level; // Frame buffer level 49 EGLBoolean matchNativePixmap; // Match the native pixmap format 50 EGLint maxPBufferWidth; // Maximum width of pbuffer 51 EGLint maxPBufferHeight; // Maximum height of pbuffer 52 EGLint maxPBufferPixels; // Maximum size of pbuffer 53 EGLint maxSwapInterval; // Maximum swap interval 54 EGLint minSwapInterval; // Minimum swap interval 55 EGLBoolean nativeRenderable; // EGL_TRUE if native rendering APIs can render to surface 56 EGLint nativeVisualID; // Handle of corresponding native visual 57 EGLint nativeVisualType; // Native visual type of the associated visual 58 EGLint renderableType; // Which client rendering APIs are supported. 59 EGLint sampleBuffers; // Number of multisample buffers 60 EGLint samples; // Number of samples per pixel 61 EGLint stencilSize; // Bits of Stencil in the stencil buffer 62 EGLint surfaceType; // Which types of EGL surfaces are supported. 63 EGLenum transparentType; // Type of transparency supported 64 EGLint transparentRedValue; // Transparent red value 65 EGLint transparentGreenValue; // Transparent green value 66 EGLint transparentBlueValue; // Transparent blue value 67 EGLint optimalOrientation; // Optimal window surface orientation 68 }; 69 70 class ConfigSet 71 { 72 public: 73 EGLint add(const Config &config); 74 const Config &get(EGLint id) const; 75 76 void clear(); 77 78 size_t size() const; 79 80 bool contains(const Config *config) const; 81 82 // Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29 83 std::vector<const Config*> filter(const AttributeMap &attributeMap) const; 84 85 private: 86 typedef std::map<EGLint, const Config> ConfigMap; 87 ConfigMap mConfigs; 88 }; 89 90 } 91 92 #endif // INCLUDE_CONFIG_H_ 93